Skip to contentSkip to conversation

uapi: fix linux/btrfs.h userspace compilation error

PATCH In review Dmitry V. Levin 4 participants 11 messages Feb 15, 2017 – Mar 2, 2017 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uapi: fix linux/btrfs.h userspace compilation error

Stop using NULL to fix the following linux/btrfs.h userspace compilation error:

/usr/include/linux/btrfs.h: In function 'btrfs_err_str':
/usr/include/linux/btrfs.h:740:11: error: 'NULL' undeclared (first use in this function)

    return NULL;
---
 include/uapi/linux/btrfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/btrfs.h +1 -1
index db4c253..01c612f 100644
@@ -737,7 +737,7 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
 			return "add/delete/balance/replace/resize operation "\
 				"in progress";
 		default:
-			return NULL;
+			return 0;
 	}
 }
 
Signature · 1 line
ldv
#1 lore raw

include/uapi/linux/btrfs.h

Quoted 13 lines · Dmitry V. Levin

Stop using NULL to fix the following linux/btrfs.h userspace compilation error:

/usr/include/linux/btrfs.h: In function 'btrfs_err_str':
/usr/include/linux/btrfs.h:740:11: error: 'NULL' undeclared (first use in this function)

    return NULL;
---
 include/uapi/linux/btrfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/btrfs.h +0 -0

[]

include/uapi/linux/btrfs.h static inline char *btrfs_err_str(enum btrfs_err_code err_code) · line 740

Quoted 6 lines
include/uapi/linux/btrfs.h +1 -1
@@ -737,7 +737,7 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
 			return "add/delete/balance/replace/resize operation "\
 				"in progress";
 		default:
-			return NULL;
+			return 0;

Perhaps to avoid some other warnings this might be better

	return (void *)0;
#2 lore raw
In reply to Dmitry V. Levin
Quoted 18 lines · Dmitry V. Levin

Stop using NULL to fix the following linux/btrfs.h userspace compilation error:

/usr/include/linux/btrfs.h: In function 'btrfs_err_str':
/usr/include/linux/btrfs.h:740:11: error: 'NULL' undeclared (first use in this function)

    return NULL;
---
 include/uapi/linux/btrfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/btrfs.h +0 -0
index db4c253..01c612f 100644

include/uapi/linux/btrfs.h static inline char *btrfs_err_str(enum btrfs_err_code err_code) · line 743

Quoted 8 lines
include/uapi/linux/btrfs.h +1 -1
@@ -737,7 +737,7 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
 			return "add/delete/balance/replace/resize operation "\
 				"in progress";
 		default:
-			return NULL;
+			return 0;
 	}
 }
 

Hi Dmitry -

Just remove the whole routine. It's not called from anywhere and is replicated in the userspace headers for btrfsprogs.

-Jeff

Signature · 2 lines
Jeff Mahoney
SUSE Labs
#3 lore raw

PATCH v2 1/1 btrfs: remove btrfs_err_str function from uapi/linux/btrfs.h

btrfs_err_str function is not called from anywhere and is replicated in the userspace headers for btrfs-progs.

It's removal also fixes the following linux/btrfs.h userspace compilation error:

/usr/include/linux/btrfs.h: In function 'btrfs_err_str':
/usr/include/linux/btrfs.h:740:11: error: 'NULL' undeclared (first use in this function)

    return NULL;

---
v2: remove btrfs_err_str rather than fix it

 include/uapi/linux/btrfs.h | 27 ---------------------------
 1 file changed, 27 deletions(-)
include/uapi/linux/btrfs.h +0 -27
index db4c253..dcfc3a5 100644
@@ -713,33 +713,6 @@ enum btrfs_err_code {
 	BTRFS_ERROR_DEV_ONLY_WRITABLE,
 	BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS
 };
-/* An error code to error string mapping for the kernel
-*  error codes
-*/
-static inline char *btrfs_err_str(enum btrfs_err_code err_code)
-{
-	switch (err_code) {
-		case BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET:
-			return "unable to go below two devices on raid1";
-		case BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET:
-			return "unable to go below four devices on raid10";
-		case BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET:
-			return "unable to go below two devices on raid5";
-		case BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET:
-			return "unable to go below three devices on raid6";
-		case BTRFS_ERROR_DEV_TGT_REPLACE:
-			return "unable to remove the dev_replace target dev";
-		case BTRFS_ERROR_DEV_MISSING_NOT_FOUND:
-			return "no missing devices found to remove";
-		case BTRFS_ERROR_DEV_ONLY_WRITABLE:
-			return "unable to remove the only writeable device";
-		case BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS:
-			return "add/delete/balance/replace/resize operation "\
-				"in progress";
-		default:
-			return NULL;
-	}
-}
 
 #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
 				   struct btrfs_ioctl_vol_args)
