|
|
DataMuseum.dkPresents historical artifacts from the history of: RC9000 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about RC9000 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: d
Length: 5426 (0x1532)
Names: »dir.5«
└─⟦50656ff4a⟧ Bits:30010538 TX 3.1 Coldstart
└─⟦bbf173f5c⟧ »0004«
└─⟦this⟧ »./usr/man/cat5/dir.5«
0x0000…0020 0a 0a 0a 5f 08 4f 5f 08 6e 5f 08 6c 5f 08 69 5f 08 6e 5f 08 65 20 5f 08 4d 5f 08 61 5f 08 6e 5f ┆ _ O_ n_ l_ i_ n_ e _ M_ a_ n_┆
0x0020…0040 08 75 5f 08 61 5f 08 6c 20 20 20 20 20 20 20 20 20 20 20 20 20 46 69 6c 65 20 46 6f 72 6d 61 74 ┆ u_ a_ l File Format┆
0x0040…0060 73 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 69 72 28 35 29 0a 0a 0a 0a ┆s dir(5) ┆
0x0060…0080 4e 08 4e 08 4e 08 4e 41 08 41 08 41 08 41 4d 08 4d 08 4d 08 4d 45 08 45 08 45 08 45 0a 20 20 20 ┆N N N NA A A AM M M ME E E E ┆
0x0080…00a0 20 20 64 69 72 20 2d 20 66 6f 72 6d 61 74 20 6f 66 20 64 69 72 65 63 74 6f 72 69 65 73 0a 0a 53 ┆ dir - format of directories S┆
0x00a0…00c0 08 53 08 53 08 53 59 08 59 08 59 08 59 4e 08 4e 08 4e 08 4e 54 08 54 08 54 08 54 41 08 41 08 41 ┆ S S SY Y Y YN N N NT T T TA A A┆
0x00c0…00e0 08 41 58 08 58 08 58 08 58 0a 20 20 20 20 20 23 08 23 08 23 08 23 69 08 69 08 69 08 69 6e 08 6e ┆ AX X X X # # # #i i i in n┆
0x00e0…0100 08 6e 08 6e 63 08 63 08 63 08 63 6c 08 6c 08 6c 08 6c 75 08 75 08 75 08 75 64 08 64 08 64 08 64 ┆ n nc c c cl l l lu u u ud d d d┆
0x0100…0120 65 08 65 08 65 08 65 20 3c 08 3c 08 3c 08 3c 73 08 73 08 73 08 73 79 08 79 08 79 08 79 73 08 73 ┆e e e e < < < <s s s sy y y ys s┆
0x0120…0140 08 73 08 73 2f 08 2f 08 2f 08 2f 74 08 74 08 74 08 74 79 08 79 08 79 08 79 70 08 70 08 70 08 70 ┆ s s/ / / /t t t ty y y yp p p p┆
0x0140…0160 65 08 65 08 65 08 65 73 08 73 08 73 08 73 2e 08 2e 08 2e 08 2e 68 08 68 08 68 08 68 3e 08 3e 08 ┆e e e es s s s. . . .h h h h> > ┆
0x0160…0180 3e 08 3e 0a 20 20 20 20 20 23 08 23 08 23 08 23 69 08 69 08 69 08 69 6e 08 6e 08 6e 08 6e 63 08 ┆> > # # # #i i i in n n nc ┆
0x0180…01a0 63 08 63 08 63 6c 08 6c 08 6c 08 6c 75 08 75 08 75 08 75 64 08 64 08 64 08 64 65 08 65 08 65 08 ┆c c cl l l lu u u ud d d de e e ┆
0x01a0…01c0 65 20 3c 08 3c 08 3c 08 3c 73 08 73 08 73 08 73 79 08 79 08 79 08 79 73 08 73 08 73 08 73 2f 08 ┆e < < < <s s s sy y y ys s s s/ ┆
0x01c0…01e0 2f 08 2f 08 2f 64 08 64 08 64 08 64 69 08 69 08 69 08 69 72 08 72 08 72 08 72 2e 08 2e 08 2e 08 ┆/ / /d d d di i i ir r r r. . . ┆
0x01e0…0200 2e 68 08 68 08 68 08 68 3e 08 3e 08 3e 08 3e 0a 0a 44 08 44 08 44 08 44 45 08 45 08 45 08 45 53 ┆.h h h h> > > > D D D DE E E ES┆
0x0200…0220 08 53 08 53 08 53 43 08 43 08 43 08 43 52 08 52 08 52 08 52 49 08 49 08 49 08 49 50 08 50 08 50 ┆ S S SC C C CR R R RI I I IP P P┆
0x0220…0240 08 50 54 08 54 08 54 08 54 49 08 49 08 49 08 49 4f 08 4f 08 4f 08 4f 4e 08 4e 08 4e 08 4e 0a 20 ┆ PT T T TI I I IO O O ON N N N ┆
0x0240…0260 20 20 20 20 41 20 64 69 72 65 63 74 6f 72 79 20 62 65 68 61 76 65 73 20 65 78 61 63 74 6c 79 20 ┆ A directory behaves exactly ┆
0x0260…0280 6c 69 6b 65 20 61 6e 20 6f 72 64 69 6e 61 72 79 20 66 69 6c 65 2c 20 73 61 76 65 20 74 68 61 74 ┆like an ordinary file, save that┆
0x0280…02a0 0a 20 20 20 20 20 6e 6f 20 75 73 65 72 20 6d 61 79 20 77 72 69 74 65 20 69 6e 74 6f 20 61 20 64 ┆ no user may write into a d┆
0x02a0…02c0 69 72 65 63 74 6f 72 79 2e 20 20 54 68 65 20 66 61 63 74 20 74 68 61 74 20 61 20 66 69 6c 65 20 ┆irectory. The fact that a file ┆
0x02c0…02e0 69 73 0a 20 20 20 20 20 61 20 64 69 72 65 63 74 6f 72 79 20 69 73 20 69 6e 64 69 63 61 74 65 64 ┆is a directory is indicated┆
0x02e0…0300 20 62 79 20 61 20 62 69 74 20 69 6e 20 74 68 65 20 66 6c 61 67 20 77 6f 72 64 20 6f 66 20 69 74 ┆ by a bit in the flag word of it┆
0x0300…0320 73 0a 20 20 20 20 20 69 2d 6e 6f 64 65 20 65 6e 74 72 79 3b 20 73 65 65 20 5f 08 66 5f 08 73 28 ┆s i-node entry; see _ f_ s(┆
0x0320…0340 35 29 2e 20 20 54 68 65 20 73 74 72 75 63 74 75 72 65 20 6f 66 20 61 20 64 69 72 65 63 74 6f 72 ┆5). The structure of a director┆
0x0340…0360 79 20 65 6e 74 72 79 0a 20 20 20 20 20 61 73 20 67 69 76 65 6e 20 69 6e 20 74 68 65 20 69 6e 63 ┆y entry as given in the inc┆
0x0360…0380 6c 75 64 65 20 66 69 6c 65 20 69 73 3a 0a 0a 20 20 20 20 20 23 69 66 6e 64 65 66 20 5f 44 49 52 ┆lude file is: #ifndef _DIR┆
0x0380…03a0 5f 0a 0a 20 20 20 20 20 23 64 65 66 69 6e 65 20 5f 44 49 52 5f 0a 0a 20 20 20 20 20 2f 2a 0a 20 ┆_ #define _DIR_ /* ┆
0x03a0…03c0 20 20 20 20 20 2a 20 41 20 64 69 72 65 63 74 6f 72 79 20 63 6f 6e 73 69 73 74 73 20 6f 66 20 73 ┆ * A directory consists of s┆
0x03c0…03e0 6f 6d 65 20 6e 75 6d 62 65 72 20 6f 66 20 62 6c 6f 63 6b 73 20 6f 66 20 44 49 52 42 4c 4b 53 49 ┆ome number of blocks of DIRBLKSI┆
0x03e0…0400 5a 0a 20 20 20 20 20 20 2a 20 62 79 74 65 73 2c 20 77 68 65 72 65 20 44 49 52 42 4c 4b 53 49 5a ┆Z * bytes, where DIRBLKSIZ┆
0x0400…0420 20 69 73 20 63 68 6f 73 65 6e 20 73 75 63 68 20 74 68 61 74 20 69 74 20 63 61 6e 20 62 65 20 74 ┆ is chosen such that it can be t┆
0x0420…0440 72 61 6e 73 66 65 72 72 65 64 0a 20 20 20 20 20 20 2a 20 74 6f 20 64 69 73 6b 20 69 6e 20 61 20 ┆ransferred * to disk in a ┆
0x0440…0460 73 69 6e 67 6c 65 20 61 74 6f 6d 69 63 20 6f 70 65 72 61 74 69 6f 6e 20 28 65 2e 67 2e 20 31 30 ┆single atomic operation (e.g. 10┆
0x0460…0480 32 34 20 62 79 74 65 73 20 6f 6e 20 54 58 20 73 79 73 74 65 6d 73 29 2e 0a 20 20 20 20 20 20 2a ┆24 bytes on TX systems). *┆
0x0480…04a0 0a 20 20 20 20 20 20 2a 20 45 61 63 68 20 44 49 52 42 4c 4b 53 49 5a 20 62 79 74 65 20 62 6c 6f ┆ * Each DIRBLKSIZ byte blo┆
0x04a0…04c0 63 6b 20 63 6f 6e 74 61 69 6e 73 20 73 6f 6d 65 20 6e 75 6d 62 65 72 20 6f 66 20 64 69 72 65 63 ┆ck contains some number of direc┆
0x04c0…04e0 74 6f 72 79 20 65 6e 74 72 79 0a 20 20 20 20 20 20 2a 20 73 74 72 75 63 74 75 72 65 73 2c 20 77 ┆tory entry * structures, w┆
0x04e0…0500 68 69 63 68 20 61 72 65 20 6f 66 20 76 61 72 69 61 62 6c 65 20 6c 65 6e 67 74 68 2e 20 20 45 61 ┆hich are of variable length. Ea┆
0x0500…0520 63 68 20 64 69 72 65 63 74 6f 72 79 20 65 6e 74 72 79 20 68 61 73 0a 20 20 20 20 20 20 2a 20 61 ┆ch directory entry has * a┆
0x0520…0540 20 73 74 72 75 63 74 20 64 69 72 65 63 74 20 61 74 20 74 68 65 20 66 72 6f 6e 74 20 6f 66 20 69 ┆ struct direct at the front of i┆
0x0540…0560 74 2c 20 63 6f 6e 74 61 69 6e 69 6e 67 20 69 74 73 20 69 6e 6f 64 65 20 6e 75 6d 62 65 72 2c 0a ┆t, containing its inode number, ┆
0x0560…0580 20 20 20 20 20 20 2a 20 74 68 65 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 20 65 6e 74 72 79 2c ┆ * the length of the entry,┆
0x0580…05a0 20 61 6e 64 20 74 68 65 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 20 6e 61 6d 65 20 63 6f 6e 74 ┆ and the length of the name cont┆
0x05a0…05c0 61 69 6e 65 64 20 69 6e 0a 20 20 20 20 20 20 2a 20 74 68 65 20 65 6e 74 72 79 2e 20 20 54 68 65 ┆ained in * the entry. The┆
0x05c0…05e0 73 65 20 61 72 65 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 74 68 65 20 6e 61 6d 65 20 70 61 64 64 ┆se are followed by the name padd┆
0x05e0…0600 65 64 20 74 6f 20 61 20 34 20 62 79 74 65 20 62 6f 75 6e 64 61 72 79 0a 20 20 20 20 20 20 2a 20 ┆ed to a 4 byte boundary * ┆
0x0600…0620 77 69 74 68 20 6e 75 6c 6c 20 62 79 74 65 73 2e 20 20 41 6c 6c 20 6e 61 6d 65 73 20 61 72 65 20 ┆with null bytes. All names are ┆
0x0620…0640 67 75 61 72 61 6e 74 65 65 64 20 6e 75 6c 6c 20 74 65 72 6d 69 6e 61 74 65 64 2e 0a 20 20 20 20 ┆guaranteed null terminated. ┆
0x0640…0660 20 20 2a 20 54 68 65 20 6d 61 78 69 6d 75 6d 20 6c 65 6e 67 74 68 20 6f 66 20 61 20 6e 61 6d 65 ┆ * The maximum length of a name┆
0x0660…0680 20 69 6e 20 61 20 64 69 72 65 63 74 6f 72 79 20 69 73 20 4d 41 58 4e 41 4d 4c 45 4e 2e 0a 20 20 ┆ in a directory is MAXNAMLEN. ┆
0x0680…06a0 20 20 20 20 2a 0a 20 20 20 20 20 20 2a 20 54 68 65 20 6d 61 63 72 6f 20 44 49 52 53 49 5a 28 64 ┆ * * The macro DIRSIZ(d┆
0x06a0…06c0 70 29 20 67 69 76 65 73 20 74 68 65 20 61 6d 6f 75 6e 74 20 6f 66 20 73 70 61 63 65 20 72 65 71 ┆p) gives the amount of space req┆
0x06c0…06e0 75 69 72 65 64 20 74 6f 20 72 65 70 72 65 73 65 6e 74 0a 20 20 20 20 20 20 2a 20 61 20 64 69 72 ┆uired to represent * a dir┆
0x06e0…0700 65 63 74 6f 72 79 20 65 6e 74 72 79 2e 20 20 46 72 65 65 20 73 70 61 63 65 20 69 6e 20 61 20 64 ┆ectory entry. Free space in a d┆
0x0700…0720 69 72 65 63 74 6f 72 79 20 69 73 20 72 65 70 72 65 73 65 6e 74 65 64 20 62 79 0a 20 20 20 20 20 ┆irectory is represented by ┆
0x0720…0740 20 2a 20 65 6e 74 72 69 65 73 20 77 68 69 63 68 20 68 61 76 65 20 64 70 2d 3e 64 5f 72 65 63 6c ┆ * entries which have dp->d_recl┆
0x0740…0760 65 6e 20 3e 20 44 49 52 53 49 5a 28 64 70 29 2e 20 20 41 6c 6c 20 44 49 52 42 4c 4b 53 49 5a 20 ┆en > DIRSIZ(dp). All DIRBLKSIZ ┆
0x0760…0780 62 79 74 65 73 0a 20 20 20 20 20 20 2a 20 69 6e 20 61 20 64 69 72 65 63 74 6f 72 79 20 62 6c 6f ┆bytes * in a directory blo┆
0x0780…07a0 63 6b 20 61 72 65 20 63 6c 61 69 6d 65 64 20 62 79 20 74 68 65 20 64 69 72 65 63 74 6f 72 79 20 ┆ck are claimed by the directory ┆
0x07a0…07c0 65 6e 74 72 69 65 73 2e 20 20 54 68 69 73 0a 20 20 20 20 20 20 2a 20 75 73 75 61 6c 6c 79 20 72 ┆entries. This * usually r┆
0x07c0…07e0 65 73 75 6c 74 73 20 69 6e 20 74 68 65 20 6c 61 73 74 20 65 6e 74 72 79 20 69 6e 20 61 20 64 69 ┆esults in the last entry in a di┆
0x07e0…0800 72 65 63 74 6f 72 79 20 68 61 76 69 6e 67 20 61 20 6c 61 72 67 65 0a 20 20 20 20 20 20 2a 20 64 ┆rectory having a large * d┆
0x0800…0820 70 2d 3e 64 5f 72 65 63 6c 65 6e 2e 20 20 57 68 65 6e 20 65 6e 74 72 69 65 73 20 61 72 65 20 64 ┆p->d_reclen. When entries are d┆
0x0820…0840 65 6c 65 74 65 64 20 66 72 6f 6d 20 61 20 64 69 72 65 63 74 6f 72 79 2c 20 74 68 65 0a 20 20 20 ┆eleted from a directory, the ┆
0x0840…0860 20 20 20 2a 20 73 70 61 63 65 20 69 73 20 72 65 74 75 72 6e 65 64 20 74 6f 20 74 68 65 20 70 72 ┆ * space is returned to the pr┆
0x0860…0880 65 76 69 6f 75 73 20 65 6e 74 72 79 20 69 6e 20 74 68 65 20 73 61 6d 65 20 64 69 72 65 63 74 6f ┆evious entry in the same directo┆
0x0880…08a0 72 79 0a 20 20 20 20 20 20 2a 20 62 6c 6f 63 6b 20 62 79 20 69 6e 63 72 65 61 73 69 6e 67 20 69 ┆ry * block by increasing i┆
0x08a0…08c0 74 73 20 64 70 2d 3e 64 5f 72 65 63 6c 65 6e 2e 20 20 49 66 20 74 68 65 20 66 69 72 73 74 20 65 ┆ts dp->d_reclen. If the first e┆
0x08c0…08e0 6e 74 72 79 20 6f 66 0a 20 20 20 20 20 20 2a 20 61 20 64 69 72 65 63 74 6f 72 79 20 62 6c 6f 63 ┆ntry of * a directory bloc┆
0x08e0…0900 6b 20 69 73 20 66 72 65 65 2c 20 74 68 65 6e 20 69 74 73 20 64 70 2d 3e 64 5f 69 6e 6f 20 69 73 ┆k is free, then its dp->d_ino is┆
0x0900…0920 20 73 65 74 20 74 6f 20 30 2e 0a 20 20 20 20 20 20 2a 20 45 6e 74 72 69 65 73 20 6f 74 68 65 72 ┆ set to 0. * Entries other┆
0x0920…0940 20 74 68 61 6e 20 74 68 65 20 66 69 72 73 74 20 69 6e 20 61 20 64 69 72 65 63 74 6f 72 79 20 64 ┆ than the first in a directory d┆
0x0940…0960 6f 20 6e 6f 74 20 6e 6f 72 6d 61 6c 6c 79 20 68 61 76 65 0a 20 20 20 20 20 20 2a 20 64 70 2d 3e ┆o not normally have * dp->┆
0x0960…0980 64 5f 69 6e 6f 20 73 65 74 20 74 6f 20 30 2e 0a 20 20 20 20 20 20 2a 2f 0a 20 20 20 20 20 2f 2a ┆d_ino set to 0. */ /*┆
0x0980…09a0 20 73 6f 20 75 73 65 72 20 70 72 6f 67 72 61 6d 73 20 63 61 6e 20 6a 75 73 74 20 69 6e 63 6c 75 ┆ so user programs can just inclu┆
0x09a0…09c0 64 65 20 64 69 72 2e 68 20 2a 2f 0a 20 20 20 20 20 23 69 66 20 21 64 65 66 69 6e 65 64 28 4b 45 ┆de dir.h */ #if !defined(KE┆
0x09c0…09e0 52 4e 45 4c 29 20 26 26 20 21 64 65 66 69 6e 65 64 28 44 45 56 5f 42 53 49 5a 45 29 0a 20 20 20 ┆RNEL) && !defined(DEV_BSIZE) ┆
0x09e0…0a00 20 20 23 64 65 66 69 6e 65 20 44 45 56 5f 42 53 49 5a 45 20 20 20 20 20 20 20 31 30 32 34 0a 20 ┆ #define DEV_BSIZE 1024 ┆
0x0a00…0a20 20 20 20 20 23 65 6e 64 69 66 0a 20 20 20 20 20 23 64 65 66 69 6e 65 20 44 49 52 42 4c 4b 53 49 ┆ #endif #define DIRBLKSI┆
0x0a20…0a40 5a 20 20 20 20 20 20 20 44 45 56 5f 42 53 49 5a 45 0a 20 20 20 20 20 23 64 65 66 69 6e 65 20 4d ┆Z DEV_BSIZE #define M┆
0x0a40…0a60 41 58 4e 41 4d 4c 45 4e 20 20 20 20 20 20 20 32 35 35 0a 0a 20 20 20 20 20 73 74 72 75 63 74 20 ┆AXNAMLEN 255 struct ┆
0x0a60…0a80 20 64 69 72 65 63 74 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 75 5f 6c 6f 6e 67 20 20 64 ┆ direct { u_long d┆
0x0a80…0aa0 5f 69 6e 6f 3b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 69 6e 6f 64 65 20 ┆_ino; /* inode ┆
0x0aa0…0ac0 6e 75 6d 62 65 72 20 6f 66 20 65 6e 74 72 79 20 2a 2f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ┆number of entry */ ┆
0x0ac0…0ae0 75 5f 73 68 6f 72 74 20 64 5f 72 65 63 6c 65 6e 3b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ┆u_short d_reclen; ┆
0x0ae0…0b00 2f 2a 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 69 73 20 72 65 63 6f 72 64 20 2a 2f 0a 20 20 20 20 ┆/* length of this record */ ┆
0x0b00…0b20 20 20 20 20 20 20 20 20 20 75 5f 73 68 6f 72 74 20 64 5f 6e 61 6d 6c 65 6e 3b 20 20 20 20 20 20 ┆ u_short d_namlen; ┆
0x0b20…0b40 20 20 20 20 20 20 20 20 20 2f 2a 20 6c 65 6e 67 74 68 20 6f 66 20 73 74 72 69 6e 67 20 69 6e 20 ┆ /* length of string in ┆
0x0b40…0b60 64 5f 6e 61 6d 65 20 2a 2f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 63 68 61 72 20 20 20 20 64 ┆d_name */ char d┆
0x0b60…0b80 5f 6e 61 6d 65 5b 4d 41 58 4e 41 4d 4c 45 4e 20 2b 20 31 5d 3b 20 20 2f 2a 20 6e 61 6d 65 20 6d ┆_name[MAXNAMLEN + 1]; /* name m┆
0x0b80…0ba0 75 73 74 20 62 65 20 6e 6f 20 6c 6f 6e 67 65 72 20 74 68 61 6e 20 74 68 69 73 20 2a 2f 0a 20 20 ┆ust be no longer than this */ ┆
0x0ba0…0bc0 20 20 20 7d 3b 0a 0a 20 20 20 20 20 2f 2a 0a 20 20 20 20 20 20 2a 20 54 68 65 20 44 49 52 53 49 ┆ }; /* * The DIRSI┆
0x0bc0…0be0 5a 20 6d 61 63 72 6f 20 67 69 76 65 73 20 74 68 65 20 6d 69 6e 69 6d 75 6d 20 72 65 63 6f 72 64 ┆Z macro gives the minimum record┆
0x0be0…0c00 20 6c 65 6e 67 74 68 20 77 68 69 63 68 20 77 69 6c 6c 20 68 6f 6c 64 0a 0a 0a 0a 0a 0a 0a 20 20 ┆ length which will hold ┆
0x0c00…0c20 20 20 20 20 2a 20 74 68 65 20 64 69 72 65 63 74 6f 72 79 20 65 6e 74 72 79 2e 20 20 54 68 69 73 ┆ * the directory entry. This┆
0x0c20…0c40 20 72 65 71 75 69 72 65 73 20 74 68 65 20 61 6d 6f 75 6e 74 20 6f 66 20 73 70 61 63 65 20 69 6e ┆ requires the amount of space in┆
0x0c40…0c60 20 73 74 72 75 63 74 20 64 69 72 65 63 74 0a 20 20 20 20 20 20 2a 20 77 69 74 68 6f 75 74 20 74 ┆ struct direct * without t┆
0x0c60…0c80 68 65 20 64 5f 6e 61 6d 65 20 66 69 65 6c 64 2c 20 70 6c 75 73 20 65 6e 6f 75 67 68 20 73 70 61 ┆he d_name field, plus enough spa┆
0x0c80…0ca0 63 65 20 66 6f 72 20 74 68 65 20 6e 61 6d 65 20 77 69 74 68 20 61 20 74 65 72 6d 69 6e 61 74 69 ┆ce for the name with a terminati┆
0x0ca0…0cc0 6e 67 0a 20 20 20 20 20 20 2a 20 6e 75 6c 6c 20 62 79 74 65 20 28 64 70 2d 3e 64 5f 6e 61 6d 6c ┆ng * null byte (dp->d_naml┆
0x0cc0…0ce0 65 6e 2b 31 29 2c 20 72 6f 75 6e 64 65 64 20 75 70 20 74 6f 20 61 20 34 20 62 79 74 65 20 62 6f ┆en+1), rounded up to a 4 byte bo┆
0x0ce0…0d00 75 6e 64 61 72 79 2e 0a 20 20 20 20 20 20 2a 2f 0a 20 20 20 20 20 23 75 6e 64 65 66 20 44 49 52 ┆undary. */ #undef DIR┆
0x0d00…0d20 53 49 5a 0a 20 20 20 20 20 23 64 65 66 69 6e 65 20 44 49 52 53 49 5a 28 64 70 29 20 5c 0a 20 20 ┆SIZ #define DIRSIZ(dp) \ ┆
0x0d20…0d40 20 20 20 20 20 20 20 28 28 73 69 7a 65 6f 66 20 28 73 74 72 75 63 74 20 64 69 72 65 63 74 29 20 ┆ ((sizeof (struct direct) ┆
0x0d40…0d60 2d 20 28 4d 41 58 4e 41 4d 4c 45 4e 2b 31 29 29 20 2b 20 28 28 28 64 70 29 2d 3e 64 5f 6e 61 6d ┆- (MAXNAMLEN+1)) + (((dp)->d_nam┆
0x0d60…0d80 6c 65 6e 2b 31 20 2b 20 33 29 20 26 7e 20 33 29 29 0a 0a 20 20 20 20 20 23 69 66 6e 64 65 66 20 ┆len+1 + 3) &~ 3)) #ifndef ┆
0x0d80…0da0 4b 45 52 4e 45 4c 0a 20 20 20 20 20 2f 2a 0a 20 20 20 20 20 20 2a 20 44 65 66 69 6e 69 74 69 6f ┆KERNEL /* * Definitio┆
0x0da0…0dc0 6e 73 20 66 6f 72 20 6c 69 62 72 61 72 79 20 72 6f 75 74 69 6e 65 73 20 6f 70 65 72 61 74 69 6e ┆ns for library routines operatin┆
0x0dc0…0de0 67 20 6f 6e 20 64 69 72 65 63 74 6f 72 69 65 73 2e 0a 20 20 20 20 20 20 2a 2f 0a 20 20 20 20 20 ┆g on directories. */ ┆
0x0de0…0e00 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 5f 64 69 72 64 65 73 63 20 7b 0a 20 20 20 20 20 20 ┆typedef struct _dirdesc { ┆
0x0e00…0e20 20 20 20 20 20 20 20 69 6e 74 20 20 20 20 20 64 64 5f 66 64 3b 0a 20 20 20 20 20 20 20 20 20 20 ┆ int dd_fd; ┆
0x0e20…0e40 20 20 20 6c 6f 6e 67 20 20 20 20 64 64 5f 6c 6f 63 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 ┆ long dd_loc; ┆
0x0e40…0e60 6c 6f 6e 67 20 20 20 20 64 64 5f 73 69 7a 65 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 63 68 ┆long dd_size; ch┆
0x0e60…0e80 61 72 20 20 20 20 64 64 5f 62 75 66 5b 44 49 52 42 4c 4b 53 49 5a 5d 3b 0a 20 20 20 20 20 7d 20 ┆ar dd_buf[DIRBLKSIZ]; } ┆
0x0e80…0ea0 44 49 52 3b 0a 20 20 20 20 20 23 69 66 6e 64 65 66 20 4e 55 4c 4c 0a 20 20 20 20 20 23 64 65 66 ┆DIR; #ifndef NULL #def┆
0x0ea0…0ec0 69 6e 65 20 4e 55 4c 4c 20 30 0a 20 20 20 20 20 23 65 6e 64 69 66 0a 20 20 20 20 20 65 78 74 65 ┆ine NULL 0 #endif exte┆
0x0ec0…0ee0 72 6e 20 20 44 49 52 20 2a 6f 70 65 6e 64 69 72 28 29 3b 0a 20 20 20 20 20 65 78 74 65 72 6e 20 ┆rn DIR *opendir(); extern ┆
0x0ee0…0f00 20 73 74 72 75 63 74 20 64 69 72 65 63 74 20 2a 72 65 61 64 64 69 72 28 29 3b 0a 20 20 20 20 20 ┆ struct direct *readdir(); ┆
0x0f00…0f20 65 78 74 65 72 6e 20 20 6c 6f 6e 67 20 74 65 6c 6c 64 69 72 28 29 3b 0a 20 20 20 20 20 65 78 74 ┆extern long telldir(); ext┆
0x0f20…0f40 65 72 6e 20 20 76 6f 69 64 20 73 65 65 6b 64 69 72 28 29 3b 0a 20 20 20 20 20 23 64 65 66 69 6e ┆ern void seekdir(); #defin┆
0x0f40…0f60 65 20 72 65 77 69 6e 64 64 69 72 28 64 69 72 70 29 20 73 65 65 6b 64 69 72 28 28 64 69 72 70 29 ┆e rewinddir(dirp) seekdir((dirp)┆
0x0f60…0f80 2c 20 28 6c 6f 6e 67 29 30 29 0a 20 20 20 20 20 65 78 74 65 72 6e 20 20 76 6f 69 64 20 63 6c 6f ┆, (long)0) extern void clo┆
0x0f80…0fa0 73 65 64 69 72 28 29 3b 0a 20 20 20 20 20 23 65 6e 64 69 66 0a 0a 20 20 20 20 20 23 69 66 64 65 ┆sedir(); #endif #ifde┆
0x0fa0…0fc0 66 20 4b 45 52 4e 45 4c 0a 20 20 20 20 20 2f 2a 0a 20 20 20 20 20 20 2a 20 54 65 6d 70 6c 61 74 ┆f KERNEL /* * Templat┆
0x0fc0…0fe0 65 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 64 69 72 65 63 74 6f 72 69 65 73 2e 0a ┆e for manipulating directories. ┆
0x0fe0…1000 20 20 20 20 20 20 2a 20 53 68 6f 75 6c 64 20 75 73 65 20 73 74 72 75 63 74 20 64 69 72 65 63 74 ┆ * Should use struct direct┆
0x1000…1020 27 73 2c 20 62 75 74 20 74 68 65 20 6e 61 6d 65 20 66 69 65 6c 64 0a 20 20 20 20 20 20 2a 20 69 ┆'s, but the name field * i┆
0x1020…1040 73 20 4d 41 58 4e 41 4d 4c 45 4e 20 2d 20 31 2c 20 61 6e 64 20 74 68 69 73 20 6a 75 73 74 20 77 ┆s MAXNAMLEN - 1, and this just w┆
0x1040…1060 6f 6e 27 74 20 64 6f 2e 0a 20 20 20 20 20 20 2a 2f 0a 20 20 20 20 20 73 74 72 75 63 74 20 64 69 ┆on't do. */ struct di┆
0x1060…1080 72 74 65 6d 70 6c 61 74 65 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 75 5f 6c 6f 6e 67 20 ┆rtemplate { u_long ┆
0x1080…10a0 20 64 6f 74 5f 69 6e 6f 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 72 74 20 20 20 64 ┆ dot_ino; short d┆
0x10a0…10c0 6f 74 5f 72 65 63 6c 65 6e 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 73 68 6f 72 74 20 20 20 ┆ot_reclen; short ┆
0x10c0…10e0 64 6f 74 5f 6e 61 6d 6c 65 6e 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 63 68 61 72 20 20 20 ┆dot_namlen; char ┆
0x10e0…1100 20 64 6f 74 5f 6e 61 6d 65 5b 34 5d 3b 20 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 6d 75 73 74 ┆ dot_name[4]; /* must┆
0x1100…1120 20 62 65 20 6d 75 6c 74 69 70 6c 65 20 6f 66 20 34 20 2a 2f 0a 20 20 20 20 20 20 20 20 20 20 20 ┆ be multiple of 4 */ ┆
0x1120…1140 20 20 75 5f 6c 6f 6e 67 20 20 64 6f 74 64 6f 74 5f 69 6e 6f 3b 0a 20 20 20 20 20 20 20 20 20 20 ┆ u_long dotdot_ino; ┆
0x1140…1160 20 20 20 73 68 6f 72 74 20 20 20 64 6f 74 64 6f 74 5f 72 65 63 6c 65 6e 3b 0a 20 20 20 20 20 20 ┆ short dotdot_reclen; ┆
0x1160…1180 20 20 20 20 20 20 20 73 68 6f 72 74 20 20 20 64 6f 74 64 6f 74 5f 6e 61 6d 6c 65 6e 3b 0a 20 20 ┆ short dotdot_namlen; ┆
0x1180…11a0 20 20 20 20 20 20 20 20 20 20 20 63 68 61 72 20 20 20 20 64 6f 74 64 6f 74 5f 6e 61 6d 65 5b 34 ┆ char dotdot_name[4┆
0x11a0…11c0 5d 3b 20 20 20 20 20 20 20 20 20 2f 2a 20 64 69 74 74 6f 20 2a 2f 0a 20 20 20 20 20 7d 3b 0a 0a ┆]; /* ditto */ }; ┆
0x11c0…11e0 20 20 20 20 20 23 64 65 66 69 6e 65 20 46 4f 55 4e 44 20 20 20 20 20 20 20 20 20 20 30 0a 20 20 ┆ #define FOUND 0 ┆
0x11e0…1200 20 20 20 23 64 65 66 69 6e 65 20 4e 4f 54 5f 46 4f 55 4e 44 20 20 20 20 20 2d 31 0a 20 20 20 20 ┆ #define NOT_FOUND -1 ┆
0x1200…1220 20 23 64 65 66 69 6e 65 20 45 4e 44 5f 4f 46 5f 53 54 52 49 4e 47 20 2d 32 0a 20 20 20 20 20 23 ┆ #define END_OF_STRING -2 #┆
0x1220…1240 64 65 66 69 6e 65 20 45 4e 44 5f 4f 46 5f 44 49 52 20 20 20 20 2d 33 0a 0a 20 20 20 20 20 73 74 ┆define END_OF_DIR -3 st┆
0x1240…1260 72 75 63 74 20 64 69 72 66 64 0a 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 20 75 5f 6c 6f 6e ┆ruct dirfd { u_lon┆
0x1260…1280 67 20 64 64 5f 6c 6f 63 3b 0a 20 20 20 20 20 20 20 20 20 75 5f 6c 6f 6e 67 20 64 64 5f 73 69 7a ┆g dd_loc; u_long dd_siz┆
0x1280…12a0 65 3b 0a 20 20 20 20 20 20 20 20 20 73 74 72 75 63 74 20 62 75 66 68 64 72 20 2a 64 64 5f 62 75 ┆e; struct bufhdr *dd_bu┆
0x12a0…12c0 66 3b 0a 20 20 20 20 20 20 20 20 20 73 74 72 75 63 74 20 69 6e 6f 64 65 20 2a 64 64 5f 69 70 3b ┆f; struct inode *dd_ip;┆
0x12c0…12e0 0a 20 20 20 20 20 20 20 20 20 75 5f 69 6e 74 20 64 64 5f 73 70 61 63 65 3b 0a 20 20 20 20 20 7d ┆ u_int dd_space; }┆
0x12e0…1300 3b 0a 0a 0a 0a 0a 0a 0a 0a 20 20 20 20 20 23 65 6e 64 69 66 0a 0a 20 20 20 20 20 23 65 6e 64 69 ┆; #endif #endi┆
0x1300…1320 66 20 5f 44 49 52 5f 0a 0a 20 20 20 20 20 42 79 20 63 6f 6e 76 65 6e 74 69 6f 6e 2c 20 74 68 65 ┆f _DIR_ By convention, the┆
0x1320…1340 20 66 69 72 73 74 20 74 77 6f 20 65 6e 74 72 69 65 73 20 69 6e 20 65 61 63 68 20 64 69 72 65 63 ┆ first two entries in each direc┆
0x1340…1360 74 6f 72 79 20 61 72 65 0a 20 20 20 20 20 66 6f 72 20 60 2e 27 20 61 6e 64 20 60 2e 2e 27 2e 20 ┆tory are for `.' and `..'. ┆
0x1360…1380 20 54 68 65 20 66 69 72 73 74 20 69 73 20 61 6e 20 65 6e 74 72 79 20 66 6f 72 20 74 68 65 20 64 ┆ The first is an entry for the d┆
0x1380…13a0 69 72 65 63 74 6f 72 79 0a 20 20 20 20 20 69 74 73 65 6c 66 2e 20 20 54 68 65 20 73 65 63 6f 6e ┆irectory itself. The secon┆
0x13a0…13c0 64 20 69 73 20 66 6f 72 20 74 68 65 20 70 61 72 65 6e 74 20 64 69 72 65 63 74 6f 72 79 2e 20 20 ┆d is for the parent directory. ┆
0x13c0…13e0 54 68 65 20 6d 65 61 6e 2d 0a 20 20 20 20 20 69 6e 67 20 6f 66 20 60 2e 2e 27 20 69 73 20 6d 6f ┆The mean- ing of `..' is mo┆
0x13e0…1400 64 69 66 69 65 64 20 66 6f 72 20 74 68 65 20 72 6f 6f 74 20 64 69 72 65 63 74 6f 72 79 20 6f 66 ┆dified for the root directory of┆
0x1400…1420 20 74 68 65 20 6d 61 73 74 65 72 0a 20 20 20 20 20 66 69 6c 65 20 73 79 73 74 65 6d 20 28 22 2f ┆ the master file system ("/┆
0x1420…1440 22 29 2c 20 77 68 65 72 65 20 60 2e 2e 27 20 68 61 73 20 74 68 65 20 73 61 6d 65 20 6d 65 61 6e ┆"), where `..' has the same mean┆
0x1440…1460 69 6e 67 20 61 73 20 60 2e 27 2e 0a 0a 53 08 53 08 53 08 53 45 08 45 08 45 08 45 45 08 45 08 45 ┆ing as `.'. S S S SE E E EE E E┆
0x1460…1480 08 45 20 41 08 41 08 41 08 41 4c 08 4c 08 4c 08 4c 53 08 53 08 53 08 53 4f 08 4f 08 4f 08 4f 0a ┆ E A A A AL L L LS S S SO O O O ┆
0x1480…14a0 20 20 20 20 20 4c 69 62 72 61 72 79 20 46 75 6e 63 74 69 6f 6e 73 20 28 33 29 3a 20 20 64 69 72 ┆ Library Functions (3): dir┆
0x14a0…14c0 65 63 74 6f 72 79 0a 20 20 20 20 20 46 69 6c 65 20 46 6f 72 6d 61 74 73 20 28 35 29 3a 20 20 66 ┆ectory File Formats (5): f┆
0x14c0…14e0 73 0a 0a 4d 61 72 63 68 20 31 39 38 39 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ┆s March 1989 ┆
0x14e0…1500 20 20 20 20 20 20 20 20 20 20 20 54 58 20 50 72 6f 67 72 61 6d 6d 65 72 27 73 20 52 65 66 65 72 ┆ TX Programmer's Refer┆
0x1500…1520 65 6e 63 65 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ┆ence ┆
0x1520…1532 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a 0a ┆ ┆