mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "NeilBrown" <neilb@suse.de>
To: "Harvey Harrison" <harvey.harrison@gmail.com>
Cc: "J. Bruce Fields" <bfields@fieldses.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"LKML" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] nfs: replace uses of __constant_{endian}
Date: Thu, 12 Feb 2009 13:50:38 +1100 (EST)	[thread overview]
Message-ID: <2540bee2375afb6f08eb92d19e7a1bf0.squirrel@neil.brown.name> (raw)
In-Reply-To: <1234401418.5566.19.camel@brick>

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@gmail.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)
>


  reply	other threads:[~2009-02-12  2:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-12  1:16 Harvey Harrison
2009-02-12  2:50 ` NeilBrown [this message]
2009-02-12  2:52   ` Harvey Harrison
2009-02-12  3:15     ` NeilBrown
2009-02-12 22:17       ` J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2540bee2375afb6f08eb92d19e7a1bf0.squirrel@neil.brown.name \
    --to=neilb@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=bfields@fieldses.org \
    --cc=harvey.harrison@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®