This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: [PATCH] for glibc-2.2 linux-specific getdents code
>>>>> " " == Ulrich Drepper <drepper@redhat.com> writes:
> Trond Myklebust <trond.myklebust@fys.uio.no> writes:
>> No. NFS directory offsets have never been signed. They never
>> were in 2.2.x, and they aren't in 2.4.x.
> It doesn't matter what NFS wants or does, I'm using the kernel
> interface. It is supposed to be filesystem independent.
No you're not. You're breaking a kernel interface that dates from
before linux-2.2.x for which such unsigned directory offsets were
allowed.
The fact that the kernel defintion of the struct dirent(|64) has an
entry d_off of type (|l)off_t is irrelevant.
The kernel dirent structures of most UNIX systems are defined in
exactly the same way. However those same UNIX kernels are required to
support the existence of non-POSIX filesystems (of which NFS is one)
and therefore accept the fact that d_off is opaque. So has Linux up to
now.
For instance from the SunOS-5.7 manpage for dirent:
The dirent structure is defined:
struct dirent {
ino_t d_ino;
off_t d_off;
unsigned short d_reclen;
char d_name[1];
};
The d_ino is a number which is unique for each file in the
file system. The d_off entry contains a value which is
interpretable only by the filesystem that generated it.
The last line being the key here.
Cheers,
Trond