Commit | Line | Data |
---|---|---|
15637ed4 RG |
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 | * | |
a8599e88 RG |
36 | * From: @(#)nfsnode.h 7.12 (Berkeley) 4/16/91 |
37 | * $Id$ | |
15637ed4 RG |
38 | */ |
39 | ||
a8599e88 RG |
40 | #ifndef __h_nfsnode |
41 | #define __h_nfsnode 1 | |
42 | ||
15637ed4 RG |
43 | /* |
44 | * The nfsnode is the nfs equivalent to ufs's inode. Any similarity | |
45 | * is purely coincidental. | |
46 | * There is a unique nfsnode allocated for each active file, | |
47 | * each current directory, each mounted-on file, text file, and the root. | |
48 | * An nfsnode is 'named' by its file handle. (nget/nfs_node.c) | |
49 | */ | |
50 | ||
51 | struct nfsnode { | |
52 | struct nfsnode *n_chain[2]; /* must be first */ | |
53 | nfsv2fh_t n_fh; /* NFS File Handle */ | |
54 | long n_flag; /* Flag for locking.. */ | |
55 | struct vnode *n_vnode; /* vnode associated with this nfsnode */ | |
56 | time_t n_attrstamp; /* Time stamp (sec) for attributes */ | |
57 | struct vattr n_vattr; /* Vnode attribute cache */ | |
58 | struct sillyrename *n_sillyrename; /* Ptr to silly rename struct */ | |
59 | u_long n_size; /* Current size of file */ | |
60 | time_t n_mtime; /* Prev modify time to maintain data cache consistency*/ | |
61 | time_t n_ctime; /* Prev create time for name cache consistency*/ | |
62 | int n_error; /* Save write error value */ | |
63 | pid_t n_lockholder; /* holder of nfsnode lock */ | |
64 | pid_t n_lockwaiter; /* most recent waiter for nfsnode lock */ | |
65 | u_long n_direofoffset; /* Dir. EOF offset cache */ | |
66 | }; | |
67 | ||
68 | #define n_forw n_chain[0] | |
69 | #define n_back n_chain[1] | |
70 | ||
71 | #ifdef KERNEL | |
72 | /* | |
73 | * Convert between nfsnode pointers and vnode pointers | |
74 | */ | |
75 | #define VTONFS(vp) ((struct nfsnode *)(vp)->v_data) | |
76 | #define NFSTOV(np) ((struct vnode *)(np)->n_vnode) | |
77 | #endif | |
78 | /* | |
79 | * Flags for n_flag | |
80 | */ | |
81 | #define NLOCKED 0x1 /* Lock the node for other local accesses */ | |
82 | #define NWANT 0x2 /* Want above lock */ | |
83 | #define NMODIFIED 0x4 /* Might have a modified buffer in bio */ | |
84 | #define NWRITEERR 0x8 /* Flag write errors so close will know */ | |
85 | ||
86 | /* | |
87 | * Prototypes for NFS vnode operations | |
88 | */ | |
89 | int nfs_lookup __P(( | |
90 | struct vnode *vp, | |
91 | struct nameidata *ndp, | |
92 | struct proc *p)); | |
93 | int nfs_create __P(( | |
94 | struct nameidata *ndp, | |
95 | struct vattr *vap, | |
96 | struct proc *p)); | |
97 | int nfs_mknod __P(( | |
98 | struct nameidata *ndp, | |
99 | struct vattr *vap, | |
100 | struct ucred *cred, | |
101 | struct proc *p)); | |
102 | int nfs_open __P(( | |
103 | struct vnode *vp, | |
104 | int mode, | |
105 | struct ucred *cred, | |
106 | struct proc *p)); | |
107 | int nfs_close __P(( | |
108 | struct vnode *vp, | |
109 | int fflag, | |
110 | struct ucred *cred, | |
111 | struct proc *p)); | |
112 | int nfs_access __P(( | |
113 | struct vnode *vp, | |
114 | int mode, | |
115 | struct ucred *cred, | |
116 | struct proc *p)); | |
117 | int nfs_getattr __P(( | |
118 | struct vnode *vp, | |
119 | struct vattr *vap, | |
120 | struct ucred *cred, | |
121 | struct proc *p)); | |
122 | int nfs_setattr __P(( | |
123 | struct vnode *vp, | |
124 | struct vattr *vap, | |
125 | struct ucred *cred, | |
126 | struct proc *p)); | |
127 | int nfs_read __P(( | |
128 | struct vnode *vp, | |
129 | struct uio *uio, | |
130 | int ioflag, | |
131 | struct ucred *cred)); | |
132 | int nfs_write __P(( | |
133 | struct vnode *vp, | |
134 | struct uio *uio, | |
135 | int ioflag, | |
136 | struct ucred *cred)); | |
137 | #define nfs_ioctl ((int (*) __P(( \ | |
138 | struct vnode *vp, \ | |
139 | int command, \ | |
140 | caddr_t data, \ | |
141 | int fflag, \ | |
142 | struct ucred *cred, \ | |
143 | struct proc *p))) enoioctl) | |
144 | #define nfs_select ((int (*) __P(( \ | |
145 | struct vnode *vp, \ | |
146 | int which, \ | |
147 | int fflags, \ | |
148 | struct ucred *cred, \ | |
149 | struct proc *p))) seltrue) | |
150 | int nfs_mmap __P(( | |
151 | struct vnode *vp, | |
152 | int fflags, | |
153 | struct ucred *cred, | |
154 | struct proc *p)); | |
155 | int nfs_fsync __P(( | |
156 | struct vnode *vp, | |
157 | int fflags, | |
158 | struct ucred *cred, | |
159 | int waitfor, | |
160 | struct proc *p)); | |
161 | #define nfs_seek ((int (*) __P(( \ | |
162 | struct vnode *vp, \ | |
163 | off_t oldoff, \ | |
164 | off_t newoff, \ | |
165 | struct ucred *cred))) nullop) | |
166 | int nfs_remove __P(( | |
167 | struct nameidata *ndp, | |
168 | struct proc *p)); | |
169 | int nfs_link __P(( | |
170 | struct vnode *vp, | |
171 | struct nameidata *ndp, | |
172 | struct proc *p)); | |
173 | int nfs_rename __P(( | |
174 | struct nameidata *fndp, | |
175 | struct nameidata *tdnp, | |
176 | struct proc *p)); | |
177 | int nfs_mkdir __P(( | |
178 | struct nameidata *ndp, | |
179 | struct vattr *vap, | |
180 | struct proc *p)); | |
181 | int nfs_rmdir __P(( | |
182 | struct nameidata *ndp, | |
183 | struct proc *p)); | |
184 | int nfs_symlink __P(( | |
185 | struct nameidata *ndp, | |
186 | struct vattr *vap, | |
187 | char *target, | |
188 | struct proc *p)); | |
189 | int nfs_readdir __P(( | |
190 | struct vnode *vp, | |
191 | struct uio *uio, | |
192 | struct ucred *cred, | |
193 | int *eofflagp)); | |
194 | int nfs_readlink __P(( | |
195 | struct vnode *vp, | |
196 | struct uio *uio, | |
197 | struct ucred *cred)); | |
198 | int nfs_abortop __P(( | |
199 | struct nameidata *ndp)); | |
200 | int nfs_inactive __P(( | |
201 | struct vnode *vp, | |
202 | struct proc *p)); | |
203 | int nfs_reclaim __P(( | |
204 | struct vnode *vp)); | |
205 | int nfs_lock __P(( | |
206 | struct vnode *vp)); | |
207 | int nfs_unlock __P(( | |
208 | struct vnode *vp)); | |
209 | int nfs_bmap __P(( | |
210 | struct vnode *vp, | |
211 | daddr_t bn, | |
212 | struct vnode **vpp, | |
213 | daddr_t *bnp)); | |
214 | int nfs_strategy __P(( | |
215 | struct buf *bp)); | |
216 | int nfs_print __P(( | |
217 | struct vnode *vp)); | |
218 | int nfs_islocked __P(( | |
219 | struct vnode *vp)); | |
220 | int nfs_advlock __P(( | |
221 | struct vnode *vp, | |
222 | caddr_t id, | |
223 | int op, | |
224 | struct flock *fl, | |
225 | int flags)); | |
a8599e88 RG |
226 | |
227 | void nfs_nput __P((struct vnode *)); | |
228 | #endif /* __h_nfsnode */ |