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
Defined struct's
nameidata
defined in line
23; used 116 times
- in /usr/src/sys/sys/init_main.c line
348-349(4)
- in /usr/src/sys/sys/kern_exec.c line
63-64(4)
- in /usr/src/sys/sys/kern_sig.c line
621-622(4)
- in /usr/src/sys/sys/quota_kern.c line
702-703(4)
- in /usr/src/sys/sys/sys_kern.c line
103-104(4),
135-136(4)
- in /usr/src/sys/sys/ufs_mount.c line
38-39(4),
328-329(4)
- in /usr/src/sys/sys/ufs_namei.c line
113(2),
891(2),
1010(2),
1047(2)
- in /usr/src/sys/sys/ufs_syscalls.c line
79-80(4),
128-129(4),
202-203(4),
247-248(4),
303-304(4),
345-346(4),
392-393(4),
442-443(4),
465-466(4),
494-495(4),
544-545(4),
614-615(4),
717-718(4),
797-798(4),
1087(2),
1158-1159(4),
1270-1271(4)
- in /usr/src/sys/sys/ufs_syscalls2.c line
27-28(4),
268-269(4)
- in /usr/src/sys/sys/vfs_vnops.c line
66(2)
Defined macros
CREATE
defined in line
40; used 12 times
FOLLOW
defined in line
44; used 23 times
- in /usr/src/sys/sys/init_main.c line
352
- in /usr/src/sys/sys/kern_exec.c line
67,
177
- in /usr/src/sys/sys/kern_sig.c line
646
- in /usr/src/sys/sys/quota_kern.c line
709
- in /usr/src/sys/sys/sys_kern.c line
107,
141
- in /usr/src/sys/sys/ufs_mount.c line
47,
333
- in /usr/src/sys/sys/ufs_namei.c line
150,
770
- in /usr/src/sys/sys/ufs_syscalls.c line
82,
141,
250,
399,
421,
497,
547,
721
- in /usr/src/sys/sys/ufs_syscalls2.c line
31,
279
- in /usr/src/sys/sys/vfs_vnops.c line
75,
100
LOOKUP
defined in line
39; used 24 times
- in /usr/src/sys/sys/init_main.c line
352
- in /usr/src/sys/sys/kern_exec.c line
67,
177
- in /usr/src/sys/sys/quota_kern.c line
709
- in /usr/src/sys/sys/sys_kern.c line
141
- in /usr/src/sys/sys/ufs_mount.c line
47,
333
- in /usr/src/sys/sys/ufs_namei.c line
231,
381,
567
- in /usr/src/sys/sys/ufs_syscalls.c line
82,
141,
250,
399,
445,
469,
497,
547,
618,
721,
1239
- in /usr/src/sys/sys/ufs_syscalls2.c line
31,
279
- in /usr/src/sys/sys/vfs_vnops.c line
100
NDINIT
defined in line
47; used 28 times
- in /usr/src/sys/sys/init_main.c line
352
- in /usr/src/sys/sys/kern_exec.c line
67
- in /usr/src/sys/sys/kern_sig.c line
646
- in /usr/src/sys/sys/quota_kern.c line
709
- in /usr/src/sys/sys/sys_kern.c line
107,
141
- in /usr/src/sys/sys/ufs_mount.c line
47,
333
- in /usr/src/sys/sys/ufs_syscalls.c line
82,
141,
207,
250,
316,
348,
399,
445,
469,
497,
547,
618,
721,
801,
1002,
1164,
1239,
1273
- in /usr/src/sys/sys/ufs_syscalls2.c line
31,
279
Usage of this include