This commit was manufactured by cvs2svn to create tag 'FreeBSD-release/1.0'.
[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 *
78ed81a3 36 * From: @(#)nfsnode.h 7.12 (Berkeley) 4/16/91
37 * $Id: nfsnode.h,v 1.2 1993/09/09 22:06:24 rgrimes Exp $
15637ed4
RG
38 */
39
78ed81a3 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 */
78ed81a3 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 */
90int nfs_lookup __P((
91 struct vnode *vp,
92 struct nameidata *ndp,
93 struct proc *p));
94int nfs_create __P((
95 struct nameidata *ndp,
96 struct vattr *vap,
97 struct proc *p));
98int nfs_mknod __P((
99 struct nameidata *ndp,
100 struct vattr *vap,
101 struct ucred *cred,
102 struct proc *p));
103int nfs_open __P((
104 struct vnode *vp,
105 int mode,
106 struct ucred *cred,
107 struct proc *p));
108int nfs_close __P((
109 struct vnode *vp,
110 int fflag,
111 struct ucred *cred,
112 struct proc *p));
113int nfs_access __P((
114 struct vnode *vp,
115 int mode,
116 struct ucred *cred,
117 struct proc *p));
118int nfs_getattr __P((
119 struct vnode *vp,
120 struct vattr *vap,
121 struct ucred *cred,
122 struct proc *p));
123int nfs_setattr __P((
124 struct vnode *vp,
125 struct vattr *vap,
126 struct ucred *cred,
127 struct proc *p));
128int nfs_read __P((
129 struct vnode *vp,
130 struct uio *uio,
131 int ioflag,
132 struct ucred *cred));
133int nfs_write __P((
134 struct vnode *vp,
135 struct uio *uio,
136 int ioflag,
137 struct ucred *cred));
138#define nfs_ioctl ((int (*) __P(( \
139 struct vnode *vp, \
140 int command, \
141 caddr_t data, \
142 int fflag, \
143 struct ucred *cred, \
144 struct proc *p))) enoioctl)
145#define nfs_select ((int (*) __P(( \
146 struct vnode *vp, \
147 int which, \
148 int fflags, \
149 struct ucred *cred, \
150 struct proc *p))) seltrue)
151int nfs_mmap __P((
152 struct vnode *vp,
153 int fflags,
154 struct ucred *cred,
155 struct proc *p));
156int nfs_fsync __P((
157 struct vnode *vp,
158 int fflags,
159 struct ucred *cred,
160 int waitfor,
161 struct proc *p));
162#define nfs_seek ((int (*) __P(( \
163 struct vnode *vp, \
164 off_t oldoff, \
165 off_t newoff, \
166 struct ucred *cred))) nullop)
167int nfs_remove __P((
168 struct nameidata *ndp,
169 struct proc *p));
170int nfs_link __P((
171 struct vnode *vp,
172 struct nameidata *ndp,
173 struct proc *p));
174int nfs_rename __P((
175 struct nameidata *fndp,
176 struct nameidata *tdnp,
177 struct proc *p));
178int nfs_mkdir __P((
179 struct nameidata *ndp,
180 struct vattr *vap,
181 struct proc *p));
182int nfs_rmdir __P((
183 struct nameidata *ndp,
184 struct proc *p));
185int nfs_symlink __P((
186 struct nameidata *ndp,
187 struct vattr *vap,
188 char *target,
189 struct proc *p));
190int nfs_readdir __P((
191 struct vnode *vp,
192 struct uio *uio,
193 struct ucred *cred,
194 int *eofflagp));
195int nfs_readlink __P((
196 struct vnode *vp,
197 struct uio *uio,
198 struct ucred *cred));
199int nfs_abortop __P((
200 struct nameidata *ndp));
201int nfs_inactive __P((
202 struct vnode *vp,
203 struct proc *p));
204int nfs_reclaim __P((
205 struct vnode *vp));
206int nfs_lock __P((
207 struct vnode *vp));
208int nfs_unlock __P((
209 struct vnode *vp));
210int nfs_bmap __P((
211 struct vnode *vp,
212 daddr_t bn,
213 struct vnode **vpp,
214 daddr_t *bnp));
215int nfs_strategy __P((
216 struct buf *bp));
217int nfs_print __P((
218 struct vnode *vp));
219int nfs_islocked __P((
220 struct vnode *vp));
221int nfs_advlock __P((
222 struct vnode *vp,
223 caddr_t id,
224 int op,
225 struct flock *fl,
226 int flags));
78ed81a3 227
228void nfs_nput __P((struct vnode *));
229#endif /* __h_nfsnode */