This commit was generated by cvs2svn to track changes on a CVS vendor
[unix-history] / sys / nfs / nfsnode.h
CommitLineData
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 36 * From: @(#)nfsnode.h 7.12 (Berkeley) 4/16/91
fde1aeb2 37 * $Id: nfsnode.h,v 1.5 1993/11/25 01:36:59 wollman Exp $
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
51struct 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 */
d5311b9f 60 struct lockf *n_lockf; /* Locking record of file */
15637ed4
RG
61 time_t n_mtime; /* Prev modify time to maintain data cache consistency*/
62 time_t n_ctime; /* Prev create time for name cache consistency*/
63 int n_error; /* Save write error value */
64 pid_t n_lockholder; /* holder of nfsnode lock */
65 pid_t n_lockwaiter; /* most recent waiter for nfsnode lock */
66 u_long n_direofoffset; /* Dir. EOF offset cache */
67};
68
69#define n_forw n_chain[0]
70#define n_back n_chain[1]
71
72#ifdef KERNEL
73/*
74 * Convert between nfsnode pointers and vnode pointers
75 */
76#define VTONFS(vp) ((struct nfsnode *)(vp)->v_data)
77#define NFSTOV(np) ((struct vnode *)(np)->n_vnode)
78#endif
79/*
80 * Flags for n_flag
81 */
82#define NLOCKED 0x1 /* Lock the node for other local accesses */
83#define NWANT 0x2 /* Want above lock */
84#define NMODIFIED 0x4 /* Might have a modified buffer in bio */
85#define NWRITEERR 0x8 /* Flag write errors so close will know */
86
87/*
88 * Prototypes for NFS vnode operations
89 */
bbc3f849 90#ifdef KERNEL
15637ed4
RG
91int nfs_lookup __P((
92 struct vnode *vp,
93 struct nameidata *ndp,
94 struct proc *p));
95int nfs_create __P((
96 struct nameidata *ndp,
97 struct vattr *vap,
98 struct proc *p));
99int nfs_mknod __P((
100 struct nameidata *ndp,
101 struct vattr *vap,
102 struct ucred *cred,
103 struct proc *p));
104int nfs_open __P((
105 struct vnode *vp,
106 int mode,
107 struct ucred *cred,
108 struct proc *p));
109int nfs_close __P((
110 struct vnode *vp,
111 int fflag,
112 struct ucred *cred,
113 struct proc *p));
114int nfs_access __P((
115 struct vnode *vp,
116 int mode,
117 struct ucred *cred,
118 struct proc *p));
119int nfs_getattr __P((
120 struct vnode *vp,
121 struct vattr *vap,
122 struct ucred *cred,
123 struct proc *p));
124int nfs_setattr __P((
125 struct vnode *vp,
126 struct vattr *vap,
127 struct ucred *cred,
128 struct proc *p));
129int nfs_read __P((
130 struct vnode *vp,
131 struct uio *uio,
132 int ioflag,
133 struct ucred *cred));
134int nfs_write __P((
135 struct vnode *vp,
136 struct uio *uio,
137 int ioflag,
138 struct ucred *cred));
139#define nfs_ioctl ((int (*) __P(( \
140 struct vnode *vp, \
141 int command, \
142 caddr_t data, \
143 int fflag, \
144 struct ucred *cred, \
145 struct proc *p))) enoioctl)
146#define nfs_select ((int (*) __P(( \
147 struct vnode *vp, \
148 int which, \
149 int fflags, \
150 struct ucred *cred, \
151 struct proc *p))) seltrue)
152int nfs_mmap __P((
153 struct vnode *vp,
154 int fflags,
155 struct ucred *cred,
156 struct proc *p));
157int nfs_fsync __P((
158 struct vnode *vp,
159 int fflags,
160 struct ucred *cred,
161 int waitfor,
162 struct proc *p));
163#define nfs_seek ((int (*) __P(( \
164 struct vnode *vp, \
165 off_t oldoff, \
166 off_t newoff, \
167 struct ucred *cred))) nullop)
168int nfs_remove __P((
169 struct nameidata *ndp,
170 struct proc *p));
171int nfs_link __P((
172 struct vnode *vp,
173 struct nameidata *ndp,
174 struct proc *p));
175int nfs_rename __P((
176 struct nameidata *fndp,
177 struct nameidata *tdnp,
178 struct proc *p));
179int nfs_mkdir __P((
180 struct nameidata *ndp,
181 struct vattr *vap,
182 struct proc *p));
183int nfs_rmdir __P((
184 struct nameidata *ndp,
185 struct proc *p));
186int nfs_symlink __P((
187 struct nameidata *ndp,
188 struct vattr *vap,
189 char *target,
190 struct proc *p));
191int nfs_readdir __P((
192 struct vnode *vp,
193 struct uio *uio,
194 struct ucred *cred,
195 int *eofflagp));
196int nfs_readlink __P((
197 struct vnode *vp,
198 struct uio *uio,
199 struct ucred *cred));
200int nfs_abortop __P((
201 struct nameidata *ndp));
202int nfs_inactive __P((
203 struct vnode *vp,
204 struct proc *p));
205int nfs_reclaim __P((
206 struct vnode *vp));
207int nfs_lock __P((
208 struct vnode *vp));
209int nfs_unlock __P((
210 struct vnode *vp));
211int nfs_bmap __P((
212 struct vnode *vp,
213 daddr_t bn,
214 struct vnode **vpp,
215 daddr_t *bnp));
216int nfs_strategy __P((
217 struct buf *bp));
4c45483e 218void nfs_print __P((
15637ed4
RG
219 struct vnode *vp));
220int nfs_islocked __P((
221 struct vnode *vp));
222int nfs_advlock __P((
223 struct vnode *vp,
224 caddr_t id,
225 int op,
226 struct flock *fl,
227 int flags));
a8599e88
RG
228
229void nfs_nput __P((struct vnode *));
fde1aeb2
GW
230
231extern int nfs_dogetattr(struct vnode *, struct vattr *, struct ucred *, int,
232 struct proc *);
233extern int nfsrv_fhtovp(fhandle_t *, int, struct vnode **, struct ucred *);
234struct mbuf;
235extern int nfs_loadattrcache(struct vnode **, struct mbuf **, caddr_t *,
236 struct vattr *);
237extern int nfs_getattrcache(struct vnode *, struct vattr *);
238extern int nfs_namei(struct nameidata *, fhandle_t *, int, struct mbuf **,
239 caddr_t *, struct proc *);
240
241extern int nfsrv_access(struct vnode *, int, struct ucred *, struct proc *);
242extern union nhead *nfs_hash(nfsv2fh_t *);
243extern int nfs_nget(struct mount *, nfsv2fh_t *, struct nfsnode **);
244
245struct nfsreq; struct nfsmount;
246extern int nfs_reply(struct nfsmount *, struct nfsreq *);
247extern void nfs_timer(caddr_t);
248extern void nfs_updatetimer(struct nfsmount *);
249extern void nfs_backofftimer(struct nfsmount *);
250extern int nfs_connect(struct nfsmount *);
251extern int nfs_reconnect(struct nfsreq *, struct nfsmount *);
252extern void nfs_disconnect(struct nfsmount *);
253extern int nfs_sigintr(struct proc *);
254extern void nfs_msg(struct proc *, const char *, const char *);
255extern void nfs_solock(int *);
256extern void nfs_sounlock(int *);
257
258/* From nfs_bio.c: */
259extern int nfs_bioread(struct vnode *, struct uio *, int, struct ucred *);
260extern int nfs_write(struct vnode *, struct uio *, int, struct ucred *);
261
bbc3f849 262#endif /* KERNEL */
a8599e88 263#endif /* __h_nfsnode */