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