Commit | Line | Data |
---|---|---|
a2907882 KM |
1 | /* |
2 | * Copyright (c) 1989 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * This code is derived from software contributed to Berkeley by | |
6 | * Rick Macklem at The University of Guelph. | |
7 | * | |
dbf0c423 | 8 | * %sccs.include.redist.c% |
a2907882 | 9 | * |
4476f4b6 | 10 | * @(#)nfsnode.h 7.12 (Berkeley) %G% |
a2907882 KM |
11 | */ |
12 | ||
13 | /* | |
14 | * The nfsnode is the nfs equivalent to ufs's inode. Any similarity | |
15 | * is purely coincidental. | |
16 | * There is a unique nfsnode allocated for each active file, | |
17 | * each current directory, each mounted-on file, text file, and the root. | |
18 | * An nfsnode is 'named' by its file handle. (nget/nfs_node.c) | |
19 | */ | |
20 | ||
21 | struct nfsnode { | |
22 | struct nfsnode *n_chain[2]; /* must be first */ | |
23 | nfsv2fh_t n_fh; /* NFS File Handle */ | |
24 | long n_flag; /* Flag for locking.. */ | |
3c5a3f37 | 25 | struct vnode *n_vnode; /* vnode associated with this nfsnode */ |
e49b1a6c | 26 | time_t n_attrstamp; /* Time stamp (sec) for attributes */ |
a2907882 KM |
27 | struct vattr n_vattr; /* Vnode attribute cache */ |
28 | struct sillyrename *n_sillyrename; /* Ptr to silly rename struct */ | |
9238aa59 RM |
29 | u_long n_size; /* Current size of file */ |
30 | time_t n_mtime; /* Prev modify time to maintain data cache consistency*/ | |
c7dd831e | 31 | time_t n_ctime; /* Prev create time for name cache consistency*/ |
ffe6f482 | 32 | int n_error; /* Save write error value */ |
4dae2a39 KM |
33 | pid_t n_lockholder; /* holder of nfsnode lock */ |
34 | pid_t n_lockwaiter; /* most recent waiter for nfsnode lock */ | |
e49b1a6c | 35 | u_long n_direofoffset; /* Dir. EOF offset cache */ |
a2907882 KM |
36 | }; |
37 | ||
38 | #define n_forw n_chain[0] | |
39 | #define n_back n_chain[1] | |
40 | ||
41 | #ifdef KERNEL | |
a2907882 KM |
42 | /* |
43 | * Convert between nfsnode pointers and vnode pointers | |
44 | */ | |
45 | #define VTONFS(vp) ((struct nfsnode *)(vp)->v_data) | |
3c5a3f37 | 46 | #define NFSTOV(np) ((struct vnode *)(np)->n_vnode) |
a2907882 KM |
47 | #endif |
48 | /* | |
49 | * Flags for n_flag | |
50 | */ | |
ffe6f482 KM |
51 | #define NLOCKED 0x1 /* Lock the node for other local accesses */ |
52 | #define NWANT 0x2 /* Want above lock */ | |
53 | #define NMODIFIED 0x4 /* Might have a modified buffer in bio */ | |
f0f1cbaa | 54 | #define NWRITEERR 0x8 /* Flag write errors so close will know */ |
4476f4b6 KM |
55 | |
56 | /* | |
57 | * Prototypes for NFS vnode operations | |
58 | */ | |
59 | int nfs_lookup __P(( | |
60 | struct vnode *vp, | |
61 | struct nameidata *ndp, | |
62 | struct proc *p)); | |
63 | int nfs_create __P(( | |
64 | struct nameidata *ndp, | |
65 | struct vattr *vap, | |
66 | struct proc *p)); | |
67 | int nfs_mknod __P(( | |
68 | struct nameidata *ndp, | |
69 | struct vattr *vap, | |
70 | struct ucred *cred, | |
71 | struct proc *p)); | |
72 | int nfs_open __P(( | |
73 | struct vnode *vp, | |
74 | int mode, | |
75 | struct ucred *cred, | |
76 | struct proc *p)); | |
77 | int nfs_close __P(( | |
78 | struct vnode *vp, | |
79 | int fflag, | |
80 | struct ucred *cred, | |
81 | struct proc *p)); | |
82 | int nfs_access __P(( | |
83 | struct vnode *vp, | |
84 | int mode, | |
85 | struct ucred *cred, | |
86 | struct proc *p)); | |
87 | int nfs_getattr __P(( | |
88 | struct vnode *vp, | |
89 | struct vattr *vap, | |
90 | struct ucred *cred, | |
91 | struct proc *p)); | |
92 | int nfs_setattr __P(( | |
93 | struct vnode *vp, | |
94 | struct vattr *vap, | |
95 | struct ucred *cred, | |
96 | struct proc *p)); | |
97 | int nfs_read __P(( | |
98 | struct vnode *vp, | |
99 | struct uio *uio, | |
100 | int ioflag, | |
101 | struct ucred *cred)); | |
102 | int nfs_write __P(( | |
103 | struct vnode *vp, | |
104 | struct uio *uio, | |
105 | int ioflag, | |
106 | struct ucred *cred)); | |
107 | #define nfs_ioctl ((int (*) __P(( \ | |
108 | struct vnode *vp, \ | |
109 | int command, \ | |
110 | caddr_t data, \ | |
111 | int fflag, \ | |
112 | struct ucred *cred, \ | |
113 | struct proc *p))) enoioctl) | |
114 | #define nfs_select ((int (*) __P(( \ | |
115 | struct vnode *vp, \ | |
116 | int which, \ | |
117 | int fflags, \ | |
118 | struct ucred *cred, \ | |
119 | struct proc *p))) seltrue) | |
120 | int nfs_mmap __P(( | |
121 | struct vnode *vp, | |
122 | int fflags, | |
123 | struct ucred *cred, | |
124 | struct proc *p)); | |
125 | int nfs_fsync __P(( | |
126 | struct vnode *vp, | |
127 | int fflags, | |
128 | struct ucred *cred, | |
129 | int waitfor, | |
130 | struct proc *p)); | |
131 | #define nfs_seek ((int (*) __P(( \ | |
132 | struct vnode *vp, \ | |
133 | off_t oldoff, \ | |
134 | off_t newoff, \ | |
135 | struct ucred *cred))) nullop) | |
136 | int nfs_remove __P(( | |
137 | struct nameidata *ndp, | |
138 | struct proc *p)); | |
139 | int nfs_link __P(( | |
140 | struct vnode *vp, | |
141 | struct nameidata *ndp, | |
142 | struct proc *p)); | |
143 | int nfs_rename __P(( | |
144 | struct nameidata *fndp, | |
145 | struct nameidata *tdnp, | |
146 | struct proc *p)); | |
147 | int nfs_mkdir __P(( | |
148 | struct nameidata *ndp, | |
149 | struct vattr *vap, | |
150 | struct proc *p)); | |
151 | int nfs_rmdir __P(( | |
152 | struct nameidata *ndp, | |
153 | struct proc *p)); | |
154 | int nfs_symlink __P(( | |
155 | struct nameidata *ndp, | |
156 | struct vattr *vap, | |
157 | char *target, | |
158 | struct proc *p)); | |
159 | int nfs_readdir __P(( | |
160 | struct vnode *vp, | |
161 | struct uio *uio, | |
162 | struct ucred *cred, | |
163 | int *eofflagp)); | |
164 | int nfs_readlink __P(( | |
165 | struct vnode *vp, | |
166 | struct uio *uio, | |
167 | struct ucred *cred)); | |
168 | int nfs_abortop __P(( | |
169 | struct nameidata *ndp)); | |
170 | int nfs_inactive __P(( | |
171 | struct vnode *vp, | |
172 | struct proc *p)); | |
173 | int nfs_reclaim __P(( | |
174 | struct vnode *vp)); | |
175 | int nfs_lock __P(( | |
176 | struct vnode *vp)); | |
177 | int nfs_unlock __P(( | |
178 | struct vnode *vp)); | |
179 | int nfs_bmap __P(( | |
180 | struct vnode *vp, | |
181 | daddr_t bn, | |
182 | struct vnode **vpp, | |
183 | daddr_t *bnp)); | |
184 | int nfs_strategy __P(( | |
185 | struct buf *bp)); | |
186 | int nfs_print __P(( | |
187 | struct vnode *vp)); | |
188 | int nfs_islocked __P(( | |
189 | struct vnode *vp)); | |
190 | int nfs_advlock __P(( | |
191 | struct vnode *vp, | |
192 | caddr_t id, | |
193 | int op, | |
194 | struct flock *fl, | |
195 | int flags)); |