All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <trondmy@gmail.com>
To: Kinglong Mee <kinglongmee@gmail.com>
Cc: "J. Bruce Fields" <bfields@fieldses.org>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
	Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH v2] NFSD: Convert magic numbers to sizeof() for encode/decode
Date: Wed, 20 Aug 2014 09:42:38 -0400	[thread overview]
Message-ID: <CAABAsM65rWByuQYrWZ8jiieMzkitdRgVA5-zxxXTqE+ddvN8AA@mail.gmail.com> (raw)
In-Reply-To: <53F4994A.3060506@gmail.com>

On Wed, Aug 20, 2014 at 8:49 AM, Kinglong Mee <kinglongmee@gmail.com> wrote:
> v2: update for 3.17.0-rc1
>
> Reported-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> ---
>  fs/nfsd/nfs4acl.c      |   2 +-
>  fs/nfsd/nfs4callback.c |  18 +-
>  fs/nfsd/nfs4idmap.c    |   4 +-
>  fs/nfsd/nfs4proc.c     |  12 +-
>  fs/nfsd/nfs4state.c    |  10 +-
>  fs/nfsd/nfs4xdr.c      | 501 +++++++++++++++++++++++++------------------------
>  6 files changed, 280 insertions(+), 267 deletions(-)
>
> diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c
> index 59fd766..f15dbb2 100644
> --- a/fs/nfsd/nfs4acl.c
> +++ b/fs/nfsd/nfs4acl.c
> @@ -932,7 +932,7 @@ __be32 nfs4_acl_write_who(struct xdr_stream *xdr, int who)
>         for (i = 0; i < ARRAY_SIZE(s2t_map); i++) {
>                 if (s2t_map[i].type != who)
>                         continue;
> -               p = xdr_reserve_space(xdr, s2t_map[i].stringlen + 4);
> +               p = xdr_reserve_space(xdr, sizeof(__be32) + s2t_map[i].stringlen);

OK, can someone please tell me how this is useful for documentation
purposes? Anybody who doesn't know that sizeof(__be32) == 4 has no
business working on XDR code.
I could understand this kind of patch if you were converting to
sizeof(<variable name>), as that documents exactly which variable you
are going to encode in this buffer and so is better than a naked
value, but how is sizeof(__be32) any more useful documentation than
"4"?

Trond

  reply	other threads:[~2014-08-20 13:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20 12:49 [PATCH v2] NFSD: Convert magic numbers to sizeof() for encode/decode Kinglong Mee
2014-08-20 13:42 ` Trond Myklebust [this message]
2014-08-20 22:19   ` Christoph Hellwig
2014-08-21 12:50     ` 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=CAABAsM65rWByuQYrWZ8jiieMzkitdRgVA5-zxxXTqE+ddvN8AA@mail.gmail.com \
    --to=trondmy@gmail.com \
    --cc=bfields@fieldses.org \
    --cc=hch@infradead.org \
    --cc=kinglongmee@gmail.com \
    --cc=linux-nfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.