sunrpc: eliminate RPC_DEBUG
Subsystems (3)
PATCH 1/1 sunrpc: eliminate RPC_DEBUG
Commit f895b252d4edf ("sunrpc: eliminate RPC_DEBUG") introduced use of IS_ENABLED() in a uapi header which leads to a build failure for userspace apps trying to use <linux/nfsd/debug.h>:
linux/nfsd/debug.h:18:15: error: missing binary operator before token "("
#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
^Since this was only used to define NFSD_DEBUG if CONFIG_SUNRPC_DEBUG is enabled, replace instances of NFSD_DEBUG with CONFIG_SUNRPC_DEBUG.
--- fs/lockd/svcsubs.c | 2 +- fs/nfsd/nfs4state.c | 2 +- fs/nfsd/nfsd.h | 2 +- include/uapi/linux/nfsd/debug.h | 8 -------- 4 files changed, 3 insertions(+), 11 deletions(-)
fs/lockd/svcsubs.c +1 -1
@@ -31,7 +31,7 @@static struct hlist_head nlm_files[FILE_NRHASH ];static DEFINE_MUTEX (nlm_file_mutex); -#ifdef NFSD_DEBUG +#ifdef CONFIG_SUNRPC_DEBUG static inline void nlm_debug_print_fh (char *msg,struct nfs_fh *f) {u32 *fhp = (u32 *)f->data;
fs/nfsd/nfs4state.c +1 -1
@@ -1139,7 +1139,7 @@ hash_sessionid(struct nfs4_sessionid *sessionid)return sid->sequence %SESSION_HASH_SIZE ; } -#ifdef NFSD_DEBUG +#ifdef CONFIG_SUNRPC_DEBUG static inline void dump_sessionid (const char *fn,struct nfs4_sessionid *sessionid) {
fs/nfsd/nfsd.h +1 -1
@@ -24,7 +24,7 @@#include "export.h" #undef ifdebug -#ifdef NFSD_DEBUG +#ifdef CONFIG_SUNRPC_DEBUG # define ifdebug (flag) if (nfsd_debug & NFSDDBG_##flag)#else # define ifdebug (flag) if (0)
include/uapi/linux/nfsd/debug.h +0 -8
@@ -12,14 +12,6 @@#include <linux/sunrpc/debug.h> /* -* Enable debugging for nfsd. -* Requires RPC_DEBUG. -*/ -#if IS_ENABLED (CONFIG_SUNRPC_DEBUG ) -# define NFSD_DEBUG 1 -#endif - -/* * knfsd debug flags */ #define NFSDDBG_SOCK 0x0001
Signature · 6 lines
1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
nit: title should probably be "sunrpc: eliminate NFSD_DEBUG"
Quoted 24 lines · On Mon, 6 Apr 2015 09:46:00 -0400 Mark Salter…
Commit
f895b252d4edf("sunrpc: eliminateRPC_DEBUG") introduced use ofIS_ENABLED()in a uapi header which leads to a build failure for userspace apps trying to use <linux/nfsd/debug.h>:
linux/nfsd/debug.h:18:15: error: missing binary operator before token "("#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) ^Since this was only used to define
NFSD_DEBUGifCONFIG_SUNRPC_DEBUGis enabled, replace instances ofNFSD_DEBUGwithCONFIG_SUNRPC_DEBUG.Signed-off-by Mark Salter <[email protected]>--- fs/lockd/svcsubs.c | 2 +- fs/nfsd/nfs4state.c | 2 +- fs/nfsd/nfsd.h | 2 +- include/uapi/linux/nfsd/debug.h | 8 -------- 4 files changed, 3 insertions(+), 11 deletions(-)fs/lockd/svcsubs.c +0
-0
fs/lockd/svcsubs.c line 34
Quoted 5 lines
fs/lockd/svcsubs.c +1
-1@@ -31,7 +31,7 @@static struct hlist_head nlm_files[FILE_NRHASH ];static DEFINE_MUTEX (nlm_file_mutex); -#ifdef NFSD_DEBUG +#ifdef CONFIG_SUNRPC_DEBUG
Technically, you should use #if IS_ENABLED(CONFIG_SUNRPC_DEBUG). That's supposed to help the compiler do checking of the code inside the block even when it's not defined.
In some cases though, that doesn't work correctly and you may need to use plain-old #ifdef if not (particularly if there are symbols that don't exist and are referenced inside the block when CONFIG_SUNRPC_DEBUG isn't defined).
The CodingStyle document has a little blurb on this, fwiw...
Quoted 38 lines
fs/lockd/svcsubs.c +0
-0static inline void nlm_debug_print_fh (char *msg,struct nfs_fh *f) {u32 *fhp = (u32 *)f->data;fs/nfsd/nfs4state.c +1
-1@@ -1139,7 +1139,7 @@ hash_sessionid(struct nfs4_sessionid *sessionid)return sid->sequence %SESSION_HASH_SIZE ; } -#ifdef NFSD_DEBUG +#ifdef CONFIG_SUNRPC_DEBUG static inline void dump_sessionid (const char *fn,struct nfs4_sessionid *sessionid) {fs/nfsd/nfsd.h +1
-1@@ -24,7 +24,7 @@#include "export.h" #undef ifdebug -#ifdef NFSD_DEBUG +#ifdef CONFIG_SUNRPC_DEBUG # define ifdebug (flag) if (nfsd_debug & NFSDDBG_##flag)#else # define ifdebug (flag) if (0)include/uapi/linux/nfsd/debug.h +0
-1@@ -12,14 +12,6 @@#include <linux/sunrpc/debug.h> /* -* Enable debugging for nfsd.
include/uapi/linux/nfsd/debug.h line 17
Quoted 10 lines
include/uapi/linux/nfsd/debug.h +0
-7-* Requires RPC_DEBUG. -*/ -#if IS_ENABLED (CONFIG_SUNRPC_DEBUG ) -# define NFSD_DEBUG 1 -#endif - -/* * knfsd debug flags */ #define NFSDDBG_SOCK 0x0001
Looks fine other than the two nits above...
Quoted 1 line · Jeff Layton
nit: title should probably be "sunrpc: eliminate
NFSD_DEBUG"
*sigh*
Yes, of course. That is what I intended but not what I wrote.
Quoted 97 lines
Quoted 24 lines · On Mon, 6 Apr 2015 09:46:00 -0400 Mark Salter…
Commit
f895b252d4edf("sunrpc: eliminateRPC_DEBUG") introduced use ofIS_ENABLED()in a uapi header which leads to a build failure for userspace apps trying to use <linux/nfsd/debug.h>:
linux/nfsd/debug.h:18:15: error: missing binary operator before token "("#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) ^Since this was only used to define
NFSD_DEBUGifCONFIG_SUNRPC_DEBUGis enabled, replace instances ofNFSD_DEBUGwithCONFIG_SUNRPC_DEBUG.Signed-off-by Mark Salter <[email protected]>--- fs/lockd/svcsubs.c | 2 +- fs/nfsd/nfs4state.c | 2 +- fs/nfsd/nfsd.h | 2 +- include/uapi/linux/nfsd/debug.h | 8 -------- 4 files changed, 3 insertions(+), 11 deletions(-)fs/lockd/svcsubs.c +0
-0fs/lockd/svcsubs.c line 34
Quoted 5 lines
fs/lockd/svcsubs.c +1
-1@@ -31,7 +31,7 @@static struct hlist_head nlm_files[FILE_NRHASH ];static DEFINE_MUTEX (nlm_file_mutex); -#ifdef NFSD_DEBUG +#ifdef CONFIG_SUNRPC_DEBUG Technically, you should use #if
IS_ENABLED(CONFIG_SUNRPC_DEBUG). That's supposed to help the compiler do checking of the code inside the block even when it's not defined.In some cases though, that doesn't work correctly and you may need to use plain-old #ifdef if not (particularly if there are symbols that don't exist and are referenced inside the block when
CONFIG_SUNRPC_DEBUGisn't defined).The CodingStyle document has a little blurb on this, fwiw...
Quoted 38 lines
fs/lockd/svcsubs.c +0
-0static inline void nlm_debug_print_fh (char *msg,struct nfs_fh *f) {u32 *fhp = (u32 *)f->data;fs/nfsd/nfs4state.c +1
-1@@ -1139,7 +1139,7 @@ hash_sessionid(struct nfs4_sessionid *sessionid)return sid->sequence %SESSION_HASH_SIZE ; } -#ifdef NFSD_DEBUG +#ifdef CONFIG_SUNRPC_DEBUG static inline void dump_sessionid (const char *fn,struct nfs4_sessionid *sessionid) {fs/nfsd/nfsd.h +1
-1@@ -24,7 +24,7 @@#include "export.h" #undef ifdebug -#ifdef NFSD_DEBUG +#ifdef CONFIG_SUNRPC_DEBUG # define ifdebug (flag) if (nfsd_debug & NFSDDBG_##flag)#else # define ifdebug (flag) if (0)include/uapi/linux/nfsd/debug.h +0
-1@@ -12,14 +12,6 @@#include <linux/sunrpc/debug.h> /* -* Enable debugging for nfsd. include/uapi/linux/nfsd/debug.h line 17
Quoted 10 lines
include/uapi/linux/nfsd/debug.h +0
-7-* Requires RPC_DEBUG. -*/ -#if IS_ENABLED (CONFIG_SUNRPC_DEBUG ) -# define NFSD_DEBUG 1 -#endif - -/* * knfsd debug flags */ #define NFSDDBG_SOCK 0x0001Looks fine other than the two nits above...
Quoted 8 lines · On Monday 06 April 2015 10:04:52 Jeff Layton wrote:
Quoted 8 lines
fs/lockd/svcsubs.c +0
-0@@ -31,7 +31,7 @@static struct hlist_head nlm_files[FILE_NRHASH ];static DEFINE_MUTEX (nlm_file_mutex);
Quoted 6 lines
fs/lockd/svcsubs.c line 34
Quoted 2 lines
fs/lockd/svcsubs.c +1
-1-#ifdef NFSD_DEBUG +#ifdef CONFIG_SUNRPC_DEBUG Technically, you should use #if
IS_ENABLED(CONFIG_SUNRPC_DEBUG). That's supposed to help the compiler do checking of the code inside the block even when it's not defined.
You probably meant the right thing and wrote something else: you should use 'if (IS_ENABLED(CONFIG_SUNRPC_DEBUG)) { ... }' to get that effect, but that only works within a function. '#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)' is just a nicer way to write '#if defined(CONFIG_SUNRPC_DEBUG) || defined(CONFIG_SUNRPC_DEBUG_MODULE)', which is harmless but pointless here as the symbol would never be set to 'm'.
Arnd
Quoted 16 lines · On Mon, 06 Apr 2015 16:38:09 +0200 Arnd Bergmann…
Quoted 8 lines · On Monday 06 April 2015 10:04:52 Jeff Layton wrote:
Quoted 8 lines
fs/lockd/svcsubs.c +0
-0@@ -31,7 +31,7 @@static struct hlist_head nlm_files[FILE_NRHASH ];static DEFINE_MUTEX (nlm_file_mutex);Quoted 6 lines
fs/lockd/svcsubs.c line 34
Quoted 2 lines
fs/lockd/svcsubs.c +1
-1-#ifdef NFSD_DEBUG +#ifdef CONFIG_SUNRPC_DEBUG Technically, you should use #if
IS_ENABLED(CONFIG_SUNRPC_DEBUG). That's supposed to help the compiler do checking of the code inside the block even when it's not defined.
Quoted 8 lines
You probably meant the right thing and wrote something else: you should use 'if (
IS_ENABLED(CONFIG_SUNRPC_DEBUG)) { ... }' to get that effect, but that only works within a function. '#ifIS_ENABLED(CONFIG_SUNRPC_DEBUG)' is just a nicer way to write '#ifdefined(CONFIG_SUNRPC_DEBUG)||defined(CONFIG_SUNRPC_DEBUG_MODULE)', which is harmless but pointless here as the symbol would never be set to 'm'.Arnd
Ahh ok, good to know. Then this patch is fine as-is then.
Thanks,
Signature · 1 line
Jeff Layton <jlayton-7I+n7zu2hftEKMMhf/[email protected]>
Quoted 26 lines · Jeff Layton
Quoted 23 lines · On Mon, 06 Apr 2015 16:38:09 +0200 Arnd Bergmann…
Quoted 8 lines · On Monday 06 April 2015 10:04:52 Jeff Layton wrote:
Quoted 8 lines
fs/lockd/svcsubs.c +0
-0@@ -31,7 +31,7 @@static struct hlist_head nlm_files[FILE_NRHASH ];static DEFINE_MUTEX (nlm_file_mutex);Quoted 6 lines
fs/lockd/svcsubs.c line 34
Quoted 2 lines
fs/lockd/svcsubs.c +1
-1-#ifdef NFSD_DEBUG +#ifdef CONFIG_SUNRPC_DEBUG Technically, you should use #if
IS_ENABLED(CONFIG_SUNRPC_DEBUG). That's supposed to help the compiler do checking of the code inside the block even when it's not defined.You probably meant the right thing and wrote something else: you should use 'if (
IS_ENABLED(CONFIG_SUNRPC_DEBUG)) { ... }' to get that effect, but that only works within a function. '#ifIS_ENABLED(CONFIG_SUNRPC_DEBUG)' is just a nicer way to write '#ifdefined(CONFIG_SUNRPC_DEBUG)||defined(CONFIG_SUNRPC_DEBUG_MODULE)', which is harmless but pointless here as the symbol would never be set to 'm'.
Quoted 3 lines
Quoted 1 line
Arnd
Ahh ok, good to know. Then this patch is fine as-is then.
Thanks, queueing up for 4.1 and stable.
--b.