Subject: Re: Linux compatibility issue for i386, alpha and m68k
To: None <tech-kern@netbsd.org>
From: John Kohl <jtk@kolvir.arlington.ma.us>
List: tech-kern
Date: 02/11/2001 09:42:18
>>>>> "ED" == Emmanuel Dreyfus <p99dreyf@criens.u-psud.fr> writes:
ED> Hi!
ED> In sys/compat/linux/common/linux_misc.c, line 540, it is said that "the
ED> d_off field should contain the offset of the next valid entry, but in
ED> Linux it has the offset of the entry itself. We emulate that bug here."
ED> I ran the sample program at the end of this post, and it appear that
ED> this bug does not exists in Linux/powerpc-2.2.15pre3. The Linux kernel
ED> has the correct behavior, and we are wrong when we emulate the bug. It's
ED> a bug in our bug emulation ;o)
I just went through this when porting our file system at work to Linux.
In 2.2 and 2.4 Linux kernels, it's actually both wrong and right.
(Linux kernel bug).
Their old directory scanning method (linux 1.x, maybe?) was a syscall
per entry. For that method, they return the d_off of the
current entry.
Their "normal" method gets chunks of entries per syscall, and sends the
d_off of the next entry.
What may be confusing is the linux dirent copying code does some gross
things, because file systems are supposed to send the d_off of the
current entry in their buffers, which the syscall layer then transforms
into the "normal" form with the next entry's d_off.
(And of course the support for the old direntry stuff does *not* do this
transformation, so the file systems cannot possibly return correct data
to all callers).
--
==John Kohl <jtk@kolvir.arlington.ma.us>, <john_kohl@alum.mit.edu>
Home page: <http://people.ne.mediaone.net/jtk/>
Planning a cross-country bicycle trip in 2001, http://www.abbike.com/fast.html