Re: [PATCH 1/2] xfs_db: add a directory path lookup command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/26/20 6:32 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> 
> Add a command to xfs_db so that we can navigate to inodes by path.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

...


> +/* Path lookup */
> +
> +/* Key for looking up metadata inodes. */
> +struct dirpath {
> +	/* Array of string pointers. */
> +	char		**path;
> +
> +	/* Number of strings in path. */
> +	unsigned int	depth;
> +};

This generates warnings for me in gcc-4.8.5 (hah, I know) as well as
gcc-9.

namei.c:101:12: warning: pointer targets in initialization of ‘const unsigned char *’ from ‘char *’ differ in signedness [-Wpointer-sign]

due to the "unsigned char *" type from:

commit e2bcd936eb95d0019ca5e05f9fdd27e770ddded1
Author: Dave Chinner <david@xxxxxxxxxxxxx>
Date:   Wed Jan 20 10:44:58 2010 +1100

    xfs: directory names are unsigned
    
    Convert the struct xfs_name to use unsigned chars for the name
    strings to match both what is stored on disk (__uint8_t) and what
    the VFS expects (unsigned char).
    
    Signed-off-by: Dave Chinner <david@xxxxxxxxxxxxx>
    Reviewed-by: Christoph Hellwig <hch@xxxxxx>

so maybe just cast to shut it up?
diff --git a/db/namei.c b/db/namei.c
index 4b467ff8..a902f302 100644
--- a/db/namei.c
+++ b/db/namei.c
@@ -98,7 +98,7 @@ path_navigate(
 
 	for (i = 0; i < dirpath->depth; i++) {
 		struct xfs_name	xname = {
-			.name	= dirpath->path[i],
+			.name	= (unsigned char *)dirpath->path[i],
 			.len	= strlen(dirpath->path[i]),
 		};
 
@@ -253,7 +253,7 @@ dir_emit(
 	uint8_t			dtype)
 {
 	char			*display_name;
-	struct xfs_name		xname = { .name = name };
+	struct xfs_name		xname = { .name = (unsigned char *)name };
 	const char		*dstr = get_dstr(mp, dtype);
 	xfs_dahash_t		hash;
 	bool			good;




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux