nfsnode.h revision 1.5.2.1 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.5.2.1 pk * $Id: nfsnode.h,v 1.5.2.1 1993/12/16 23:44:23 pk 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.5.2.1 pk u_quad n_qsize; /* 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 pid_t n_lockholder; /* holder of nfsnode lock */
65 1.1 mycroft pid_t n_lockwaiter; /* most recent waiter for nfsnode lock */
66 1.5.2.1 pk u_quad n_qdireofoffset; /* Dir. EOF offset cache */
67 1.1 mycroft };
68 1.5.2.1 pk
69 1.5.2.1 pk #if 1
70 1.5.2.1 pk #if BYTE_ORDER == LITTLE_ENDIAN
71 1.5.2.1 pk #define n_size n_qsize.val[0]
72 1.5.2.1 pk #define n_direofoffset n_qdireofoffset.val[0]
73 1.5.2.1 pk #else /* BYTE_ORDER == BIG_ENDIAN */
74 1.5.2.1 pk #define n_size n_qsize.val[1]
75 1.5.2.1 pk #define n_direofoffset n_qdireofoffset.val[1]
76 1.5.2.1 pk #endif
77 1.5.2.1 pk #endif
78 1.1 mycroft
79 1.1 mycroft #define n_forw n_chain[0]
80 1.1 mycroft #define n_back n_chain[1]
81 1.1 mycroft
82 1.1 mycroft #ifdef KERNEL
83 1.1 mycroft /*
84 1.1 mycroft * Convert between nfsnode pointers and vnode pointers
85 1.1 mycroft */
86 1.1 mycroft #define VTONFS(vp) ((struct nfsnode *)(vp)->v_data)
87 1.1 mycroft #define NFSTOV(np) ((struct vnode *)(np)->n_vnode)
88 1.1 mycroft #endif
89 1.1 mycroft /*
90 1.1 mycroft * Flags for n_flag
91 1.1 mycroft */
92 1.1 mycroft #define NLOCKED 0x1 /* Lock the node for other local accesses */
93 1.1 mycroft #define NWANT 0x2 /* Want above lock */
94 1.1 mycroft #define NMODIFIED 0x4 /* Might have a modified buffer in bio */
95 1.1 mycroft #define NWRITEERR 0x8 /* Flag write errors so close will know */
96 1.1 mycroft
97 1.1 mycroft /*
98 1.1 mycroft * Prototypes for NFS vnode operations
99 1.1 mycroft */
100 1.1 mycroft int nfs_lookup __P((
101 1.1 mycroft struct vnode *vp,
102 1.1 mycroft struct nameidata *ndp,
103 1.1 mycroft struct proc *p));
104 1.1 mycroft int nfs_create __P((
105 1.1 mycroft struct nameidata *ndp,
106 1.1 mycroft struct vattr *vap,
107 1.1 mycroft struct proc *p));
108 1.1 mycroft int nfs_mknod __P((
109 1.1 mycroft struct nameidata *ndp,
110 1.1 mycroft struct vattr *vap,
111 1.1 mycroft struct ucred *cred,
112 1.1 mycroft struct proc *p));
113 1.1 mycroft int nfs_open __P((
114 1.1 mycroft struct vnode *vp,
115 1.1 mycroft int mode,
116 1.1 mycroft struct ucred *cred,
117 1.1 mycroft struct proc *p));
118 1.1 mycroft int nfs_close __P((
119 1.1 mycroft struct vnode *vp,
120 1.1 mycroft int fflag,
121 1.1 mycroft struct ucred *cred,
122 1.1 mycroft struct proc *p));
123 1.1 mycroft int nfs_access __P((
124 1.1 mycroft struct vnode *vp,
125 1.1 mycroft int mode,
126 1.1 mycroft struct ucred *cred,
127 1.1 mycroft struct proc *p));
128 1.1 mycroft int nfs_getattr __P((
129 1.1 mycroft struct vnode *vp,
130 1.1 mycroft struct vattr *vap,
131 1.1 mycroft struct ucred *cred,
132 1.1 mycroft struct proc *p));
133 1.1 mycroft int nfs_setattr __P((
134 1.1 mycroft struct vnode *vp,
135 1.1 mycroft struct vattr *vap,
136 1.1 mycroft struct ucred *cred,
137 1.1 mycroft struct proc *p));
138 1.1 mycroft int nfs_read __P((
139 1.1 mycroft struct vnode *vp,
140 1.1 mycroft struct uio *uio,
141 1.1 mycroft int ioflag,
142 1.1 mycroft struct ucred *cred));
143 1.1 mycroft int nfs_write __P((
144 1.1 mycroft struct vnode *vp,
145 1.1 mycroft struct uio *uio,
146 1.1 mycroft int ioflag,
147 1.1 mycroft struct ucred *cred));
148 1.1 mycroft #define nfs_ioctl ((int (*) __P(( \
149 1.1 mycroft struct vnode *vp, \
150 1.1 mycroft int command, \
151 1.1 mycroft caddr_t data, \
152 1.1 mycroft int fflag, \
153 1.1 mycroft struct ucred *cred, \
154 1.1 mycroft struct proc *p))) enoioctl)
155 1.1 mycroft #define nfs_select ((int (*) __P(( \
156 1.1 mycroft struct vnode *vp, \
157 1.1 mycroft int which, \
158 1.1 mycroft int fflags, \
159 1.1 mycroft struct ucred *cred, \
160 1.1 mycroft struct proc *p))) seltrue)
161 1.1 mycroft int nfs_mmap __P((
162 1.1 mycroft struct vnode *vp,
163 1.1 mycroft int fflags,
164 1.1 mycroft struct ucred *cred,
165 1.1 mycroft struct proc *p));
166 1.1 mycroft int nfs_fsync __P((
167 1.1 mycroft struct vnode *vp,
168 1.1 mycroft int fflags,
169 1.1 mycroft struct ucred *cred,
170 1.1 mycroft int waitfor,
171 1.1 mycroft struct proc *p));
172 1.1 mycroft #define nfs_seek ((int (*) __P(( \
173 1.1 mycroft struct vnode *vp, \
174 1.1 mycroft off_t oldoff, \
175 1.1 mycroft off_t newoff, \
176 1.1 mycroft struct ucred *cred))) nullop)
177 1.1 mycroft int nfs_remove __P((
178 1.1 mycroft struct nameidata *ndp,
179 1.1 mycroft struct proc *p));
180 1.1 mycroft int nfs_link __P((
181 1.1 mycroft struct vnode *vp,
182 1.1 mycroft struct nameidata *ndp,
183 1.1 mycroft struct proc *p));
184 1.1 mycroft int nfs_rename __P((
185 1.1 mycroft struct nameidata *fndp,
186 1.1 mycroft struct nameidata *tdnp,
187 1.1 mycroft struct proc *p));
188 1.1 mycroft int nfs_mkdir __P((
189 1.1 mycroft struct nameidata *ndp,
190 1.1 mycroft struct vattr *vap,
191 1.1 mycroft struct proc *p));
192 1.1 mycroft int nfs_rmdir __P((
193 1.1 mycroft struct nameidata *ndp,
194 1.1 mycroft struct proc *p));
195 1.1 mycroft int nfs_symlink __P((
196 1.1 mycroft struct nameidata *ndp,
197 1.1 mycroft struct vattr *vap,
198 1.1 mycroft char *target,
199 1.1 mycroft struct proc *p));
200 1.1 mycroft int nfs_readdir __P((
201 1.1 mycroft struct vnode *vp,
202 1.1 mycroft struct uio *uio,
203 1.1 mycroft struct ucred *cred,
204 1.5 ws int *eofflagp,
205 1.5 ws u_int *cookies,
206 1.5 ws int ncookies));
207 1.1 mycroft int nfs_readlink __P((
208 1.1 mycroft struct vnode *vp,
209 1.1 mycroft struct uio *uio,
210 1.1 mycroft struct ucred *cred));
211 1.1 mycroft int nfs_abortop __P((
212 1.1 mycroft struct nameidata *ndp));
213 1.1 mycroft int nfs_inactive __P((
214 1.1 mycroft struct vnode *vp,
215 1.1 mycroft struct proc *p));
216 1.1 mycroft int nfs_reclaim __P((
217 1.1 mycroft struct vnode *vp));
218 1.1 mycroft int nfs_lock __P((
219 1.1 mycroft struct vnode *vp));
220 1.1 mycroft int nfs_unlock __P((
221 1.1 mycroft struct vnode *vp));
222 1.1 mycroft int nfs_bmap __P((
223 1.1 mycroft struct vnode *vp,
224 1.1 mycroft daddr_t bn,
225 1.1 mycroft struct vnode **vpp,
226 1.1 mycroft daddr_t *bnp));
227 1.1 mycroft int nfs_strategy __P((
228 1.1 mycroft struct buf *bp));
229 1.4 mycroft void nfs_print __P((
230 1.1 mycroft struct vnode *vp));
231 1.1 mycroft int nfs_islocked __P((
232 1.1 mycroft struct vnode *vp));
233 1.1 mycroft int nfs_advlock __P((
234 1.1 mycroft struct vnode *vp,
235 1.1 mycroft caddr_t id,
236 1.1 mycroft int op,
237 1.1 mycroft struct flock *fl,
238 1.1 mycroft int flags));
239 1.1 mycroft
240 1.1 mycroft #endif /* !_NFS_NFSNODE_H_ */
241