nfs: replace uses of __constant_{endian}
Subsystems (2)
PATCH 1/1 nfs: replace uses of __constant_{endian}
The base versions handle constant folding now, none of these headers are exported to userspace, so the __ prefixed versions are not necessary.
--- include/linux/lockd/xdr.h | 12 ++-- include/linux/lockd/xdr4.h | 10 ++-- include/linux/nfsd/nfsd.h | 132 ++++++++++++++++++++++---------------------- include/linux/sunrpc/xdr.h | 42 +++++++------- 4 files changed, 98 insertions(+), 98 deletions(-)
include/linux/lockd/xdr.h +6 -6
@@ -25,13 +25,13 @@ struct svc_rqst;#define NLM_MAXCOOKIELEN 32#define NLM_MAXSTRLEN 1024 -#define nlm_granted __constant_htonl(NLM_LCK_GRANTED) -#define nlm_lck_denied __constant_htonl(NLM_LCK_DENIED) -#define nlm_lck_denied_nolocks __constant_htonl(NLM_LCK_DENIED_NOLOCKS) -#define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED) -#define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD) +#define nlm_granted cpu_to_be32(NLM_LCK_GRANTED) +#define nlm_lck_denied cpu_to_be32(NLM_LCK_DENIED) +#define nlm_lck_denied_nolocks cpu_to_be32(NLM_LCK_DENIED_NOLOCKS) +#define nlm_lck_blocked cpu_to_be32(NLM_LCK_BLOCKED) +#define nlm_lck_denied_grace_period cpu_to_be32(NLM_LCK_DENIED_GRACE_PERIOD) -#define nlm_drop_reply __constant_htonl(30000) +#define nlm_drop_reply cpu_to_be32(30000)/* Lock info passed via NLM */ struct nlm_lock {
include/linux/lockd/xdr4.h +5 -5
@@ -15,11 +15,11 @@#include <linux/lockd/xdr.h> /* error codes new to NLMv4 */ -#define nlm4_deadlock __constant_htonl(NLM_DEADLCK) -#define nlm4_rofs __constant_htonl(NLM_ROFS) -#define nlm4_stale_fh __constant_htonl(NLM_STALE_FH) -#define nlm4_fbig __constant_htonl(NLM_FBIG) -#define nlm4_failed __constant_htonl(NLM_FAILED) +#define nlm4_deadlock cpu_to_be32(NLM_DEADLCK) +#define nlm4_rofs cpu_to_be32(NLM_ROFS) +#define nlm4_stale_fh cpu_to_be32(NLM_STALE_FH) +#define nlm4_fbig cpu_to_be32(NLM_FBIG) +#define nlm4_failed cpu_to_be32(NLM_FAILED)
include/linux/nfsd/nfsd.h +66 -66
144 lines not on this page · raw message
include/linux/sunrpc/xdr.h +21 -21
48 lines not on this page · raw message
Signature · 1 line
1.6.2.rc0.218.gde7c
Quoted 3 lines · Harvey Harrison
The base versions handle constant folding now, none of these headers are exported to userspace, so the __ prefixed versions are not necessary.
I assume you compile tested this?
I seem to recall that the reason we did it that way was that some of the error codes are used in switch statements, and the value for a 'case:' really has to look like a constant, not just happen to evaluate to one.
However if it really does work with all supported compilers this way, then its a nice improvement, thanks.
NeilBrown
Quoted 32 lines
Signed-off-by Harvey Harrison <[email protected]>--- include/linux/lockd/xdr.h | 12 ++-- include/linux/lockd/xdr4.h | 10 ++-- include/linux/nfsd/nfsd.h | 132 ++++++++++++++++++++++---------------------- include/linux/sunrpc/xdr.h | 42 +++++++------- 4 files changed, 98 insertions(+), 98 deletions(-)include/linux/lockd/xdr.h +6
-6@@ -25,13 +25,13 @@ struct svc_rqst;#define NLM_MAXCOOKIELEN 32#define NLM_MAXSTRLEN 1024 -#define nlm_granted __constant_htonl(NLM_LCK_GRANTED) -#define nlm_lck_denied __constant_htonl(NLM_LCK_DENIED) -#define nlm_lck_denied_nolocks __constant_htonl(NLM_LCK_DENIED_NOLOCKS) -#define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED) -#define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD) +#define nlm_granted cpu_to_be32(NLM_LCK_GRANTED) +#define nlm_lck_denied cpu_to_be32(NLM_LCK_DENIED) +#define nlm_lck_denied_nolocks cpu_to_be32(NLM_LCK_DENIED_NOLOCKS) +#define nlm_lck_blocked cpu_to_be32(NLM_LCK_BLOCKED) +#define nlm_lck_denied_grace_period cpu_to_be32(NLM_LCK_DENIED_GRACE_PERIOD) -#define nlm_drop_reply __constant_htonl(30000) +#define nlm_drop_reply cpu_to_be32(30000)
Quoted 11 lines · NeilBrown
Quoted 3 lines · Harvey Harrison
The base versions handle constant folding now, none of these headers are exported to userspace, so the __ prefixed versions are not necessary.
I assume you compile tested this?
I seem to recall that the reason we did it that way was that some of the error codes are used in switch statements, and the value for a 'case:' really has to look like a constant, not just happen to evaluate to one.
Yes, this requirement was explicitly built-in. See how the various __swabXX bits are done in linux/swab.h.
Harvey
Quoted 8 lines · Harvey Harrison
Quoted 7 lines · NeilBrown
Quoted 3 lines · Harvey Harrison
The base versions handle constant folding now, none of these headers are exported to userspace, so the __ prefixed versions are not necessary.
I assume you compile tested this?
Quoted 7 lines
Quoted 4 lines
I seem to recall that the reason we did it that way was that some of the error codes are used in switch statements, and the value for a 'case:' really has to look like a constant, not just happen to evaluate to one.
Yes, this requirement was explicitly built-in. See how the various
__swabXXbits are done inlinux/swab.h.
Cool, thanks!
NeilBrown
J. Bruce Fields
AppliedQuoted 14 lines · NeilBrown
Quoted 13 lines · Harvey Harrison
Quoted 11 lines · NeilBrown
Quoted 3 lines · Harvey Harrison
The base versions handle constant folding now, none of these headers are exported to userspace, so the __ prefixed versions are not necessary.
I assume you compile tested this?
I seem to recall that the reason we did it that way was that some of the error codes are used in switch statements, and the value for a 'case:' really has to look like a constant, not just happen to evaluate to one.
Quoted 4 lines
Quoted 2 lines
Yes, this requirement was explicitly built-in. See how the various
__swabXXbits are done inlinux/swab.h.Cool, thanks!
Thanks, applied.--b.