1997-04-12 01:52:00 +04:00
|
|
|
/* $NetBSD: nfsnode.h,v 1.20 1997/04/11 21:52:07 kleink Exp $ */
|
1994-06-29 10:39:25 +04:00
|
|
|
|
1993-04-20 15:20:47 +04:00
|
|
|
/*
|
1994-06-08 15:33:09 +04:00
|
|
|
* Copyright (c) 1989, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
1993-04-20 15:20:47 +04:00
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* Rick Macklem at The University of Guelph.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1996-02-18 14:53:36 +03:00
|
|
|
* @(#)nfsnode.h 8.9 (Berkeley) 5/14/95
|
1993-04-20 15:20:47 +04:00
|
|
|
*/
|
|
|
|
|
1996-02-18 14:53:36 +03:00
|
|
|
|
|
|
|
#ifndef _NFS_NFSNODE_H_
|
|
|
|
#define _NFS_NFSNODE_H_
|
|
|
|
|
|
|
|
#ifndef _NFS_NFS_H_
|
|
|
|
#include <nfs/nfs.h>
|
|
|
|
#endif
|
|
|
|
|
1994-06-08 15:33:09 +04:00
|
|
|
/*
|
|
|
|
* Silly rename structure that hangs off the nfsnode until the name
|
|
|
|
* can be removed by nfs_inactive()
|
|
|
|
*/
|
|
|
|
struct sillyrename {
|
|
|
|
struct ucred *s_cred;
|
|
|
|
struct vnode *s_dvp;
|
|
|
|
long s_namlen;
|
|
|
|
char s_name[20];
|
|
|
|
};
|
1993-04-20 15:20:47 +04:00
|
|
|
|
1996-02-18 14:53:36 +03:00
|
|
|
/*
|
|
|
|
* 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];
|
|
|
|
};
|
|
|
|
|
1993-04-20 15:20:47 +04:00
|
|
|
/*
|
|
|
|
* 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)
|
1996-02-18 14:53:36 +03:00
|
|
|
* 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.
|
1993-04-20 15:20:47 +04:00
|
|
|
*/
|
|
|
|
struct nfsnode {
|
1996-02-18 14:53:36 +03:00
|
|
|
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 */
|
1993-04-20 15:20:47 +04:00
|
|
|
};
|
|
|
|
|
1996-02-18 14:53:36 +03:00
|
|
|
#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
|
|
|
|
|
1994-06-08 15:33:09 +04:00
|
|
|
/*
|
|
|
|
* Flags for n_flag
|
|
|
|
*/
|
|
|
|
#define NFLUSHWANT 0x0001 /* Want wakeup from a flush in prog. */
|
|
|
|
#define NFLUSHINPROG 0x0002 /* Avoid multiple calls to vinvalbuf() */
|
|
|
|
#define NMODIFIED 0x0004 /* Might have a modified buffer in bio */
|
|
|
|
#define NWRITEERR 0x0008 /* Flag write errors so close will know */
|
|
|
|
#define NQNFSNONCACHE 0x0020 /* Non-cachable lease */
|
|
|
|
#define NQNFSWRITE 0x0040 /* Write lease */
|
|
|
|
#define NQNFSEVICTED 0x0080 /* Has been evicted */
|
|
|
|
#define NACC 0x0100 /* Special file accessed */
|
|
|
|
#define NUPD 0x0200 /* Special file updated */
|
|
|
|
#define NCHG 0x0400 /* Special file times changed */
|
1993-04-20 15:20:47 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Convert between nfsnode pointers and vnode pointers
|
|
|
|
*/
|
|
|
|
#define VTONFS(vp) ((struct nfsnode *)(vp)->v_data)
|
|
|
|
#define NFSTOV(np) ((struct vnode *)(np)->n_vnode)
|
1994-06-08 15:33:09 +04:00
|
|
|
|
1993-04-20 15:20:47 +04:00
|
|
|
/*
|
1994-06-08 15:33:09 +04:00
|
|
|
* Queue head for nfsiod's
|
1993-04-20 15:20:47 +04:00
|
|
|
*/
|
1996-12-03 01:55:39 +03:00
|
|
|
extern struct proc *nfs_iodwant[NFS_MAXASYNCDAEMON];
|
|
|
|
extern struct nfsmount *nfs_iodmount[NFS_MAXASYNCDAEMON];
|
1993-04-20 15:20:47 +04:00
|
|
|
|
1995-03-27 00:35:13 +04:00
|
|
|
#ifdef _KERNEL
|
1993-04-20 15:20:47 +04:00
|
|
|
/*
|
|
|
|
* Prototypes for NFS vnode operations
|
|
|
|
*/
|
1996-09-02 03:47:48 +04:00
|
|
|
int nfs_lookup __P((void *));
|
|
|
|
int nfs_create __P((void *));
|
|
|
|
int nfs_mknod __P((void *));
|
|
|
|
int nfs_open __P((void *));
|
|
|
|
int nfs_close __P((void *));
|
|
|
|
int nfsspec_close __P((void *));
|
|
|
|
int nfsfifo_close __P((void *));
|
|
|
|
int nfs_access __P((void *));
|
|
|
|
int nfsspec_access __P((void *));
|
|
|
|
int nfs_getattr __P((void *));
|
|
|
|
int nfs_setattr __P((void *));
|
|
|
|
int nfs_read __P((void *));
|
|
|
|
int nfs_write __P((void *));
|
|
|
|
#define nfs_lease_check genfs_nullop
|
|
|
|
#define nqnfs_vop_lease_check lease_check
|
|
|
|
int nfsspec_read __P((void *));
|
|
|
|
int nfsspec_write __P((void *));
|
|
|
|
int nfsfifo_read __P((void *));
|
|
|
|
int nfsfifo_write __P((void *));
|
|
|
|
#define nfs_ioctl ((int (*) __P((void *)))enoioctl)
|
1996-09-07 16:40:22 +04:00
|
|
|
#define nfs_poll genfs_poll
|
1996-02-18 14:53:36 +03:00
|
|
|
#ifdef Lite2_integrated
|
1996-09-02 03:47:48 +04:00
|
|
|
#define nfs_revoke vop_revoke
|
|
|
|
#endif
|
|
|
|
int nfs_mmap __P((void *));
|
|
|
|
int nfs_fsync __P((void *));
|
1997-04-12 01:52:00 +04:00
|
|
|
#define nfs_seek genfs_seek
|
1996-09-02 03:47:48 +04:00
|
|
|
int nfs_remove __P((void *));
|
|
|
|
int nfs_link __P((void *));
|
|
|
|
int nfs_rename __P((void *));
|
|
|
|
int nfs_mkdir __P((void *));
|
|
|
|
int nfs_rmdir __P((void *));
|
|
|
|
int nfs_symlink __P((void *));
|
|
|
|
int nfs_readdir __P((void *));
|
|
|
|
int nfs_readlink __P((void *));
|
|
|
|
#define nfs_abortop genfs_abortop
|
|
|
|
int nfs_inactive __P((void *));
|
|
|
|
int nfs_reclaim __P((void *));
|
|
|
|
#ifdef Lite2_integrated
|
|
|
|
#define nfs_lock ((int (*) __P((void *)))vop_nolock)
|
|
|
|
#define nfs_unlock ((int (*) __P((void *)))vop_nounlock)
|
|
|
|
#define nfs_islocked ((int (*) __P((void *)))vop_noislocked)
|
1996-02-18 14:53:36 +03:00
|
|
|
#else
|
1996-09-02 03:47:48 +04:00
|
|
|
int nfs_lock __P((void *));
|
|
|
|
int nfs_unlock __P((void *));
|
|
|
|
int nfs_islocked __P((void *));
|
1996-02-18 14:53:36 +03:00
|
|
|
#endif /* Lite2_integrated */
|
1996-09-02 03:47:48 +04:00
|
|
|
int nfs_bmap __P((void *));
|
|
|
|
int nfs_strategy __P((void *));
|
|
|
|
int nfs_print __P((void *));
|
|
|
|
int nfs_pathconf __P((void *));
|
|
|
|
int nfs_advlock __P((void *));
|
|
|
|
#define nfs_blkatoff genfs_eopnotsupp
|
|
|
|
int nfs_bwrite __P((void *));
|
|
|
|
int nfs_vget __P((struct mount *, ino_t, struct vnode **));
|
|
|
|
#define nfs_valloc genfs_eopnotsupp
|
|
|
|
#define nfs_reallocblks genfs_eopnotsupp
|
|
|
|
#define nfs_vfree genfs_nullop
|
|
|
|
int nfs_truncate __P((void *));
|
|
|
|
int nfs_update __P((void *));
|
1996-02-10 00:48:19 +03:00
|
|
|
|
|
|
|
extern int (**nfsv2_vnodeop_p) __P((void *));
|
|
|
|
|
1995-03-27 00:35:13 +04:00
|
|
|
#endif /* _KERNEL */
|
1996-02-18 14:53:36 +03:00
|
|
|
|
|
|
|
#endif
|