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