.TH DIR 5 .SH NAME dir, dirent \- directory layout .SH SYNOPSIS .nf .ft B #include #include .SH DESCRIPTION The directories of the standard V1 and V2 file systems are arrays of the following structure defined in : .PP .nf .ta +5n +15n +15n struct _v7_direct { ino_t d_ino; /* I-node number */ char d_name[14]; /* Name of up to 14 characters */ }; .fi .DT .PP The .B d_ino field is the inode number of the file named by .BR d_name . .B D_ino is zero if the directory slot isn't allocated. This number is the same as .B st_ino returned by .BR stat (2) unless the entry is mounted on. .B D_name is the name of up to 14 characters, null-terminated only if less then 14 in length. Any character other than null or '\fB/\fP' is allowed. .PP The flex versions of the V1 and V2 file systems have the directory layout defined by these two structures: .PP .nf .ta +5n +15n +15n struct _fl_direct { /* First slot in an entry */ ino_t d_ino; unsigned char d_extent; char d_name[5]; /* The shortest name has length 4 */ }; /* Name of length len needs _EXTENT(len) extra slots. */ #define _EXTENT(len) (((len) + 3) >> 3) struct dirent { /* Largest entry (8 slots) */ ino_t d_ino; /* I-node number */ unsigned char d_extent; /* Extended with this many slots */ char d_name[61]; /* Null terminated name */ }; .fi .DT .PP The .B d_ino and .B d_name fields are like before, except that .B d_name may contain a null-terminated name of up to 60 characters. The .B d_extent field tells how many 8 byte slots follow the first slot to contain the whole entry. An entry is always fully contained within a directory block of Minix native block size. .PP If you have to access directories at the low level then the way to find out if the directory is flex or the old Version 7 type is to look at .B d_extent of the first slot. This slot always contains the "\fB.\fP" entry, so .B d_extent is zero for flex, '\fB.\fP' for V7. .PP See .BR directory (3) for a portable way to access directories, _v7_direct and _fl_direct are not even in the user's namespace. .SH "SEE ALSO" .BR directory (3). .SH AUTHOR Kees J. Bot (kjb@cs.vu.nl)