date and time created 92/07/13 00:43:47 by torek
[unix-history] / usr / src / sys / nfs / nfsnode.h
CommitLineData
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 *
dbf0c423 8 * %sccs.include.redist.c%
a2907882 9 *
9ac9f1c8 10 * @(#)nfsnode.h 7.26 (Berkeley) %G%
a2907882
KM
11 */
12
2c5b44a2
KM
13/*
14 * Silly rename structure that hangs off the nfsnode until the name
15 * can be removed by nfs_inactive()
16 */
17struct sillyrename {
18 struct ucred *s_cred;
19 struct vnode *s_dvp;
20 long s_namlen;
21 char s_name[20];
22};
23
a2907882
KM
24/*
25 * The nfsnode is the nfs equivalent to ufs's inode. Any similarity
26 * is purely coincidental.
27 * There is a unique nfsnode allocated for each active file,
28 * each current directory, each mounted-on file, text file, and the root.
29 * An nfsnode is 'named' by its file handle. (nget/nfs_node.c)
30 */
31
32struct nfsnode {
33 struct nfsnode *n_chain[2]; /* must be first */
34 nfsv2fh_t n_fh; /* NFS File Handle */
35 long n_flag; /* Flag for locking.. */
2c5b44a2 36 struct vnode *n_vnode; /* vnode associated with this node */
2c5b44a2 37 struct vattr n_vattr; /* Vnode attribute cache */
163680b9 38 time_t n_attrstamp; /* Time stamp for cached attributes */
2c5b44a2 39 struct sillyrename *n_sillyrename; /* Ptr to silly rename struct */
3dddedcb 40 off_t n_size; /* Current size of file */
2c5b44a2
KM
41 int n_error; /* Save write error value */
42 u_long n_direofoffset; /* Dir. EOF offset cache */
43 union {
44 struct {
45 time_t un_mtime; /* Prev modify time. */
46 time_t un_ctime; /* Prev create time. */
47 } un_nfs;
48 struct {
49 u_quad_t un_brev; /* Modify rev when cached */
50 u_quad_t un_lrev; /* Modify rev for lease */
51 time_t un_expiry; /* Lease expiry time */
52 struct nfsnode *un_tnext; /* Nqnfs timer chain */
53 struct nfsnode *un_tprev;
16818680 54 long un_spare; /* pad to 8-byte boundary */
2c5b44a2
KM
55 } un_nqnfs;
56 } n_un;
57 struct sillyrename n_silly; /* Silly rename struct */
9b61ab4a
KM
58 struct timeval n_atim; /* Special file times */
59 struct timeval n_mtim;
16818680 60 long n_spare[4]; /* Up to a power of 2 */
a2907882
KM
61};
62
2c5b44a2
KM
63#define n_mtime n_un.un_nfs.un_mtime
64#define n_ctime n_un.un_nfs.un_ctime
65#define n_brev n_un.un_nqnfs.un_brev
66#define n_lrev n_un.un_nqnfs.un_lrev
67#define n_expiry n_un.un_nqnfs.un_expiry
68#define n_tnext n_un.un_nqnfs.un_tnext
69#define n_tprev n_un.un_nqnfs.un_tprev
70
a2907882
KM
71#define n_forw n_chain[0]
72#define n_back n_chain[1]
73
74#ifdef KERNEL
a2907882
KM
75/*
76 * Convert between nfsnode pointers and vnode pointers
77 */
78#define VTONFS(vp) ((struct nfsnode *)(vp)->v_data)
3c5a3f37 79#define NFSTOV(np) ((struct vnode *)(np)->n_vnode)
a2907882
KM
80#endif
81/*
82 * Flags for n_flag
83 */
2c5b44a2
KM
84#define NMODIFIED 0x0004 /* Might have a modified buffer in bio */
85#define NWRITEERR 0x0008 /* Flag write errors so close will know */
86#define NQNFSNONCACHE 0x0020 /* Non-cachable lease */
87#define NQNFSWRITE 0x0040 /* Write lease */
88#define NQNFSEVICTED 0x0080 /* Has been evicted */
9b61ab4a
KM
89#define NACC 0x0100 /* Special file accessed */
90#define NUPD 0x0200 /* Special file updated */
91#define NCHG 0x0400 /* Special file times changed */
4476f4b6
KM
92
93/*
94 * Prototypes for NFS vnode operations
95 */
9342689a
JH
96int nfs_lookup __P((struct vop_lookup_args *));
97int nfs_create __P((struct vop_create_args *));
98int nfs_mknod __P((struct vop_mknod_args *));
99int nfs_open __P((struct vop_open_args *));
100int nfs_close __P((struct vop_close_args *));
9b61ab4a
KM
101int nfsspec_close __P((struct vop_close_args *));
102#ifdef FIFO
103int nfsfifo_close __P((struct vop_close_args *));
104#endif
9342689a
JH
105int nfs_access __P((struct vop_access_args *));
106int nfs_getattr __P((struct vop_getattr_args *));
107int nfs_setattr __P((struct vop_setattr_args *));
108int nfs_read __P((struct vop_read_args *));
109int nfs_write __P((struct vop_write_args *));
9b61ab4a
KM
110int nfsspec_read __P((struct vop_read_args *));
111int nfsspec_write __P((struct vop_write_args *));
112#ifdef FIFO
113int nfsfifo_read __P((struct vop_read_args *));
114int nfsfifo_write __P((struct vop_write_args *));
115#endif
9342689a
JH
116#define nfs_ioctl ((int (*) __P((struct vop_ioctl_args *)))enoioctl)
117#define nfs_select ((int (*) __P((struct vop_select_args *)))seltrue)
118int nfs_mmap __P((struct vop_mmap_args *));
119int nfs_fsync __P((struct vop_fsync_args *));
120#define nfs_seek ((int (*) __P((struct vop_seek_args *)))nullop)
121int nfs_remove __P((struct vop_remove_args *));
122int nfs_link __P((struct vop_link_args *));
123int nfs_rename __P((struct vop_rename_args *));
124int nfs_mkdir __P((struct vop_mkdir_args *));
125int nfs_rmdir __P((struct vop_rmdir_args *));
126int nfs_symlink __P((struct vop_symlink_args *));
127int nfs_readdir __P((struct vop_readdir_args *));
128int nfs_readlink __P((struct vop_readlink_args *));
129int nfs_abortop __P((struct vop_abortop_args *));
130int nfs_inactive __P((struct vop_inactive_args *));
131int nfs_reclaim __P((struct vop_reclaim_args *));
132int nfs_lock __P((struct vop_lock_args *));
133int nfs_unlock __P((struct vop_unlock_args *));
134int nfs_bmap __P((struct vop_bmap_args *));
135int nfs_strategy __P((struct vop_strategy_args *));
136int nfs_print __P((struct vop_print_args *));
137int nfs_islocked __P((struct vop_islocked_args *));
138int nfs_advlock __P((struct vop_advlock_args *));
139int nfs_blkatoff __P((struct vop_blkatoff_args *));
9ac9f1c8 140int nfs_vget __P((struct mount *, ino_t, struct vnode **));
9342689a 141int nfs_valloc __P((struct vop_valloc_args *));
d98ec5bf 142int nfs_vfree __P((struct vop_vfree_args *));
9342689a
JH
143int nfs_truncate __P((struct vop_truncate_args *));
144int nfs_update __P((struct vop_update_args *));
9cde1597 145int bwrite(); /* NFS needs a bwrite routine */