linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Trond Myklebust <trondmy@gmail.com>,
	Kinglong Mee <kinglongmee@gmail.com>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH v2] NFSD: Convert magic numbers to sizeof() for encode/decode
Date: Thu, 21 Aug 2014 08:50:51 -0400	[thread overview]
Message-ID: <20140821125051.GA31181@fieldses.org> (raw)
In-Reply-To: <20140820221938.GA20442@infradead.org>

On Wed, Aug 20, 2014 at 03:19:38PM -0700, Christoph Hellwig wrote:
> On Wed, Aug 20, 2014 at 09:42:38AM -0400, Trond Myklebust wrote:
> > 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"?
> 
> I think this was in reply to my complaints about the very magic length
> reserved.  I think arithmetic expressions in the form of 4 + 4 + 8 etc
> are fine too, although the sizeof expressions seem to be even more
> obvious and thus preferable to me.  The main problem is something like:
> 
> 
>         p = xdr_reserve_space(xdr, 20);
> 
> hidden deep down in a routine which requires you to count over
> all kinds of statements working with the XDR stream.

OK.  So maybe a better approach would be individual patches for
confusing spots as we come across them.

--b.

      reply	other threads:[~2014-08-21 12:50 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
2014-08-20 22:19   ` Christoph Hellwig
2014-08-21 12:50     ` J. Bruce Fields [this message]

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=20140821125051.GA31181@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=hch@infradead.org \
    --cc=kinglongmee@gmail.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trondmy@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).