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