1*38414Smckusick /* 2*38414Smckusick * Copyright (c) 1989 The Regents of the University of California. 3*38414Smckusick * All rights reserved. 4*38414Smckusick * 5*38414Smckusick * This code is derived from software contributed to Berkeley by 6*38414Smckusick * Rick Macklem at The University of Guelph. 7*38414Smckusick * 8*38414Smckusick * Redistribution and use in source and binary forms are permitted 9*38414Smckusick * provided that the above copyright notice and this paragraph are 10*38414Smckusick * duplicated in all such forms and that any documentation, 11*38414Smckusick * advertising materials, and other materials related to such 12*38414Smckusick * distribution and use acknowledge that the software was developed 13*38414Smckusick * by the University of California, Berkeley. The name of the 14*38414Smckusick * University may not be used to endorse or promote products derived 15*38414Smckusick * from this software without specific prior written permission. 16*38414Smckusick * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 17*38414Smckusick * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 18*38414Smckusick * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19*38414Smckusick * 20*38414Smckusick * @(#)nfsnode.h 7.1 (Berkeley) 07/05/89 21*38414Smckusick */ 22*38414Smckusick 23*38414Smckusick /* 24*38414Smckusick * The nfsnode is the nfs equivalent to ufs's inode. Any similarity 25*38414Smckusick * is purely coincidental. 26*38414Smckusick * There is a unique nfsnode allocated for each active file, 27*38414Smckusick * each current directory, each mounted-on file, text file, and the root. 28*38414Smckusick * An nfsnode is 'named' by its file handle. (nget/nfs_node.c) 29*38414Smckusick */ 30*38414Smckusick 31*38414Smckusick struct nfsnode { 32*38414Smckusick struct nfsnode *n_chain[2]; /* must be first */ 33*38414Smckusick nfsv2fh_t n_fh; /* NFS File Handle */ 34*38414Smckusick long n_flag; /* Flag for locking.. */ 35*38414Smckusick long n_id; /* unique identifier */ 36*38414Smckusick struct vnode n_vnode; /* vnode associated with this nfsnode */ 37*38414Smckusick long n_attrstamp; /* Time stamp (sec) for attributes */ 38*38414Smckusick struct vattr n_vattr; /* Vnode attribute cache */ 39*38414Smckusick struct sillyrename *n_sillyrename; /* Ptr to silly rename struct */ 40*38414Smckusick struct nfsnode *n_freef; /* free list forward */ 41*38414Smckusick struct nfsnode **n_freeb; /* free list back */ 42*38414Smckusick }; 43*38414Smckusick 44*38414Smckusick #define n_forw n_chain[0] 45*38414Smckusick #define n_back n_chain[1] 46*38414Smckusick 47*38414Smckusick #ifdef KERNEL 48*38414Smckusick struct nfsnode *nfsnode; /* the nfsnode table itself */ 49*38414Smckusick struct nfsnode *nfsnodeNNFSNODE; /* the end of the nfsnode table */ 50*38414Smckusick int nnfsnode; /* number of slots in the table */ 51*38414Smckusick long nextnfsnodeid; /* unique id generator */ 52*38414Smckusick 53*38414Smckusick extern struct vnodeops nfsv2_vnodeops; /* vnode operations for nfsv2 */ 54*38414Smckusick extern struct vnodeops nfsv2chr_vnodeops; /* vnode operations for chr devices */ 55*38414Smckusick 56*38414Smckusick /* 57*38414Smckusick * Convert between nfsnode pointers and vnode pointers 58*38414Smckusick */ 59*38414Smckusick #define VTONFS(vp) ((struct nfsnode *)(vp)->v_data) 60*38414Smckusick #define NFSTOV(np) ((struct vnode *)&(np)->n_vnode) 61*38414Smckusick #endif 62*38414Smckusick /* 63*38414Smckusick * Flags for n_flag 64*38414Smckusick */ 65*38414Smckusick #define NLOCKED 0x1 66*38414Smckusick #define NWANT 0x2 67