Annotation of researchv10no/dk/cmd/pupu/ndir.h, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.