1: /*
   2:  * Copyright (c) 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	1.3 (2.11BSD) 1997/1/18
   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  inode *ni_ip;       /* inode of dirp */
  30:     enum    uio_seg ni_segflg;  /* segment flag */
  31:     off_t   ni_offset;      /* offset in directory */
  32:     u_short ni_count;       /* offset of open slot (off_t?) */
  33:     struct  direct ni_dent;     /* current directory entry */
  34: };
  35: 
  36: /*
  37:  * namei operations and modifiers
  38:  */
  39: #define LOOKUP      0   /* perform name lookup only */
  40: #define CREATE      1   /* setup for file creation */
  41: #define DELETE      2   /* setup for file deletion */
  42: #define LOCKPARENT  0x10    /* see the top of namei */
  43: #define NOCACHE     0x20    /* name must not be left in cache */
  44: #define FOLLOW      0x40    /* follow symbolic links */
  45: #define NOFOLLOW    0x0 /* don't follow symbolic links (pseudo) */
  46: 
  47: #define NDINIT(ndp,op,flags,segflg,namep) {\
  48:     (ndp)->ni_nameiop = op | flags; \
  49:     (ndp)->ni_segflg = segflg; \
  50:     (ndp)->ni_dirp = namep; \
  51:     }
  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:     u_short 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: #if defined(KERNEL) && !defined(SUPERVISOR)
  72: struct  namecache *namecache;
  73: int nchsize;
  74: #include <machine/seg.h>
  75: segm    nmidesc;
  76: #endif
  77: 
  78: /*
  79:  * Stats on usefulness of namei caches.
  80:  */
  81: struct  nchstats {
  82:     long    ncs_goodhits;       /* hits that we can reall use */
  83:     long    ncs_badhits;        /* hits we must drop */
  84:     long    ncs_falsehits;      /* hits with id mismatch */
  85:     long    ncs_miss;       /* misses */
  86:     long    ncs_long;       /* long names that ignore cache */
  87:     long    ncs_pass2;      /* names found with passes == 2 */
  88:     long    ncs_2passes;        /* number of times we attempt it */
  89: };
  90: #endif

Defined variables

namecache defined in line 72; used 5 times
nchsize defined in line 73; used 6 times
nmidesc defined in line 75; used 18 times

Defined struct's

namecache defined in line 57; used 34 times
nchstats defined in line 81; used 6 times

Defined macros

DELETE defined in line 41; used 7 times
LOCKPARENT defined in line 42; used 7 times
NCHNAMLEN defined in line 68; used 2 times
NOCACHE defined in line 43; used 5 times
NOFOLLOW defined in line 45; used 6 times
_NAMEI_ defined in line 10; used 1 times
  • in line 9

Usage of this include

Last modified: 1997-01-19
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2925
Valid CSS Valid XHTML 1.0 Strict