Signature · 1 line
ldv
Reviewed-by on v2 1/1
#4 lore raw

Re: [PATCH v2] btrfs: remove btrfs_err_str function from uapi/linux/btrfs.h

Quoted 6 lines · Dmitry V. Levin

btrfs_err_str function is not called from anywhere and is replicated in the userspace headers for btrfs-progs.

It's removal also fixes the following linux/btrfs.h userspace compilation error:

Quoted 6 lines

/usr/include/linux/btrfs.h: In function 'btrfs_err_str':
/usr/include/linux/btrfs.h:740:11: error: 'NULL' undeclared (first use in this function)

    return NULL;
#5 lore raw

PATCH v3 1/1 btrfs: remove btrfs_err_str function from uapi/linux/btrfs.h

In reply to Dmitry V. Levin

btrfs_err_str function is not called from anywhere and is replicated in the userspace headers for btrfs-progs.

It's removal also fixes the following linux/btrfs.h userspace compilation error:

/usr/include/linux/btrfs.h: In function 'btrfs_err_str':
/usr/include/linux/btrfs.h:740:11: error: 'NULL' undeclared (first use in this function)

    return NULL;

---
v3: the patch seems to be lost, resending with updated list of addressees

v2: remove btrfs_err_str rather than fix it

 include/uapi/linux/btrfs.h | 27 ---------------------------
 1 file changed, 27 deletions(-)
include/uapi/linux/btrfs.h +0 -27
index db4c253..dcfc3a5 100644
@@ -713,33 +713,6 @@ enum btrfs_err_code {
 	BTRFS_ERROR_DEV_ONLY_WRITABLE,
 	BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS
 };
-/* An error code to error string mapping for the kernel
-*  error codes
-*/
-static inline char *btrfs_err_str(enum btrfs_err_code err_code)
-{
-	switch (err_code) {
-		case BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET:
-			return "unable to go below two devices on raid1";
-		case BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET:
-			return "unable to go below four devices on raid10";
-		case BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET:
-			return "unable to go below two devices on raid5";
-		case BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET:
-			return "unable to go below three devices on raid6";
-		case BTRFS_ERROR_DEV_TGT_REPLACE:
-			return "unable to remove the dev_replace target dev";
-		case BTRFS_ERROR_DEV_MISSING_NOT_FOUND:
-			return "no missing devices found to remove";
-		case BTRFS_ERROR_DEV_ONLY_WRITABLE:
-			return "unable to remove the only writeable device";
-		case BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS:
-			return "add/delete/balance/replace/resize operation "\
-				"in progress";
-		default:
-			return NULL;
-	}
-}
 
 #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
 				   struct btrfs_ioctl_vol_args)
Signature · 1 line
ldv
#6 lore raw

Re: [PATCH v3] btrfs: remove btrfs_err_str function from uapi/linux/btrfs.h

Quoted 8 lines · Dmitry V. Levin

btrfs_err_str function is not called from anywhere and is replicated in the userspace headers for btrfs-progs.

It's removal also fixes the following linux/btrfs.h userspace compilation error:

/usr/include/linux/btrfs.h: In function 'btrfs_err_str':
/usr/include/linux/btrfs.h:740:11: error: 'NULL' undeclared (first use in this function)

Quoted 7 lines
    return NULL;

---
v3: the patch seems to be lost, resending with updated list of addressees

Indeed, I can't find how or where it got lost, sorry. Added to 4.11 again.

#7 lore raw

Re: [PATCH v3] btrfs: remove btrfs_err_str function from uapi/linux/btrfs.h

Quoted 11 lines · David Sterba
Quoted 10 lines · Dmitry V. Levin

btrfs_err_str function is not called from anywhere and is replicated in the userspace headers for btrfs-progs.

It's removal also fixes the following linux/btrfs.h userspace compilation error:

