On Sun, Aug 18, 2013 at 06:04:55PM +0200, Johnny Billquist wrote: > Looking at 2.11BSD, it looks like this: > > struct direct { > [snip] > > In NetBSD (fairly current): > > struct dirent {
careful, you want struct direct, not struct dirent: struct direct { u_int32_t d_fileno; /* inode number of entry */ u_int16_t d_reclen; /* length of this record */ u_int8_t d_type; /* file type, see below */ u_int8_t d_namlen; /* length of string in d_name */ char d_name[FFS_MAXNAMLEN + 1];/* name with length <= FFS_MAXNAMLEN */ }; not that it's actually much different. > It's an obvious optimization to keep type already in the directory > itself. But is there any other reason why it was added there? Speed. There's a moderately famous paper "A trace-driven analysis of the UNIX 4.2 BSD file system" -- you might have heard of it :-) -- David A. Holland dholl...@netbsd.org