Annotation of 43BSD/sys/h/namei.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1982, 1986 Regents of the University of California.
                      3:  * All rights reserved.  The Berkeley software License Agreement
                      4:  * specifies the terms and conditions for redistribution.
                      5:  *
                      6:  *     @(#)namei.h     7.1 (Berkeley) 6/4/86
                      7:  */
                      8: 
                      9: #ifndef _NAMEI_
                     10: #define        _NAMEI_
                     11: 
                     12: #ifdef KERNEL
                     13: #include "uio.h"
                     14: #else
                     15: #include <sys/uio.h>
                     16: #endif
                     17: 
                     18: /*
                     19:  * Encapsulation of namei parameters.
                     20:  * One of these is located in the u. area to
                     21:  * minimize space allocated on the kernel stack.
                     22:  */
                     23: struct nameidata {
                     24:        caddr_t ni_dirp;                /* pathname pointer */
                     25:        short   ni_nameiop;             /* see below */
                     26:        short   ni_error;               /* error return if any */
                     27:        off_t   ni_endoff;              /* end of useful stuff in directory */
                     28:        struct  inode *ni_pdir;         /* inode of parent directory of dirp */
                     29:        struct  iovec ni_iovec;         /* MUST be pointed to by ni_iov */
                     30:        struct  uio ni_uio;             /* directory I/O parameters */
                     31:        struct  direct ni_dent;         /* current directory entry */
                     32: };
                     33: 
                     34: #define        ni_base         ni_iovec.iov_base
                     35: #define        ni_count        ni_iovec.iov_len
                     36: #define        ni_iov          ni_uio.uio_iov
                     37: #define        ni_iovcnt       ni_uio.uio_iovcnt
                     38: #define        ni_offset       ni_uio.uio_offset
                     39: #define        ni_segflg       ni_uio.uio_segflg
                     40: #define        ni_resid        ni_uio.uio_resid
                     41: 
                     42: /*
                     43:  * namei operations and modifiers
                     44:  */
                     45: #define        LOOKUP          0       /* perform name lookup only */
                     46: #define        CREATE          1       /* setup for file creation */
                     47: #define        DELETE          2       /* setup for file deletion */
                     48: #define        LOCKPARENT      0x10    /* see the top of namei */
                     49: #define NOCACHE                0x20    /* name must not be left in cache */
                     50: #define FOLLOW         0x40    /* follow symbolic links */
                     51: #define        NOFOLLOW        0x0     /* don't follow symbolic links (pseudo) */
                     52: 
                     53: /*
                     54:  * This structure describes the elements in the cache of recent
                     55:  * names looked up by namei.
                     56:  */
                     57: struct namecache {
                     58:        struct  namecache *nc_forw;     /* hash chain, MUST BE FIRST */
                     59:        struct  namecache *nc_back;     /* hash chain, MUST BE FIRST */
                     60:        struct  namecache *nc_nxt;      /* LRU chain */
                     61:        struct  namecache **nc_prev;    /* LRU chain */
                     62:        struct  inode *nc_ip;           /* inode the name refers to */
                     63:        ino_t   nc_ino;                 /* ino of parent of name */
                     64:        dev_t   nc_dev;                 /* dev of parent of name */
                     65:        dev_t   nc_idev;                /* dev of the name ref'd */
                     66:        long    nc_id;                  /* referenced inode's id */
                     67:        char    nc_nlen;                /* length of name */
                     68: #define        NCHNAMLEN       15      /* maximum name segment length we bother with */
                     69:        char    nc_name[NCHNAMLEN];     /* segment name */
                     70: };
                     71: #ifdef KERNEL
                     72: struct namecache *namecache;
                     73: int    nchsize;
                     74: #endif
                     75: 
                     76: /*
                     77:  * Stats on usefulness of namei caches.
                     78:  */
                     79: struct nchstats {
                     80:        long    ncs_goodhits;           /* hits that we can reall use */
                     81:        long    ncs_badhits;            /* hits we must drop */
                     82:        long    ncs_falsehits;          /* hits with id mismatch */
                     83:        long    ncs_miss;               /* misses */
                     84:        long    ncs_long;               /* long names that ignore cache */
                     85:        long    ncs_pass2;              /* names found with passes == 2 */
                     86:        long    ncs_2passes;            /* number of times we attempt it */
                     87: };
                     88: #endif

unix.superglobalmegacorp.com

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