nfsnode.h (83366) | nfsnode.h (83651) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. 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 --- 20 unchanged lines hidden (view full) --- 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 * 36 * @(#)nfsnode.h 8.9 (Berkeley) 5/14/95 | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. 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 --- 20 unchanged lines hidden (view full) --- 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 * 36 * @(#)nfsnode.h 8.9 (Berkeley) 5/14/95 |
37 * $FreeBSD: head/sys/nfsclient/nfsnode.h 83366 2001-09-12 08:38:13Z julian $ | 37 * $FreeBSD: head/sys/nfsclient/nfsnode.h 83651 2001-09-18 23:32:09Z peter $ |
38 */ 39 | 38 */ 39 |
40#ifndef _NFSCLIENT_NFSNODE_H_ 41#define _NFSCLIENT_NFSNODE_H_ |
|
40 | 42 |
41#ifndef _NFS_NFSNODE_H_ 42#define _NFS_NFSNODE_H_ 43 44#if !defined(_NFS_NFS_H_) && !defined(_KERNEL) | 43#if !defined(_NFSCLIENT_NFS_H_) && !defined(_KERNEL) |
45#include <nfs/nfs.h> 46#endif 47 48/* 49 * Silly rename structure that hangs off the nfsnode until the name 50 * can be removed by nfs_inactive() 51 */ 52struct sillyrename { --- 29 unchanged lines hidden (view full) --- 82 * type definitions), file handles of > 32 bytes should probably be split out 83 * into a separate MALLOC()'d data structure. (Reduce the size of nfsfh_t by 84 * changing the definition in nfsproto.h of NFS_SMALLFH.) 85 * NB: Hopefully the current order of the fields is such that everything will 86 * be well aligned and, therefore, tightly packed. 87 */ 88struct nfsnode { 89 LIST_ENTRY(nfsnode) n_hash; /* Hash chain */ | 44#include <nfs/nfs.h> 45#endif 46 47/* 48 * Silly rename structure that hangs off the nfsnode until the name 49 * can be removed by nfs_inactive() 50 */ 51struct sillyrename { --- 29 unchanged lines hidden (view full) --- 81 * type definitions), file handles of > 32 bytes should probably be split out 82 * into a separate MALLOC()'d data structure. (Reduce the size of nfsfh_t by 83 * changing the definition in nfsproto.h of NFS_SMALLFH.) 84 * NB: Hopefully the current order of the fields is such that everything will 85 * be well aligned and, therefore, tightly packed. 86 */ 87struct nfsnode { 88 LIST_ENTRY(nfsnode) n_hash; /* Hash chain */ |
90 TAILQ_ENTRY(nfsnode) n_timer; /* Nqnfs timer chain */ | |
91 u_quad_t n_size; /* Current size of file */ 92 u_quad_t n_brev; /* Modify rev when cached */ 93 u_quad_t n_lrev; /* Modify rev for lease */ 94 struct vattr n_vattr; /* Vnode attribute cache */ 95 time_t n_attrstamp; /* Attr. cache timestamp */ 96 u_int32_t n_mode; /* ACCESS mode cache */ 97 uid_t n_modeuid; /* credentials having mode */ 98 time_t n_modestamp; /* mode cache timestamp */ --- 31 unchanged lines hidden (view full) --- 130 131/* 132 * Flags for n_flag 133 */ 134#define NFLUSHWANT 0x0001 /* Want wakeup from a flush in prog. */ 135#define NFLUSHINPROG 0x0002 /* Avoid multiple calls to vinvalbuf() */ 136#define NMODIFIED 0x0004 /* Might have a modified buffer in bio */ 137#define NWRITEERR 0x0008 /* Flag write errors so close will know */ | 89 u_quad_t n_size; /* Current size of file */ 90 u_quad_t n_brev; /* Modify rev when cached */ 91 u_quad_t n_lrev; /* Modify rev for lease */ 92 struct vattr n_vattr; /* Vnode attribute cache */ 93 time_t n_attrstamp; /* Attr. cache timestamp */ 94 u_int32_t n_mode; /* ACCESS mode cache */ 95 uid_t n_modeuid; /* credentials having mode */ 96 time_t n_modestamp; /* mode cache timestamp */ --- 31 unchanged lines hidden (view full) --- 128 129/* 130 * Flags for n_flag 131 */ 132#define NFLUSHWANT 0x0001 /* Want wakeup from a flush in prog. */ 133#define NFLUSHINPROG 0x0002 /* Avoid multiple calls to vinvalbuf() */ 134#define NMODIFIED 0x0004 /* Might have a modified buffer in bio */ 135#define NWRITEERR 0x0008 /* Flag write errors so close will know */ |
138#define NQNFSNONCACHE 0x0020 /* Non-cachable lease */ 139#define NQNFSWRITE 0x0040 /* Write lease */ 140#define NQNFSEVICTED 0x0080 /* Has been evicted */ | 136/* 0x20, 0x40, 0x80 free */ |
141#define NACC 0x0100 /* Special file accessed */ 142#define NUPD 0x0200 /* Special file updated */ 143#define NCHG 0x0400 /* Special file times changed */ 144#define NLOCKED 0x0800 /* node is locked */ 145#define NWANTED 0x0100 /* someone wants to lock */ 146 147/* 148 * Convert between nfsnode pointers and vnode pointers --- 15 unchanged lines hidden (view full) --- 164 * 165 * Attempt to obtain a lock on the passed nfsnode, returning ENOLCK 166 * if the lock could not be obtained due to our having to sleep. This 167 * function is generally used to lock around code that modifies an 168 * NFS file's size. In order to avoid deadlocks the lock 169 * should not be obtained while other locks are being held. 170 */ 171 | 137#define NACC 0x0100 /* Special file accessed */ 138#define NUPD 0x0200 /* Special file updated */ 139#define NCHG 0x0400 /* Special file times changed */ 140#define NLOCKED 0x0800 /* node is locked */ 141#define NWANTED 0x0100 /* someone wants to lock */ 142 143/* 144 * Convert between nfsnode pointers and vnode pointers --- 15 unchanged lines hidden (view full) --- 160 * 161 * Attempt to obtain a lock on the passed nfsnode, returning ENOLCK 162 * if the lock could not be obtained due to our having to sleep. This 163 * function is generally used to lock around code that modifies an 164 * NFS file's size. In order to avoid deadlocks the lock 165 * should not be obtained while other locks are being held. 166 */ 167 |
172static __inline 173int | 168static __inline int |
174nfs_rslock(struct nfsnode *np, struct thread *td) 175{ | 169nfs_rslock(struct nfsnode *np, struct thread *td) 170{ |
176 return(lockmgr(&np->n_rslock, LK_EXCLUSIVE | LK_CANRECURSE | LK_SLEEPFAIL, NULL, td)); | 171 172 return(lockmgr(&np->n_rslock, 173 LK_EXCLUSIVE | LK_CANRECURSE | LK_SLEEPFAIL, NULL, td)); |
177} 178 | 174} 175 |
179static __inline 180void | 176static __inline void |
181nfs_rsunlock(struct nfsnode *np, struct thread *td) 182{ | 177nfs_rsunlock(struct nfsnode *np, struct thread *td) 178{ |
179 |
|
183 (void)lockmgr(&np->n_rslock, LK_RELEASE, NULL, td); 184} 185 186extern vop_t **fifo_nfsv2nodeop_p; 187extern vop_t **nfsv2_vnodeop_p; 188extern vop_t **spec_nfsv2nodeop_p; 189 190/* 191 * Prototypes for NFS vnode operations 192 */ | 180 (void)lockmgr(&np->n_rslock, LK_RELEASE, NULL, td); 181} 182 183extern vop_t **fifo_nfsv2nodeop_p; 184extern vop_t **nfsv2_vnodeop_p; 185extern vop_t **spec_nfsv2nodeop_p; 186 187/* 188 * Prototypes for NFS vnode operations 189 */ |
193int nfs_getpages __P((struct vop_getpages_args *)); 194int nfs_putpages __P((struct vop_putpages_args *)); 195int nfs_write __P((struct vop_write_args *)); 196int nqnfs_vop_lease_check __P((struct vop_lease_args *)); 197int nfs_inactive __P((struct vop_inactive_args *)); 198int nfs_reclaim __P((struct vop_reclaim_args *)); | 190int nfs_getpages(struct vop_getpages_args *); 191int nfs_putpages(struct vop_putpages_args *); 192int nfs_write(struct vop_write_args *); 193int nfs_inactive(struct vop_inactive_args *); 194int nfs_reclaim(struct vop_reclaim_args *); |
199 200/* other stuff */ | 195 196/* other stuff */ |
201int nfs_removeit __P((struct sillyrename *)); 202int nfs_nget __P((struct mount *,nfsfh_t *,int,struct nfsnode **)); 203nfsuint64 *nfs_getcookie __P((struct nfsnode *, off_t, int)); 204void nfs_invaldir __P((struct vnode *)); | 197int nfs_removeit(struct sillyrename *); 198int nfs_nget(struct mount *, nfsfh_t *, int, struct nfsnode **); 199nfsuint64 *nfs_getcookie(struct nfsnode *, off_t, int); 200void nfs_invaldir(struct vnode *); |
205 | 201 |
206#define nqnfs_lease_updatetime nfs_lease_updatetime 207 | |
208#endif /* _KERNEL */ 209 210#endif | 202#endif /* _KERNEL */ 203 204#endif |