Annotation of researchv10no/cmd/asd/ndir.h, revision 1.1

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