|
|
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.2 (Berkeley) 1/5/88 ! 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: #ifdef KERNEL ! 43: /* ! 44: * namei operations and modifiers ! 45: */ ! 46: #define LOOKUP 0 /* perform name lookup only */ ! 47: #define CREATE 1 /* setup for file creation */ ! 48: #define DELETE 2 /* setup for file deletion */ ! 49: #define LOCKPARENT 0x10 /* see the top of namei */ ! 50: #define NOCACHE 0x20 /* name must not be left in cache */ ! 51: #define FOLLOW 0x40 /* follow symbolic links */ ! 52: #define NOFOLLOW 0x0 /* don't follow symbolic links (pseudo) */ ! 53: #endif ! 54: ! 55: /* ! 56: * This structure describes the elements in the cache of recent ! 57: * names looked up by namei. ! 58: */ ! 59: struct namecache { ! 60: struct namecache *nc_forw; /* hash chain, MUST BE FIRST */ ! 61: struct namecache *nc_back; /* hash chain, MUST BE FIRST */ ! 62: struct namecache *nc_nxt; /* LRU chain */ ! 63: struct namecache **nc_prev; /* LRU chain */ ! 64: struct inode *nc_ip; /* inode the name refers to */ ! 65: ino_t nc_ino; /* ino of parent of name */ ! 66: dev_t nc_dev; /* dev of parent of name */ ! 67: dev_t nc_idev; /* dev of the name ref'd */ ! 68: long nc_id; /* referenced inode's id */ ! 69: char nc_nlen; /* length of name */ ! 70: #define NCHNAMLEN 15 /* maximum name segment length we bother with */ ! 71: char nc_name[NCHNAMLEN]; /* segment name */ ! 72: }; ! 73: #ifdef KERNEL ! 74: struct namecache *namecache; ! 75: int nchsize; ! 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
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.