Home | History | Annotate | Line # | Download | only in nfs
nfsmount.h revision 1.27.2.5
      1  1.27.2.5     skrll /*	$NetBSD: nfsmount.h,v 1.27.2.5 2004/09/21 13:38:44 skrll Exp $	*/
      2       1.5       cgd 
      3       1.1   mycroft /*
      4       1.4   mycroft  * Copyright (c) 1989, 1993
      5       1.4   mycroft  *	The Regents of the University of California.  All rights reserved.
      6       1.1   mycroft  *
      7       1.1   mycroft  * This code is derived from software contributed to Berkeley by
      8       1.1   mycroft  * Rick Macklem at The University of Guelph.
      9       1.1   mycroft  *
     10       1.1   mycroft  * Redistribution and use in source and binary forms, with or without
     11       1.1   mycroft  * modification, are permitted provided that the following conditions
     12       1.1   mycroft  * are met:
     13       1.1   mycroft  * 1. Redistributions of source code must retain the above copyright
     14       1.1   mycroft  *    notice, this list of conditions and the following disclaimer.
     15       1.1   mycroft  * 2. Redistributions in binary form must reproduce the above copyright
     16       1.1   mycroft  *    notice, this list of conditions and the following disclaimer in the
     17       1.1   mycroft  *    documentation and/or other materials provided with the distribution.
     18  1.27.2.2     skrll  * 3. Neither the name of the University nor the names of its contributors
     19       1.1   mycroft  *    may be used to endorse or promote products derived from this software
     20       1.1   mycroft  *    without specific prior written permission.
     21       1.1   mycroft  *
     22       1.1   mycroft  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23       1.1   mycroft  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24       1.1   mycroft  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25       1.1   mycroft  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26       1.1   mycroft  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27       1.1   mycroft  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28       1.1   mycroft  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29       1.1   mycroft  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30       1.1   mycroft  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31       1.1   mycroft  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32       1.1   mycroft  * SUCH DAMAGE.
     33       1.1   mycroft  *
     34      1.10      fvdl  *	@(#)nfsmount.h	8.3 (Berkeley) 3/30/95
     35       1.1   mycroft  */
     36       1.1   mycroft 
     37      1.10      fvdl 
     38      1.10      fvdl #ifndef _NFS_NFSMOUNT_H_
     39      1.10      fvdl #define _NFS_NFSMOUNT_H_
     40      1.10      fvdl 
     41       1.1   mycroft /*
     42      1.16      fvdl  * Arguments to mount NFS
     43      1.16      fvdl  */
     44      1.16      fvdl #define NFS_ARGSVERSION	3		/* change when nfs_args changes */
     45      1.16      fvdl struct nfs_args {
     46      1.16      fvdl 	int		version;	/* args structure version number */
     47      1.16      fvdl 	struct sockaddr	*addr;		/* file server address */
     48      1.16      fvdl 	int		addrlen;	/* length of address */
     49      1.16      fvdl 	int		sotype;		/* Socket type */
     50      1.16      fvdl 	int		proto;		/* and Protocol */
     51      1.16      fvdl 	u_char		*fh;		/* File handle to be mounted */
     52      1.16      fvdl 	int		fhsize;		/* Size, in bytes, of fh */
     53      1.16      fvdl 	int		flags;		/* flags */
     54      1.16      fvdl 	int		wsize;		/* write size in bytes */
     55      1.16      fvdl 	int		rsize;		/* read size in bytes */
     56      1.16      fvdl 	int		readdirsize;	/* readdir size in bytes */
     57      1.16      fvdl 	int		timeo;		/* initial timeout in .1 secs */
     58      1.16      fvdl 	int		retrans;	/* times to retry send */
     59      1.16      fvdl 	int		maxgrouplist;	/* Max. size of group list */
     60      1.16      fvdl 	int		readahead;	/* # of blocks to readahead */
     61      1.16      fvdl 	int		leaseterm;	/* Term (sec) of lease */
     62      1.16      fvdl 	int		deadthresh;	/* Retrans threshold */
     63      1.16      fvdl 	char		*hostname;	/* server's name */
     64      1.16      fvdl };
     65      1.16      fvdl 
     66      1.16      fvdl /*
     67      1.16      fvdl  * NFS mount option flags (nm_flag)
     68      1.16      fvdl  */
     69      1.16      fvdl #define	NFSMNT_SOFT		0x00000001  /* soft mount (hard is default) */
     70      1.16      fvdl #define	NFSMNT_WSIZE		0x00000002  /* set write size */
     71      1.16      fvdl #define	NFSMNT_RSIZE		0x00000004  /* set read size */
     72      1.16      fvdl #define	NFSMNT_TIMEO		0x00000008  /* set initial timeout */
     73      1.16      fvdl #define	NFSMNT_RETRANS		0x00000010  /* set number of request retries */
     74      1.16      fvdl #define	NFSMNT_MAXGRPS		0x00000020  /* set maximum grouplist size */
     75      1.16      fvdl #define	NFSMNT_INT		0x00000040  /* allow interrupts on hard mount */
     76      1.16      fvdl #define	NFSMNT_NOCONN		0x00000080  /* Don't Connect the socket */
     77      1.16      fvdl #define	NFSMNT_NQNFS		0x00000100  /* Use Nqnfs protocol */
     78      1.16      fvdl #define	NFSMNT_NFSV3		0x00000200  /* Use NFS Version 3 protocol */
     79      1.16      fvdl #define	NFSMNT_KERB		0x00000400  /* Use Kerberos authentication */
     80      1.16      fvdl #define	NFSMNT_DUMBTIMR		0x00000800  /* Don't estimate rtt dynamically */
     81      1.16      fvdl #define	NFSMNT_LEASETERM	0x00001000  /* set lease term (nqnfs) */
     82      1.16      fvdl #define	NFSMNT_READAHEAD	0x00002000  /* set read ahead */
     83      1.16      fvdl #define	NFSMNT_DEADTHRESH	0x00004000  /* set dead server retry thresh */
     84      1.16      fvdl #define	NFSMNT_RESVPORT		0x00008000  /* Allocate a reserved port */
     85      1.16      fvdl #define	NFSMNT_RDIRPLUS		0x00010000  /* Use Readdirplus for V3 */
     86      1.16      fvdl #define	NFSMNT_READDIRSIZE	0x00020000  /* Set readdir size */
     87      1.16      fvdl #define NFSMNT_XLATECOOKIE	0x00040000  /* 32<->64 dir cookie xlation */
     88      1.22  christos 
     89      1.22  christos #define NFSMNT_BITS	"\177\20" \
     90      1.22  christos     "b\00soft\0b\01wsize\0b\02rsize\0b\03timeo\0" \
     91      1.22  christos     "b\04retrans\0b\05maxgrps\0b\06intr\0b\07noconn\0" \
     92      1.22  christos     "b\10nqnfs\0b\11nfsv3\0b\12kerb\0b\13dumbtimr\0" \
     93      1.22  christos     "b\14leaseterm\0b\15readahead\0b\16deadthresh\0b\17resvport\0" \
     94  1.27.2.2     skrll     "b\20rdirplus\0b\21readdirsize\0b\22xlatecookie\0"
     95      1.16      fvdl 
     96      1.16      fvdl /*
     97      1.16      fvdl  * NFS internal flags (nm_iflag) */
     98      1.16      fvdl 
     99      1.16      fvdl #define NFSMNT_HASWRITEVERF	0x00000001  /* Has write verifier for V3 */
    100      1.16      fvdl #define NFSMNT_GOTPATHCONF	0x00000002  /* Got the V3 pathconf info */
    101      1.16      fvdl #define NFSMNT_GOTFSINFO	0x00000004  /* Got the V3 fsinfo */
    102      1.16      fvdl #define	NFSMNT_MNTD		0x00000008  /* Mnt server for mnt point */
    103      1.16      fvdl #define	NFSMNT_DISMINPROG	0x00000010  /* Dismount in progress */
    104      1.16      fvdl #define	NFSMNT_DISMNT		0x00000020  /* Dismounted */
    105      1.16      fvdl #define	NFSMNT_SNDLOCK		0x00000040  /* Send socket lock */
    106      1.16      fvdl #define	NFSMNT_WANTSND		0x00000080  /* Want above */
    107      1.16      fvdl #define	NFSMNT_RCVLOCK		0x00000100  /* Rcv socket lock */
    108      1.16      fvdl #define	NFSMNT_WANTRCV		0x00000200  /* Want above */
    109      1.16      fvdl #define	NFSMNT_WAITAUTH		0x00000400  /* Wait for authentication */
    110      1.16      fvdl #define	NFSMNT_HASAUTH		0x00000800  /* Has authenticator */
    111      1.16      fvdl #define	NFSMNT_WANTAUTH		0x00001000  /* Wants an authenticator */
    112      1.16      fvdl #define	NFSMNT_AUTHERR		0x00002000  /* Authentication error */
    113      1.16      fvdl #define NFSMNT_SWAPCOOKIE	0x00004000  /* XDR encode dir cookies */
    114      1.24      yamt #define NFSMNT_STALEWRITEVERF	0x00008000  /* Write verifier is changing */
    115      1.16      fvdl 
    116      1.16      fvdl #ifdef _KERNEL
    117      1.16      fvdl /*
    118       1.1   mycroft  * Mount structure.
    119       1.1   mycroft  * One allocated on every NFS mount.
    120       1.1   mycroft  * Holds NFS specific information for mount.
    121       1.1   mycroft  */
    122       1.1   mycroft struct	nfsmount {
    123      1.24      yamt 	struct simplelock nm_slock;	/* Lock for this structure */
    124       1.1   mycroft 	int	nm_flag;		/* Flags for soft/hard... */
    125       1.1   mycroft 	struct	mount *nm_mountp;	/* Vfs structure for this filesystem */
    126       1.4   mycroft 	int	nm_numgrps;		/* Max. size of groupslist */
    127      1.20      fvdl 	struct vnode *nm_vnode;
    128       1.1   mycroft 	struct	socket *nm_so;		/* Rpc socket */
    129       1.1   mycroft 	int	nm_sotype;		/* Type of socket */
    130       1.1   mycroft 	int	nm_soproto;		/* and protocol */
    131       1.1   mycroft 	int	nm_soflags;		/* pr_flags for socket protocol */
    132       1.1   mycroft 	struct	mbuf *nm_nam;		/* Addr of server */
    133       1.4   mycroft 	int	nm_timeo;		/* Init timer for NFSMNT_DUMBTIMR */
    134       1.4   mycroft 	int	nm_retry;		/* Max retries */
    135       1.4   mycroft 	int	nm_srtt[4];		/* Timers for rpcs */
    136       1.4   mycroft 	int	nm_sdrtt[4];
    137       1.4   mycroft 	int	nm_sent;		/* Request send count */
    138       1.4   mycroft 	int	nm_cwnd;		/* Request send window */
    139       1.4   mycroft 	int	nm_timeouts;		/* Request timeouts */
    140       1.4   mycroft 	int	nm_deadthresh;		/* Threshold of timeouts-->dead server*/
    141       1.1   mycroft 	int	nm_rsize;		/* Max size of read rpc */
    142       1.1   mycroft 	int	nm_wsize;		/* Max size of write rpc */
    143      1.10      fvdl 	int	nm_readdirsize;		/* Size of a readdir rpc */
    144       1.4   mycroft 	int	nm_readahead;		/* Num. of blocks to readahead */
    145       1.4   mycroft 	int	nm_leaseterm;		/* Term (sec) for NQNFS lease */
    146       1.6   mycroft 	CIRCLEQ_HEAD(, nfsnode) nm_timerhead; /* Head of lease timer queue */
    147       1.4   mycroft 	struct vnode *nm_inprog;	/* Vnode in prog by nqnfs_clientd() */
    148       1.4   mycroft 	uid_t	nm_authuid;		/* Uid for authenticator */
    149       1.4   mycroft 	int	nm_authtype;		/* Authenticator type */
    150       1.4   mycroft 	int	nm_authlen;		/* and length */
    151       1.4   mycroft 	char	*nm_authstr;		/* Authenticator string */
    152      1.10      fvdl 	char	*nm_verfstr;		/* and the verifier */
    153      1.10      fvdl 	int	nm_verflen;
    154      1.24      yamt 	struct lock nm_writeverflock;	/* lock for below */
    155      1.23      yamt 	u_char	nm_writeverf[NFSX_V3WRITEVERF]; /* V3 write verifier */
    156      1.10      fvdl 	NFSKERBKEY_T nm_key;		/* and the session key */
    157      1.10      fvdl 	int	nm_numuids;		/* Number of nfsuid mappings */
    158      1.10      fvdl 	TAILQ_HEAD(, nfsuid) nm_uidlruhead; /* Lists of nfsuid mappings */
    159      1.10      fvdl 	LIST_HEAD(, nfsuid) nm_uidhashtbl[NFS_MUIDHASHSIZ];
    160      1.11   thorpej 	TAILQ_HEAD(, buf) nm_bufq;      /* async io buffer queue */
    161      1.11   thorpej 	short	nm_bufqlen;		/* number of buffers in queue */
    162      1.11   thorpej 	short	nm_bufqwant;		/* process wants to add to the queue */
    163      1.11   thorpej 	int	nm_bufqiods;		/* number of iods processing queue */
    164      1.14      fvdl 	u_int64_t nm_maxfilesize;	/* maximum file size */
    165      1.15      fvdl 	int	nm_iflag;		/* internal flags */
    166      1.18  sommerfe 	int	nm_waiters;		/* number of waiting listeners.. */
    167       1.1   mycroft };
    168       1.1   mycroft 
    169       1.1   mycroft /*
    170       1.1   mycroft  * Convert mount ptr to nfsmount ptr.
    171       1.1   mycroft  */
    172       1.1   mycroft #define VFSTONFS(mp)	((struct nfsmount *)((mp)->mnt_data))
    173       1.1   mycroft 
    174       1.1   mycroft /*
    175       1.1   mycroft  * Prototypes for NFS mount operations
    176       1.1   mycroft  */
    177      1.13       cgd int	nfs_mount __P((struct mount *mp, const char *path, void *data,
    178  1.27.2.5     skrll 		struct nameidata *ndp, struct lwp *p));
    179      1.10      fvdl int	mountnfs __P((struct nfs_args *argp, struct mount *mp,
    180      1.13       cgd 		struct mbuf *nam, const char *pth, const char *hst,
    181  1.27.2.5     skrll 		struct vnode **vpp, struct lwp *p));
    182      1.10      fvdl int	nfs_mountroot __P((void));
    183  1.27.2.2     skrll void	nfs_decode_args __P((struct nfsmount *, struct nfs_args *,
    184  1.27.2.5     skrll 		struct lwp *l));
    185  1.27.2.5     skrll int	nfs_start __P((struct mount *mp, int flags, struct lwp *l));
    186  1.27.2.5     skrll int	nfs_unmount __P((struct mount *mp, int mntflags, struct lwp *l));
    187  1.27.2.3     skrll int	nfs_root __P((struct mount *mp, struct vnode **vpp));
    188  1.27.2.2     skrll int	nfs_quotactl __P((struct mount *mp, int cmds, uid_t uid, void *arg,
    189  1.27.2.5     skrll 		struct lwp *l));
    190  1.27.2.5     skrll int	nfs_statvfs __P((struct mount *mp, struct statvfs *sbp, struct lwp *l));
    191      1.10      fvdl int	nfs_sync __P((struct mount *mp, int waitfor, struct ucred *cred,
    192  1.27.2.5     skrll 		struct lwp *p));
    193  1.27.2.3     skrll int	nfs_vget __P((struct mount *, ino_t, struct vnode **));
    194  1.27.2.3     skrll int	nfs_fhtovp __P((struct mount *mp, struct fid *fhp, struct vnode **vpp));
    195      1.17  wrstuden int	nfs_checkexp __P((struct mount *mp, struct mbuf *nam, int *exflagsp,
    196      1.17  wrstuden 		struct ucred **credanonp));
    197      1.10      fvdl int	nfs_vptofh __P((struct vnode *vp, struct fid *fhp));
    198      1.10      fvdl int	nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *,
    199  1.27.2.5     skrll 			struct lwp *));
    200      1.12   thorpej void	nfs_vfs_init __P((void));
    201      1.21       chs void	nfs_vfs_reinit __P((void));
    202      1.19  jdolecek void	nfs_vfs_done __P((void));
    203      1.12   thorpej 
    204      1.12   thorpej /*
    205      1.12   thorpej  * Prototypes for miscellaneous exported NFS functions.
    206      1.12   thorpej  */
    207      1.10      fvdl void	nfs_init __P((void));
    208      1.16      fvdl 
    209      1.16      fvdl #endif /* _KERNEL */
    210       1.9  christos 
    211      1.10      fvdl #endif
    212