|
|
1.1 root 1: /*
2: * This sets the "page size" for directories.
3: * Requirements are DEV_BSIZE <= DIRBLKSIZ <= MINBSIZE with
4: * DIRBLKSIZ a power of two.
5: * Dennis Ritchie feels that directory pages should be atomic
6: * operations to the disk, so we use DEV_BSIZE.
7: */
8: #define DIRBLKSIZ 512
9:
10: /*
11: * This limits the directory name length. Its main constraint
12: * is that it appears twice in the user structure. (u. area)
13: */
14: #define MAXNAMLEN 255
15:
16: struct direct {
17: u_long d_ino;
18: short d_reclen;
19: short d_namlen;
20: char d_name[MAXNAMLEN + 1];
21: /* typically shorter */
22: };
23:
24: struct _dirdesc {
25: int dd_fd;
26: long dd_loc;
27: long dd_size;
28: char dd_buf[DIRBLKSIZ];
29: };
30:
31: #undef DIRSIZ
32: inline int DIRSIZ(direct* dp) {
33: return ~(sizeof(ino_t) - 1) &
34: (sizeof(struct direct)
35: - MAXNAMLEN
36: + dp->d_namlen
37: + sizeof(ino_t) - 1);
38: }
39: typedef struct _dirdesc DIR;
40:
41: /*
42: * functions defined on directories
43: */
44: extern DIR *opendir(char*);
45: extern direct *readdir(DIR*);
46: extern long telldir(DIR*);
47: extern void seekdir(DIR*,long);
48: inline void rewinddir(DIR* dirp) { seekdir(dirp, 0); }
49: extern void closedir(DIR*);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.