summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient/nfsnode.h
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1995-06-27 11:07:30 +0000
committerdfr <dfr@FreeBSD.org>1995-06-27 11:07:30 +0000
commit666343f7f055c064375d48bb9a608730d7145beb (patch)
tree372bad41f8c547f40d0826ed596c53dc772ab986 /sys/nfsclient/nfsnode.h
parent6da3ef32238f37b3b45cf709205fcff60bcbda7f (diff)
downloadFreeBSD-src-666343f7f055c064375d48bb9a608730d7145beb.zip
FreeBSD-src-666343f7f055c064375d48bb9a608730d7145beb.tar.gz
Changes to support version 3 of the NFS protocol.
The version 2 support has been tested (client+server) against FreeBSD-2.0, IRIX 5.3 and FreeBSD-current (using a loopback mount). The version 2 support is stable AFAIK. The version 3 support has been tested with a loopback mount and minimally against an IRIX 5.3 server. It needs more testing and may have problems. I have patched amd to support the new variable length filehandles although it will still only use version 2 of the protocol. Before booting a kernel with these changes, nfs clients will need to at least build and install /usr/sbin/mount_nfs. Servers will need to build and install /usr/sbin/mountd. NFS diskless support is untested. Obtained from: Rick Macklem <rick@snowhite.cis.uoguelph.ca>
Diffstat (limited to 'sys/nfsclient/nfsnode.h')
-rw-r--r--sys/nfsclient/nfsnode.h116
1 files changed, 90 insertions, 26 deletions
diff --git a/sys/nfsclient/nfsnode.h b/sys/nfsclient/nfsnode.h
index dc9162b..18dbde2 100644
--- a/sys/nfsclient/nfsnode.h
+++ b/sys/nfsclient/nfsnode.h
@@ -34,12 +34,16 @@
* SUCH DAMAGE.
*
* @(#)nfsnode.h 8.4 (Berkeley) 2/13/94
- * $Id: nfsnode.h,v 1.8 1994/10/17 17:47:44 phk Exp $
+ * $Id: nfsnode.h,v 1.9 1995/03/16 18:15:42 bde Exp $
*/
#ifndef _NFS_NFSNODE_H_
#define _NFS_NFSNODE_H_
+#ifndef _NFS_NFS_H_
+#include <nfs/nfs.h>
+#endif
+
/*
* Silly rename structure that hangs off the nfsnode until the name
* can be removed by nfs_inactive()
@@ -52,36 +56,73 @@ struct sillyrename {
};
/*
+ * This structure is used to save the logical directory offset to
+ * NFS cookie mappings.
+ * The mappings are stored in a list headed
+ * by n_cookies, as required.
+ * There is one mapping for each NFS_DIRBLKSIZ bytes of directory information
+ * stored in increasing logical offset byte order.
+ */
+#define NFSNUMCOOKIES 31
+
+struct nfsdmap {
+ LIST_ENTRY(nfsdmap) ndm_list;
+ int ndm_eocookie;
+ nfsuint64 ndm_cookies[NFSNUMCOOKIES];
+};
+
+/*
* The nfsnode is the nfs equivalent to ufs's inode. Any similarity
* is purely coincidental.
* There is a unique nfsnode allocated for each active file,
* each current directory, each mounted-on file, text file, and the root.
* An nfsnode is 'named' by its file handle. (nget/nfs_node.c)
+ * If this structure exceeds 256 bytes (it is currently 256 using 4.4BSD-Lite
+ * type definitions), file handles of > 32 bytes should probably be split out
+ * into a separate MALLOC()'d data structure. (Reduce the size of nfsfh_t by
+ * changing the definition in sys/mount.h of NFS_SMALLFH.)
+ * NB: Hopefully the current order of the fields is such that everything will
+ * be well aligned and, therefore, tightly packed.
*/
-
struct nfsnode {
- LIST_ENTRY(nfsnode) n_hash; /* Hash chain */
- CIRCLEQ_ENTRY(nfsnode) n_timer; /* Nqnfs timer chain */
- nfsv2fh_t n_fh; /* NFS File Handle */
- long n_flag; /* Flag for locking.. */
- struct vnode *n_vnode; /* vnode associated with this node */
- struct vattr n_vattr; /* Vnode attribute cache */
- time_t n_attrstamp; /* Time stamp for cached attributes */
- struct sillyrename *n_sillyrename; /* Ptr to silly rename struct */
- u_quad_t n_size; /* Current size of file */
- struct lockf *n_lockf; /* Locking record of file */
- int n_error; /* Save write error value */
- u_long n_direofoffset; /* Dir. EOF offset cache */
- time_t n_mtime; /* Prev modify time. */
- time_t n_ctime; /* Prev create time. */
- u_quad_t n_brev; /* Modify rev when cached */
- u_quad_t n_lrev; /* Modify rev for lease */
- time_t n_expiry; /* Lease expiry time */
- struct sillyrename n_silly; /* Silly rename struct */
- struct timeval n_atim; /* Special file times */
- struct timeval n_mtim;
+ LIST_ENTRY(nfsnode) n_hash; /* Hash chain */
+ CIRCLEQ_ENTRY(nfsnode) n_timer; /* Nqnfs timer chain */
+ u_quad_t n_size; /* Current size of file */
+ u_quad_t n_brev; /* Modify rev when cached */
+ u_quad_t n_lrev; /* Modify rev for lease */
+ struct vattr n_vattr; /* Vnode attribute cache */
+ time_t n_attrstamp; /* Attr. cache timestamp */
+ time_t n_mtime; /* Prev modify time. */
+ time_t n_ctime; /* Prev create time. */
+ time_t n_expiry; /* Lease expiry time */
+ nfsfh_t *n_fhp; /* NFS File Handle */
+ struct vnode *n_vnode; /* associated vnode */
+ struct lockf *n_lockf; /* Locking record of file */
+ int n_error; /* Save write error value */
+ union {
+ struct timespec nf_atim; /* Special file times */
+ nfsuint64 nd_cookieverf; /* Cookie verifier (dir only) */
+ } n_un1;
+ union {
+ struct timespec nf_mtim;
+ off_t nd_direof; /* Dir. EOF offset cache */
+ } n_un2;
+ union {
+ struct sillyrename *nf_silly; /* Ptr to silly rename struct */
+ LIST_HEAD(, nfsdmap) nd_cook; /* cookies */
+ } n_un3;
+ short n_fhsize; /* size in bytes, of fh */
+ short n_flag; /* Flag for locking.. */
+ nfsfh_t n_fh; /* Small File Handle */
};
+#define n_atim n_un1.nf_atim
+#define n_mtim n_un2.nf_mtim
+#define n_sillyrename n_un3.nf_silly
+#define n_cookieverf n_un1.nd_cookieverf
+#define n_direofoffset n_un2.nd_direof
+#define n_cookies n_un3.nd_cook
+
/*
* Flags for n_flag
*/
@@ -95,6 +136,8 @@ struct nfsnode {
#define NACC 0x0100 /* Special file accessed */
#define NUPD 0x0200 /* Special file updated */
#define NCHG 0x0400 /* Special file times changed */
+#define NLOCKED 0x0800 /* node is locked */
+#define NWANTED 0x0100 /* someone wants to lock */
/*
* Convert between nfsnode pointers and vnode pointers
@@ -107,7 +150,7 @@ struct nfsnode {
*/
TAILQ_HEAD(, buf) nfs_bufq;
-#ifdef KERNEL
+#if defined(KERNEL) || defined(_KERNEL)
extern int (**fifo_nfsv2nodeop_p)();
extern int (**nfsv2_vnodeop_p)();
extern int (**spec_nfsv2nodeop_p)();
@@ -128,12 +171,25 @@ int nfs_getattr __P((struct vop_getattr_args *));
int nfs_setattr __P((struct vop_setattr_args *));
int nfs_read __P((struct vop_read_args *));
int nfs_write __P((struct vop_write_args *));
+#ifdef HAS_VOPLEASE
+#define nfs_lease_check ((int (*) __P((struct vop_lease_args *)))nullop)
+#define nqnfs_vop_lease_check lease_check
+#else
+#ifdef __FreeBSD__
+#define nqnfs_lease_check nfs_lease_check
+#else
+#define nqnfs_lease_check lease_check
+#endif
+#endif
int nfsspec_read __P((struct vop_read_args *));
int nfsspec_write __P((struct vop_write_args *));
int nfsfifo_read __P((struct vop_read_args *));
int nfsfifo_write __P((struct vop_write_args *));
#define nfs_ioctl ((int (*) __P((struct vop_ioctl_args *)))enoioctl)
#define nfs_select ((int (*) __P((struct vop_select_args *)))seltrue)
+#ifdef HAS_VOPREVOKE
+#define nfs_revoke vop_revoke
+#endif
int nfs_mmap __P((struct vop_mmap_args *));
int nfs_fsync __P((struct vop_fsync_args *));
#define nfs_seek ((int (*) __P((struct vop_seek_args *)))nullop)
@@ -157,6 +213,7 @@ int nfs_islocked __P((struct vop_islocked_args *));
int nfs_pathconf __P((struct vop_pathconf_args *));
int nfs_advlock __P((struct vop_advlock_args *));
int nfs_blkatoff __P((struct vop_blkatoff_args *));
+int nfs_bwrite __P((struct vop_bwrite_args *));
int nfs_vget __P((struct mount *, ino_t, struct vnode **));
int nfs_valloc __P((struct vop_valloc_args *));
#define nfs_reallocblks \
@@ -164,13 +221,20 @@ int nfs_valloc __P((struct vop_valloc_args *));
int nfs_vfree __P((struct vop_vfree_args *));
int nfs_truncate __P((struct vop_truncate_args *));
int nfs_update __P((struct vop_update_args *));
-int nfs_bwrite __P((struct vop_bwrite_args *));
/* other stuff */
int nfs_removeit __P((struct sillyrename *));
-int nfs_nget __P((struct mount *,nfsv2fh_t *,struct nfsnode **));
-int nfs_lookitup __P((struct sillyrename *,nfsv2fh_t *,struct proc *));
+int nfs_nget __P((struct mount *,nfsfh_t *,int,struct nfsnode **));
+int nfs_lookitup __P((struct vnode *,char *,int,struct ucred *,struct proc *,struct nfsnode **));
int nfs_sillyrename __P((struct vnode *,struct vnode *,struct componentname *));
+nfsuint64 *nfs_getcookie __P((struct nfsnode *, off_t, int));
+void nfs_invaldir __P((struct vnode *));
+
+#ifdef __FreeBSD__
+#define nqnfs_lease_updatetime nfs_lease_updatetime
+#else
+#define nqnfs_lease_updatetime lease_updatetime
+#endif
#endif /* KERNEL */
OpenPOWER on IntegriCloud