Re: NFS: set_bit on an 'int' variable OK for 64-bit?

From: Jes Sorensen (jes@linuxcare.com)
Date: Mon Dec 11 2000 - 12:01:30 EST


>>>>> "Ulrich" == Ulrich Weigand <Ulrich.Weigand@de.ibm.com> writes:

Ulrich> Hello,

Ulrich> since test11, the NFS code uses the set_bit and related
Ulrich> routines to manipulate the wb_flags member of the nfs_page
Ulrich> struct (nfs_page.h). Unfortunately, wb_flags has still data
Ulrich> type 'int'.

Ulrich> This is a problem (at least) on the 64-bit S/390 architecture,
Ulrich> as our ..._bit macros assume bit 0 is the least significant
Ulrich> bit of a 'long', which means due to big-endian byte order that
Ulrich> bit 0 resides in the 7th byte of the variable. As an int
Ulrich> occupies only 4 bytes, however, set_bit(0, int) clobbers
Ulrich> memory.

Ulrich> Now the question is, who's correct?

You are, the bit macros should only be used on long's. It happens to
work on little endian bitfield machines like the Alpha but thats the
same as when we had the problem with bit operations on char * in the
file system code a couple of years ago.

The NFS code needs to be fixed for this then.

Jes
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Dec 15 2000 - 21:00:22 EST