lkml.org 
[lkml]   [1998]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: patch for 2.1.109 knfsd filehandles
Date
The sizeof macro is a compile time operator.  The sizeof(foo) is always
going to return the storage requirements of foo. This is a pseudo macro
that gets abused time and again, the compiler NEVER generates code for
the sizeof pseudo call. In short, your if statement will fail to work
correctly on machines where ino_t is > _u32, it will always print a warning.

What you *should* do is something like:

/* code to fixup on 64 bit archs */
if (sizeof(ino_t) > sizeof(_u32)) {
if ((foo & 0xFFFFFFFF00000000)) {
printk(KERN_INFO
"NFSD: the upper 32 bits of ino_t are not clear, can't shove it into a _u32!\n");
}
}

Anyone who makes a flamewar of this will be shot on sight.

--Perry

>
> The casts from 64-bit ino_t fields will work OK as long as the
> filesystems in question don't go beyond using the low-order 32 bits.
> I've added a load-time warning if sizeof(ino_t) is > 4.
>
> I've tested it here and all is working OK, but would appreciate some
> testing on 64-bit systems.
>
> Regards,
> Bill

> + printk(KERN_DEBUG
> + "nfsd_init: initialized fhcache, entries=%lu\n", NFSD_MAXFH);
> + /*
> + * Display a warning if the ino_t is larger than 32 bits.
> + */
> + if (sizeof(ino_t) > sizeof(__u32))
> + printk(KERN_INFO
> + "NFSD: ino_t is %d bytes, using lower 4 bytes\n",
> + sizeof(ino_t));

--
Perry Harrington Linux rules all OSes. APSoft ()
email: perry@apsoft.com Think Blue. /\

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html

\
 
 \ /
  Last update: 2005-03-22 13:43    [W:0.079 / U:0.724 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site