[OpenAFS-devel] Solaris 10 - 1.4.3rc3 kernel modules build issues

Jeffrey Hutzelman jhutz@cmu.edu
Mon, 12 Mar 2007 11:47:03 -0400


On Saturday, March 10, 2007 01:30:19 PM -0500 Sean O'Malley 
<omalleys@msu.edu> wrote:

> On Fri, 9 Mar 2007, Jeffrey Hutzelman wrote:
>
>> Only the code after the comment is new.  The code before it is correct -
>> on AFS_LINUX24_ENV, we use OFFSET_MAX; on other platforms we use
>> 0x7fffffff always, and, on 64-bit-kernel platforms, _also_ LONG_MAX
>> (0x7fffffffffffffff).  This has nothing whatsoever to do with the Java
>> issue; it is simply detecting cases where user-land or the OS depicts a
>> whole-file lock using the maximum possible offset instead of 0.  It's
>> also not new.
>>
>
> If I am following this correctly wouldnt it be more concise to write:
>
> if (af->l_len != 0)
> {
> af->l_len = 0;
> }

It would be more concise, but it would also be wrong.
The point is to separate whole-file locks, which we handle, from byte-range 
locks, which we ignore.  Now, POSIX says offset=0, len=0 means the whole 
file, regardless of what its length might be or become.  But some operating 
systems and some programs use a particular very large value instead, and 
this code is about catching those.

BTW, Doug is correct - the reference to LONG_MAX only happens on 
AFS_LINUX_64BIT_ENV && !AFS_LINUX24_ENV, which essentially means Linux 2.2 
on alpha and sparc64.  It does not apply to 64-bit non-Linux systems.

-- Jeff