138414Smckusick /* 238414Smckusick * Copyright (c) 1989 The Regents of the University of California. 338414Smckusick * All rights reserved. 438414Smckusick * 538414Smckusick * This code is derived from software contributed to Berkeley by 638414Smckusick * Rick Macklem at The University of Guelph. 738414Smckusick * 838414Smckusick * Redistribution and use in source and binary forms are permitted 938414Smckusick * provided that the above copyright notice and this paragraph are 1038414Smckusick * duplicated in all such forms and that any documentation, 1138414Smckusick * advertising materials, and other materials related to such 1238414Smckusick * distribution and use acknowledge that the software was developed 1338414Smckusick * by the University of California, Berkeley. The name of the 1438414Smckusick * University may not be used to endorse or promote products derived 1538414Smckusick * from this software without specific prior written permission. 1638414Smckusick * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 1738414Smckusick * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 1838414Smckusick * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1938414Smckusick * 20*39348Smckusick * @(#)nfsnode.h 7.3 (Berkeley) 10/19/89 2138414Smckusick */ 2238414Smckusick 2338414Smckusick /* 2438414Smckusick * The nfsnode is the nfs equivalent to ufs's inode. Any similarity 2538414Smckusick * is purely coincidental. 2638414Smckusick * There is a unique nfsnode allocated for each active file, 2738414Smckusick * each current directory, each mounted-on file, text file, and the root. 2838414Smckusick * An nfsnode is 'named' by its file handle. (nget/nfs_node.c) 2938414Smckusick */ 3038414Smckusick 3138414Smckusick struct nfsnode { 3238414Smckusick struct nfsnode *n_chain[2]; /* must be first */ 3338414Smckusick nfsv2fh_t n_fh; /* NFS File Handle */ 3438414Smckusick long n_flag; /* Flag for locking.. */ 3538414Smckusick long n_id; /* unique identifier */ 3638414Smckusick struct vnode n_vnode; /* vnode associated with this nfsnode */ 3738414Smckusick long n_attrstamp; /* Time stamp (sec) for attributes */ 3838414Smckusick struct vattr n_vattr; /* Vnode attribute cache */ 3938414Smckusick struct sillyrename *n_sillyrename; /* Ptr to silly rename struct */ 4038414Smckusick struct nfsnode *n_freef; /* free list forward */ 4138414Smckusick struct nfsnode **n_freeb; /* free list back */ 4238884Smacklem daddr_t n_lastr; /* Last block read for read ahead */ 4338884Smacklem u_long n_size; /* Current size of file */ 4438884Smacklem time_t n_mtime; /* Prev modify time to maintain data cache consistency*/ 45*39348Smckusick int n_error; /* Save write error value */ 4638414Smckusick }; 4738414Smckusick 4838414Smckusick #define n_forw n_chain[0] 4938414Smckusick #define n_back n_chain[1] 5038414Smckusick 5138414Smckusick #ifdef KERNEL 5238414Smckusick struct nfsnode *nfsnode; /* the nfsnode table itself */ 5338414Smckusick struct nfsnode *nfsnodeNNFSNODE; /* the end of the nfsnode table */ 5438414Smckusick int nnfsnode; /* number of slots in the table */ 5538414Smckusick long nextnfsnodeid; /* unique id generator */ 5638414Smckusick 5738414Smckusick extern struct vnodeops nfsv2_vnodeops; /* vnode operations for nfsv2 */ 5838414Smckusick extern struct vnodeops nfsv2chr_vnodeops; /* vnode operations for chr devices */ 5938414Smckusick 6038414Smckusick /* 6138414Smckusick * Convert between nfsnode pointers and vnode pointers 6238414Smckusick */ 6338414Smckusick #define VTONFS(vp) ((struct nfsnode *)(vp)->v_data) 6438414Smckusick #define NFSTOV(np) ((struct vnode *)&(np)->n_vnode) 6538414Smckusick #endif 6638414Smckusick /* 6738414Smckusick * Flags for n_flag 6838414Smckusick */ 69*39348Smckusick #define NLOCKED 0x1 /* Lock the node for other local accesses */ 70*39348Smckusick #define NWANT 0x2 /* Want above lock */ 71*39348Smckusick #define NMODIFIED 0x4 /* Might have a modified buffer in bio */ 72*39348Smckusick #define NBUFFERED 0x8 /* Might have a buffer in bio */ 73*39348Smckusick #define NPAGEDON 0x10 /* Might have associated memory pages */ 74*39348Smckusick #define NWRITEERR 0x20 /* Flag write errors so close will know */ 75