Messages in this thread | | | Date | Tue, 7 Mar 2000 12:52:45 +0100 | From | Jamie Lokier <> | Subject | Re: [PATCH] Return file types from readdir() |
| |
Ulrich Drepper wrote: > > You might prefer a new syscall or open() flag to the method I use for > > returning the info. If that's the case, ask and I'll write. > > Please use a new syscall.
A new syscall would be tidy, preferably one returning the binary layout that Glibc returns to apps. Perhaps it should take an extra argument like BSD's __readdirx for future whiteout/unionfs support.
(readdir64 would not be implemented as a syscall -- you don't need 64 bit dir offsets).
> Otherwise automatically detecting which method can be used is not that > easy.
It is easy. Look in the new <linux/dirent.h>, at the GETDENTS_DIRENT_D_TYPE macro.
That macro always returns DT_UNKNOWN for dirent records without type info. It is binary compatible with older kernels (and indeed the new one can return typeless records too).
So all you have to add to Glibc is:
user_dirent->d_type = GETDENTS_DIRENT_D_TYPE (kernel_dirent);
It will just work(tm).
enjoy, -- Jamie
- 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.tux.org/lkml/
| |