Commit | Line | Data |
---|---|---|
75c01646 C |
1 | .TH DIR 5 "15 January 1983" |
2 | .SH NAME | |
3 | dir \- format of directories | |
4 | .SH SYNOPSIS | |
5 | .B #include <sys/types.h> | |
6 | .br | |
7 | .B #include <sys/dir.h> | |
8 | .SH DESCRIPTION | |
9 | A directory behaves exactly like an ordinary file, save that no | |
10 | user may write into a directory. | |
11 | The fact that a file is a directory is indicated by | |
12 | a bit in the flag word of its i-node entry; see | |
13 | .IR fs (5). | |
14 | The structure of a directory entry as given in the include file is: | |
15 | .RS | |
16 | .ta 8n +10n +10n | |
17 | .PP | |
18 | .nf | |
19 | /* | |
20 | * This sets the "page size" for directories. | |
21 | * Requirements are DEV_BSIZE <= DIRBLKSIZ <= MINBSIZE with | |
22 | * DIRBLKSIZ a power of two. | |
23 | * Dennis Ritchie feels that directory pages should be atomic | |
24 | * operations to the disk, so we use DEV_BSIZE. | |
25 | */ | |
26 | #ifdef KERNEL | |
27 | #define DIRBLKSIZ DEV_BSIZE | |
28 | #else | |
29 | #define DIRBLKSIZ 512 | |
30 | #endif | |
31 | ||
32 | /* | |
33 | * This limits the directory name length. Its main constraint | |
34 | * is that it appears twice in the user structure. (u. area) | |
35 | */ | |
36 | #define MAXNAMLEN 255 | |
37 | ||
38 | struct direct { | |
39 | u_long d_ino; | |
40 | short d_reclen; | |
41 | short d_namlen; | |
42 | char d_name[MAXNAMLEN + 1]; | |
43 | /* typically shorter */ | |
44 | }; | |
45 | ||
46 | struct _dirdesc { | |
47 | int dd_fd; | |
48 | long dd_loc; | |
49 | long dd_size; | |
50 | char dd_buf[DIRBLKSIZ]; | |
51 | }; | |
52 | .fi | |
53 | .RE | |
54 | .PP | |
55 | By convention, the first two entries in each directory | |
56 | are for `\fB.\fR' and `\fB..\fR'. The first is an entry for the | |
57 | directory itself. The second is for the parent directory. | |
58 | The meaning of `\fB..\fR' is modified for the root directory | |
59 | of the master file system | |
60 | .RB (\*(lq / \*(rq), | |
61 | where `\fB..\fR' has the same meaning as `\fB.\fR'. | |
62 | .SH "SEE ALSO" | |
63 | fs(5) |