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