[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2540bee2375afb6f08eb92d19e7a1bf0.squirrel@neil.brown.name>
Date: Thu, 12 Feb 2009 13:50:38 +1100 (EST)
From: "NeilBrown" <neilb@...e.de>
To: "Harvey Harrison" <harvey.harrison@...il.com>
Cc: "J. Bruce Fields" <bfields@...ldses.org>,
"Andrew Morton" <akpm@...ux-foundation.org>,
"LKML" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] nfs: replace uses of __constant_{endian}
On Thu, February 12, 2009 12:16 pm, Harvey Harrison wrote:
> 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
>
> Signed-off-by: Harvey Harrison <harvey.harrison@...il.com>
> ---
> 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(-)
>
> diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
> index 7dc5b6c..d39ed1c 100644
> --- a/include/linux/lockd/xdr.h
> +++ b/include/linux/lockd/xdr.h
> @@ -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)
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists