nfsnode.h revision 1.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.1 mycroft * @(#)nfsnode.h 7.12 (Berkeley) 4/16/91
37 1.1 mycroft */
38 1.1 mycroft
39 1.1 mycroft #ifndef _NFS_NFSNODE_H_
40 1.1 mycroft #define _NFS_NFSNODE_H_
41 1.1 mycroft
42 1.1 mycroft /*
43 1.1 mycroft * The nfsnode is the nfs equivalent to ufs's inode. Any similarity
44 1.1 mycroft * is purely coincidental.
45 1.1 mycroft * There is a unique nfsnode allocated for each active file,
46 1.1 mycroft * each current directory, each mounted-on file, text file, and the root.
47 1.1 mycroft * An nfsnode is 'named' by its file handle. (nget/nfs_node.c)
48 1.1 mycroft */
49 1.1 mycroft
50 1.1 mycroft struct nfsnode {
51 1.1 mycroft struct nfsnode *n_chain[2]; /* must be first */
52 1.1 mycroft nfsv2fh_t n_fh; /* NFS File Handle */
53 1.1 mycroft long n_flag; /* Flag for locking.. */
54 1.1 mycroft struct vnode *n_vnode; /* vnode associated with this nfsnode */
55 1.1 mycroft time_t n_attrstamp; /* Time stamp (sec) for attributes */
56 1.1 mycroft struct vattr n_vattr; /* Vnode attribute cache */
57 1.1 mycroft struct sillyrename *n_sillyrename; /* Ptr to silly rename struct */
58 1.1 mycroft u_long n_size; /* Current size of file */
59 1.1 mycroft time_t n_mtime; /* Prev modify time to maintain data cache consistency*/
60 1.1 mycroft time_t n_ctime; /* Prev create time for name cache consistency*/
61 1.1 mycroft int n_error; /* Save write error value */
62 1.1 mycroft pid_t n_lockholder; /* holder of nfsnode lock */
63 1.1 mycroft pid_t n_lockwaiter; /* most recent waiter for nfsnode lock */
64 1.1 mycroft u_long n_direofoffset; /* Dir. EOF offset cache */
65 1.1 mycroft };
66 1.1 mycroft
67 1.1 mycroft #define n_forw n_chain[0]
68 1.1 mycroft #define n_back n_chain[1]
69 1.1 mycroft
70 1.1 mycroft #ifdef KERNEL
71 1.1 mycroft /*
72 1.1 mycroft * Convert between nfsnode pointers and vnode pointers
73 1.1 mycroft */
74 1.1 mycroft #define VTONFS(vp) ((struct nfsnode *)(vp)->v_data)
75 1.1 mycroft #define NFSTOV(np) ((struct vnode *)(np)->n_vnode)
76 1.1 mycroft #endif
77 1.1 mycroft /*
78 1.1 mycroft * Flags for n_flag
79 1.1 mycroft */
80 1.1 mycroft #define NLOCKED 0x1 /* Lock the node for other local accesses */
81 1.1 mycroft #define NWANT 0x2 /* Want above lock */
82 1.1 mycroft #define NMODIFIED 0x4 /* Might have a modified buffer in bio */
83 1.1 mycroft #define NWRITEERR 0x8 /* 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.1 mycroft int *eofflagp));
193 1.1 mycroft int nfs_readlink __P((
194 1.1 mycroft struct vnode *vp,
195 1.1 mycroft struct uio *uio,
196 1.1 mycroft struct ucred *cred));
197 1.1 mycroft int nfs_abortop __P((
198 1.1 mycroft struct nameidata *ndp));
199 1.1 mycroft int nfs_inactive __P((
200 1.1 mycroft struct vnode *vp,
201 1.1 mycroft struct proc *p));
202 1.1 mycroft int nfs_reclaim __P((
203 1.1 mycroft struct vnode *vp));
204 1.1 mycroft int nfs_lock __P((
205 1.1 mycroft struct vnode *vp));
206 1.1 mycroft int nfs_unlock __P((
207 1.1 mycroft struct vnode *vp));
208 1.1 mycroft int nfs_bmap __P((
209 1.1 mycroft struct vnode *vp,
210 1.1 mycroft daddr_t bn,
211 1.1 mycroft struct vnode **vpp,
212 1.1 mycroft daddr_t *bnp));
213 1.1 mycroft int nfs_strategy __P((
214 1.1 mycroft struct buf *bp));
215 1.1 mycroft int nfs_print __P((
216 1.1 mycroft struct vnode *vp));
217 1.1 mycroft int nfs_islocked __P((
218 1.1 mycroft struct vnode *vp));
219 1.1 mycroft int nfs_advlock __P((
220 1.1 mycroft struct vnode *vp,
221 1.1 mycroft caddr_t id,
222 1.1 mycroft int op,
223 1.1 mycroft struct flock *fl,
224 1.1 mycroft int flags));
225 1.1 mycroft
226 1.1 mycroft #endif /* !_NFS_NFSNODE_H_ */
227