cvs commit: src/sys/kern vfs_subr.c src/sys/fs/devfs devfs_vnops.c

Bruce Evans bde at
Thu Nov 10 10:12:10 GMT 2005

On Thu, 10 Nov 2005, Poul-Henning Kamp wrote:

> In message <20051110184723.X71304 at>, Bruce Evans writes:
>> On Thu, 10 Nov 2005, Poul-Henning Kamp wrote:
>>> I don't think I've seen any other proposals than to put it in
>>> dirent where it rightfully belongs.
>>> The reason it is not in dirent is that UFS/FFS uses dirent as the
>>> layout in directories as a microoptimization.
>> I think the reason is exactly the opposite.
> Care to elaborate ?

I think ffs is older than the current `struct dirent', and the latter
was copied from ffs's `struct direct', not vice versa.  This is true
according to history in man pages and sources, but the history is very
incomplete (see dir(5) (there is still no proper dirent(any), only a
link to dir(5)), getdirentries(2), fs(5), ffs(7), <sys/dirent.h>,
<sys/dir.h> and <ufs/ffs/dir.h>).

Even if ffs is newer, it wouldn't be an optimization or otherwise useful
to copy a userland directory format for the disk directory format.

It's a micro-optimization for ffs to copy raw directory entries to
userland.  This is possible because the userland format is the same
as the raw format.

The userland format can't be changed easiy since just changing it would
break compatibility.  Compatibility is apparently especially important
for dirents since we still have <sys/dir.h> which was deprecated 15
years ago :-).


More information about the cvs-src mailing list