2010-06-15 18:01:14

by Gilliam, PaulX J

[permalink] [raw]
Subject: RE: [PATCH 02/15] NFSv4.1: Clean up nfs4_setup_sequence

>-----Original Message-----
>From: Trond Myklebust [mailto:[email protected]]
>Sent: Tuesday, June 15, 2010 10:32 AM
>To: Gilliam, PaulX J
>Cc: [email protected]
>Subject: RE: [PATCH 02/15] NFSv4.1: Clean up nfs4_setup_sequence
>
>On Tue, 2010-06-15 at 09:50 -0700, Gilliam, PaulX J wrote:
>> > -----Original Message-----
>> > From: [email protected] [mailto:linux-nfs-
>[email protected]] On Behalf Of Trond Myklebust
>> > Sent: Monday, June 14, 2010 2:51 PM
>> > To: [email protected]
>> > Subject: [PATCH 02/15] NFSv4.1: Clean up nfs4_setup_sequence
>> >
>> > Firstly, there is little point in first zeroing out the entire struct
>> > nfs4_sequence_res, and then initialising all fields save one. Just
>> > initialise the last field to zero...
>>
>> The reason one may want to zero out the entire struct is that in the
>future, someone may add elements to the struct. In that case,
>> memset(res, 0, sizeof(*res));
>> would not have to be changed, and any new elements will "automatically"
>be initialized to a known value.
>>
>> Just a thought.
>
>That assumes this is a structure that is likely to change and/or be
>extended in the future, which is unlikely since the NFSv4.1 protocol
>specification is complete and the SEQUENCE results are fully contained
>in the current set of fields.

Good point.


>
>It also assumes that '0' would be a desirable default value for these
>new fields.
>
>Trond

I think '0' would be a desirable default only in that it could lead to detecting errors earlier.


Back in olden times, Windows NT came in two flavors: "checked" and "unchecked". The "checked" version was much slower and took more resources, but had a ton of "extra" code to check for bad things. It was expected that the "unchecked" version would actually be the one for daily use.

If Linux had a similar thing (maybe it does?) one could use something like this:

#ifdef(CHECKED)
memset(res, 0, sizeof(*res));
#endif


Maybe not in this specific case, but in general.

I'll shut up now and go back to lurking.

-=# Paul Gilliam #=-