/usr/include/linux/btrfs.h: In function 'btrfs_err_str':
/usr/include/linux/btrfs.h:740:11: error: 'NULL' undeclared (first use in this function)

    return NULL;
Quoted 8 lines
Quoted 5 lines

---
v3: the patch seems to be lost, resending with updated list of addressees

Indeed, I can't find how or where it got lost, sorry. Added to 4.11 again.

So it's because you did not CC linux-btrfs@ , I have the mails in my inbox but haven't found it in the other folder while picking patches.

#8 lore raw

Re: [PATCH v3] btrfs: remove btrfs_err_str function from uapi/linux/btrfs.h

Quoted 18 lines · David Sterba
Quoted 17 lines · David Sterba
Quoted 15 lines · Dmitry V. Levin

btrfs_err_str function is not called from anywhere and is replicated in the userspace headers for btrfs-progs.

It's removal also fixes the following linux/btrfs.h userspace compilation error:

/usr/include/linux/btrfs.h: In function 'btrfs_err_str':
/usr/include/linux/btrfs.h:740:11: error: 'NULL' undeclared (first use in this function)

    return NULL;

---
v3: the patch seems to be lost, resending with updated list of addressees

Quoted 5 lines
Quoted 2 lines

Indeed, I can't find how or where it got lost, sorry. Added to 4.11 again.

So it's because you did not CC linux-btrfs@ , I have the mails in my inbox but haven't found it in the other folder while picking patches.

Thanks, I though so when Cc'ed linux-btrfs@ the last time.

Consider updating MAINTAINERS file so that scripts/get_maintainer.pl would be able to print the right addressees for btrfs header files:

MAINTAINERS +2 -0
index 0001835..04a758f 100644
@@ -2905,4 +2905,6 @@ S:	Maintained
 F:	Documentation/filesystems/btrfs.txt
 F:	fs/btrfs/
+F:	include/linux/btrfs*
+F:	include/uapi/linux/btrfs*
 
 BTTV VIDEO4LINUX DRIVER
Signature · 1 line
ldv
Acked-by
#9 lore raw

Re: [PATCH v3] btrfs: remove btrfs_err_str function from uapi/linux/btrfs.h

Quoted 22 lines · Dmitry V. Levin
Quoted 21 lines · David Sterba
Quoted 19 lines · David Sterba
Quoted 8 lines · Dmitry V. Levin

btrfs_err_str function is not called from anywhere and is replicated in the userspace headers for btrfs-progs.

It's removal also fixes the following linux/btrfs.h userspace compilation error:

/usr/include/linux/btrfs.h: In function 'btrfs_err_str':
/usr/include/linux/btrfs.h:740:11: error: 'NULL' undeclared (first use in this function)

Quoted 7 lines
    return NULL;

---
v3: the patch seems to be lost, resending with updated list of addressees

Indeed, I can't find how or where it got lost, sorry. Added to 4.11 again.

Quoted 7 lines
Quoted 2 lines

So it's because you did not CC linux-btrfs@ , I have the mails in my inbox but haven't found it in the other folder while picking patches.

Thanks, I though so when Cc'ed linux-btrfs@ the last time.

Consider updating MAINTAINERS file so that scripts/get_maintainer.pl would be able to print the right addressees for btrfs header files:

Good idea.

MAINTAINERS S: Maintained · line 2910

Quoted 11 lines
MAINTAINERS +2 -0
index 0001835..04a758f 100644
@@ -2905,4 +2905,6 @@ S:	Maintained
 F:	Documentation/filesystems/btrfs.txt
 F:	fs/btrfs/
+F:	include/linux/btrfs*
+F:	include/uapi/linux/btrfs*
 
 BTTV VIDEO4LINUX DRIVER

Please send a proper patch and add

#10 lore raw

PATCH 1/1 MAINTAINERS: add btrfs file entries

Add file entries for btrfs header files.

---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)
MAINTAINERS +2 -0
index 0001835..04a758f 100644
@@ -2904,6 +2904,8 @@ T:	git git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git
 S:	Maintained
 F:	Documentation/filesystems/btrfs.txt
 F:	fs/btrfs/
+F:	include/linux/btrfs*
+F:	include/uapi/linux/btrfs*
 
 BTTV VIDEO4LINUX DRIVER
 M:	Mauro Carvalho Chehab <[email protected]>
Signature · 1 line
ldv