Re: [PATCH v2] NFSD: Convert magic numbers to sizeof() for encode/decode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux