Commit | Line | Data |
---|---|---|
b688fc87 WJ |
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 | * | |
8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | |
16 | * 3. All advertising materials mentioning features or use of this software | |
17 | * must display the following acknowledgement: | |
18 | * This product includes software developed by the University of | |
19 | * California, Berkeley and its contributors. | |
20 | * 4. Neither the name of the University nor the names of its contributors | |
21 | * may be used to endorse or promote products derived from this software | |
22 | * without specific prior written permission. | |
23 | * | |
24 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
34 | * SUCH DAMAGE. | |
35 | * | |
36 | * @(#)nfsnode.h 7.12 (Berkeley) 4/16/91 | |
37 | */ | |
38 | ||
39 | /* | |
40 | * The nfsnode is the nfs equivalent to ufs's inode. Any similarity | |
41 | * is purely coincidental. | |
42 | * There is a unique nfsnode allocated for each active file, | |
43 | * each current directory, each mounted-on file, text file, and the root. | |
44 | * An nfsnode is 'named' by its file handle. (nget/nfs_node.c) | |
45 | */ | |
46 | ||
47 | struct nfsnode { | |
48 | struct nfsnode *n_chain[2]; /* must be first */ | |
49 | nfsv2fh_t n_fh; /* NFS File Handle */ | |
50 | long n_flag; /* Flag for locking.. */ | |
51 | struct vnode *n_vnode; /* vnode associated with this nfsnode */ | |
52 | time_t n_attrstamp; /* Time stamp (sec) for attributes */ | |
53 | struct vattr n_vattr; /* Vnode attribute cache */ | |
54 | struct sillyrename *n_sillyrename; /* Ptr to silly rename struct */ | |
55 | u_long n_size; /* Current size of file */ | |
56 | time_t n_mtime; /* Prev modify time to maintain data cache consistency*/ | |
57 | time_t n_ctime; /* Prev create time for name cache consistency*/ | |
58 | int n_error; /* Save write error value */ | |
59 | pid_t n_lockholder; /* holder of nfsnode lock */ | |
60 | pid_t n_lockwaiter; /* most recent waiter for nfsnode lock */ | |
61 | u_long n_direofoffset; /* Dir. EOF offset cache */ | |
62 | }; | |
63 | ||
64 | #define n_forw n_chain[0] | |
65 | #define n_back n_chain[1] | |
66 | ||
67 | #ifdef KERNEL | |
68 | /* | |
69 | * Convert between nfsnode pointers and vnode pointers | |
70 | */ | |
71 | #define VTONFS(vp) ((struct nfsnode *)(vp)->v_data) | |
72 | #define NFSTOV(np) ((struct vnode *)(np)->n_vnode) | |
73 | #endif | |
74 | /* | |
75 | * Flags for n_flag | |
76 | */ | |
77 | #define NLOCKED 0x1 /* Lock the node for other local accesses */ | |
78 | #define NWANT 0x2 /* Want above lock */ | |
79 | #define NMODIFIED 0x4 /* Might have a modified buffer in bio */ | |
80 | #define NWRITEERR 0x8 /* Flag write errors so close will know */ | |
81 | ||
82 | /* | |
83 | * Prototypes for NFS vnode operations | |
84 | */ | |
85 | int nfs_lookup __P(( | |
86 | struct vnode *vp, | |
87 | struct nameidata *ndp, | |
88 | struct proc *p)); | |
89 | int nfs_create __P(( | |
90 | struct nameidata *ndp, | |
91 | struct vattr *vap, | |
92 | struct proc *p)); | |
93 | int nfs_mknod __P(( | |
94 | struct nameidata *ndp, | |
95 | struct vattr *vap, | |
96 | struct ucred *cred, | |
97 | struct proc *p)); | |
98 | int nfs_open __P(( | |
99 | struct vnode *vp, | |
100 | int mode, | |
101 | struct ucred *cred, | |
102 | struct proc *p)); | |
103 | int nfs_close __P(( | |
104 | struct vnode *vp, | |
105 | int fflag, | |
106 | struct ucred *cred, | |
107 | struct proc *p)); | |
108 | int nfs_access __P(( | |
109 | struct vnode *vp, | |
110 | int mode, | |
111 | struct ucred *cred, | |
112 | struct proc *p)); | |
113 | int nfs_getattr __P(( | |
114 | struct vnode *vp, | |
115 | struct vattr *vap, | |
116 | struct ucred *cred, | |
117 | struct proc *p)); | |
118 | int nfs_setattr __P(( | |
119 | struct vnode *vp, | |
120 | struct vattr *vap, | |
121 | struct ucred *cred, | |
122 | struct proc *p)); | |
123 | int nfs_read __P(( | |
124 | struct vnode *vp, | |
125 | struct uio *uio, | |
126 | int ioflag, | |
127 | struct ucred *cred)); | |
128 | int nfs_write __P(( | |
129 | struct vnode *vp, | |
130 | struct uio *uio, | |
131 | int ioflag, | |
132 | struct ucred *cred)); | |
133 | #define nfs_ioctl ((int (*) __P(( \ | |
134 | struct vnode *vp, \ | |
135 | int command, \ | |
136 | caddr_t data, \ | |
137 | int fflag, \ | |
138 | struct ucred *cred, \ | |
139 | struct proc *p))) enoioctl) | |
140 | #define nfs_select ((int (*) __P(( \ | |
141 | struct vnode *vp, \ | |
142 | int which, \ | |
143 | int fflags, \ | |
144 | struct ucred *cred, \ | |
145 | struct proc *p))) seltrue) | |
146 | int nfs_mmap __P(( | |
147 | struct vnode *vp, | |
148 | int fflags, | |
149 | struct ucred *cred, | |
150 | struct proc *p)); | |
151 | int nfs_fsync __P(( | |
152 | struct vnode *vp, | |
153 | int fflags, | |
154 | struct ucred *cred, | |
155 | int waitfor, | |
156 | struct proc *p)); | |
157 | #define nfs_seek ((int (*) __P(( \ | |
158 | struct vnode *vp, \ | |
159 | off_t oldoff, \ | |
160 | off_t newoff, \ | |
161 | struct ucred *cred))) nullop) | |
162 | int nfs_remove __P(( | |
163 | struct nameidata *ndp, | |
164 | struct proc *p)); | |
165 | int nfs_link __P(( | |
166 | struct vnode *vp, | |
167 | struct nameidata *ndp, | |
168 | struct proc *p)); | |
169 | int nfs_rename __P(( | |
170 | struct nameidata *fndp, | |
171 | struct nameidata *tdnp, | |
172 | struct proc *p)); | |
173 | int nfs_mkdir __P(( | |
174 | struct nameidata *ndp, | |
175 | struct vattr *vap, | |
176 | struct proc *p)); | |
177 | int nfs_rmdir __P(( | |
178 | struct nameidata *ndp, | |
179 | struct proc *p)); | |
180 | int nfs_symlink __P(( | |
181 | struct nameidata *ndp, | |
182 | struct vattr *vap, | |
183 | char *target, | |
184 | struct proc *p)); | |
185 | int nfs_readdir __P(( | |
186 | struct vnode *vp, | |
187 | struct uio *uio, | |
188 | struct ucred *cred, | |
189 | int *eofflagp)); | |
190 | int nfs_readlink __P(( | |
191 | struct vnode *vp, | |
192 | struct uio *uio, | |
193 | struct ucred *cred)); | |
194 | int nfs_abortop __P(( | |
195 | struct nameidata *ndp)); | |
196 | int nfs_inactive __P(( | |
197 | struct vnode *vp, | |
198 | struct proc *p)); | |
199 | int nfs_reclaim __P(( | |
200 | struct vnode *vp)); | |
201 | int nfs_lock __P(( | |
202 | struct vnode *vp)); | |
203 | int nfs_unlock __P(( | |
204 | struct vnode *vp)); | |
205 | int nfs_bmap __P(( | |
206 | struct vnode *vp, | |
207 | daddr_t bn, | |
208 | struct vnode **vpp, | |
209 | daddr_t *bnp)); | |
210 | int nfs_strategy __P(( | |
211 | struct buf *bp)); | |
212 | int nfs_print __P(( | |
213 | struct vnode *vp)); | |
214 | int nfs_islocked __P(( | |
215 | struct vnode *vp)); | |
216 | int nfs_advlock __P(( | |
217 | struct vnode *vp, | |
218 | caddr_t id, | |
219 | int op, | |
220 | struct flock *fl, | |
221 | int flags)); |