home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilss / sockets / include / sys / h / namei < prev    next >
Encoding:
Text File  |  1995-01-11  |  3.2 KB  |  109 lines

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