2007-06-02 03:16:33 +04:00
|
|
|
/* $NetBSD: nfs.h,v 1.66 2007/06/01 23:16:33 dogcow Exp $ */
|
1993-04-20 15:20:47 +04:00
|
|
|
/*
|
1996-02-18 14:53:36 +03:00
|
|
|
* Copyright (c) 1989, 1993, 1995
|
1994-06-08 15:33:09 +04:00
|
|
|
* 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.
|
2003-08-07 20:26:28 +04:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
1993-04-20 15:20:47 +04:00
|
|
|
* 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
|
|
|
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
|
1993-04-20 15:20:47 +04:00
|
|
|
*/
|
|
|
|
|
1996-02-18 14:53:36 +03:00
|
|
|
#ifndef _NFS_NFS_H_
|
|
|
|
#define _NFS_NFS_H_
|
2007-06-02 03:16:33 +04:00
|
|
|
#ifdef _KERNEL
|
|
|
|
#include <sys/condvar.h>
|
|
|
|
#endif
|
1996-02-18 14:53:36 +03:00
|
|
|
|
1993-04-20 15:20:47 +04:00
|
|
|
/*
|
|
|
|
* Tunable constants for nfs
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define NFS_MAXIOVEC 34
|
1996-02-18 14:53:36 +03:00
|
|
|
#define NFS_TICKINTVL 5 /* Desired time for a tick (msec) */
|
|
|
|
#define NFS_HZ (hz / nfs_ticks) /* Ticks/sec */
|
1997-05-13 03:36:04 +04:00
|
|
|
#define NFS_TIMEO (3 * NFS_HZ) /* Default timeout = 3 seconds */
|
1996-02-18 14:53:36 +03:00
|
|
|
#define NFS_MINTIMEO (1 * NFS_HZ) /* Min timeout to use */
|
|
|
|
#define NFS_MAXTIMEO (60 * NFS_HZ) /* Max timeout to backoff to */
|
|
|
|
#define NFS_MINIDEMTIMEO (5 * NFS_HZ) /* Min timeout for non-idempotent ops*/
|
1993-04-20 15:20:47 +04:00
|
|
|
#define NFS_MAXREXMIT 100 /* Stop counting after this many */
|
|
|
|
#define NFS_MAXWINDOW 1024 /* Max number of outstanding requests */
|
|
|
|
#define NFS_RETRANS 10 /* Num of retrans for soft mounts */
|
1994-06-08 15:33:09 +04:00
|
|
|
#define NFS_MAXGRPS 16 /* Max. size of groups list */
|
1996-02-18 14:53:36 +03:00
|
|
|
#ifndef NFS_MINATTRTIMO
|
1994-06-08 15:33:09 +04:00
|
|
|
#define NFS_MINATTRTIMO 5 /* Attribute cache timeout in sec */
|
1996-02-18 14:53:36 +03:00
|
|
|
#endif
|
|
|
|
#ifndef NFS_MAXATTRTIMO
|
1994-06-08 15:33:09 +04:00
|
|
|
#define NFS_MAXATTRTIMO 60
|
1996-02-18 14:53:36 +03:00
|
|
|
#endif
|
2003-08-16 22:08:27 +04:00
|
|
|
#define NFS_TRYLATERDEL 1 /* Initial try later delay (sec) */
|
|
|
|
#define NFS_TRYLATERDELMAX (1*60) /* Maximum try later delay (sec) */
|
|
|
|
#define NFS_TRYLATERDELMUL 2 /* Exponential backoff multiplier */
|
2001-04-02 15:47:23 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* These can be overridden through <machine/param.h>, included via
|
|
|
|
* <sys/param.h>. This means that <sys/param.h> should always be
|
|
|
|
* included before this file.
|
|
|
|
*/
|
2001-03-25 06:22:30 +04:00
|
|
|
#ifndef NFS_WSIZE
|
2001-04-02 15:47:23 +04:00
|
|
|
#define NFS_WSIZE 8192 /* Def. write data size */
|
2001-03-25 06:22:30 +04:00
|
|
|
#endif
|
|
|
|
#ifndef NFS_RSIZE
|
2001-04-02 15:47:23 +04:00
|
|
|
#define NFS_RSIZE 8192 /* Def. read data size */
|
2001-03-25 06:22:30 +04:00
|
|
|
#endif
|
2001-04-02 15:47:23 +04:00
|
|
|
#ifndef NFS_READDIRSIZE
|
1996-02-18 14:53:36 +03:00
|
|
|
#define NFS_READDIRSIZE 8192 /* Def. readdir size */
|
2001-04-02 15:47:23 +04:00
|
|
|
#endif
|
|
|
|
|
2003-12-06 05:43:17 +03:00
|
|
|
/*
|
|
|
|
* NFS client IO daemon threads. May be overridden by config options.
|
|
|
|
*/
|
|
|
|
#ifndef NFS_MAXASYNCDAEMON
|
|
|
|
#define NFS_MAXASYNCDAEMON 128 /* Max. number async_daemons runable */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* NFS client read-ahead. May be overridden by config options.
|
|
|
|
* Should be no more than NFS_MAXASYNCDAEMON as each read-ahead operation
|
|
|
|
* requires one IO thread.
|
|
|
|
*/
|
|
|
|
#ifndef NFS_MAXRAHEAD
|
|
|
|
#define NFS_MAXRAHEAD 32 /* Max. read ahead # blocks */
|
|
|
|
#endif
|
2000-09-20 02:05:55 +04:00
|
|
|
#define NFS_DEFRAHEAD 2 /* Def. read ahead # blocks */
|
2003-12-06 05:43:17 +03:00
|
|
|
|
1994-06-08 15:33:09 +04:00
|
|
|
#define NFS_MAXUIDHASH 64 /* Max. # of hashed uid entries/mp */
|
2003-12-06 05:43:17 +03:00
|
|
|
|
2006-12-27 15:10:09 +03:00
|
|
|
#define NFS_DEFDEADTHRESH NFS_NEVERDEAD /* Default nm_deadthresh */
|
|
|
|
#define NFS_NEVERDEAD 9 /* Greater than max. nm_timeouts */
|
|
|
|
|
2000-04-16 01:14:48 +04:00
|
|
|
#ifdef _KERNEL
|
|
|
|
extern int nfs_niothreads; /* Number of async_daemons desired */
|
2001-07-01 06:13:35 +04:00
|
|
|
#ifndef NFS_DEFAULT_NIOTHREADS
|
|
|
|
#define NFS_DEFAULT_NIOTHREADS 4
|
|
|
|
#endif
|
2000-04-16 01:14:48 +04:00
|
|
|
#endif
|
1996-02-18 14:53:36 +03:00
|
|
|
#define NFS_MAXGATHERDELAY 100 /* Max. write gather delay (msec) */
|
|
|
|
#ifndef NFS_GATHERDELAY
|
|
|
|
#define NFS_GATHERDELAY 10 /* Default write gather delay (msec) */
|
|
|
|
#endif
|
1997-10-10 05:53:17 +04:00
|
|
|
|
1996-02-18 14:53:36 +03:00
|
|
|
/*
|
1997-10-10 05:53:17 +04:00
|
|
|
* NFS_DIRBLKSIZ is the size of buffers in the buffer cache used for
|
|
|
|
* NFS directory vnodes. NFS_DIRFRAGSIZ is the minimum aligned amount
|
|
|
|
* of data in those buffers, and thus the minimum amount of data
|
|
|
|
* that you can request. NFS_DIRFRAGSIZ should be no smaller than
|
|
|
|
* DIRBLKSIZ.
|
1996-02-18 14:53:36 +03:00
|
|
|
*/
|
1997-10-10 05:53:17 +04:00
|
|
|
|
|
|
|
#define NFS_DIRBLKSIZ 8192 /* Must be a multiple of DIRBLKSIZ */
|
|
|
|
#define NFS_DIRFRAGSIZ 512 /* Same as DIRBLKSIZ, generally */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Maximum number of directory entries cached per NFS node, to avoid
|
|
|
|
* having this grow without bounds on very large directories. The
|
|
|
|
* minimum size to get reasonable performance for emulated binaries
|
|
|
|
* is the maximum number of entries that fits in NFS_DIRBLKSIZ.
|
|
|
|
* For NFS_DIRBLKSIZ = 512, this would be 512 / 14 = 36.
|
|
|
|
*/
|
|
|
|
#define NFS_MAXDIRCACHE (NFS_DIRBLKSIZ / 14)
|
1996-02-18 14:53:36 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Oddballs
|
|
|
|
*/
|
|
|
|
#define NFS_CMPFH(n, f, s) \
|
2007-03-04 08:59:00 +03:00
|
|
|
((n)->n_fhsize == (s) && !memcmp((void *)(n)->n_fhp, (void *)(f), (s)))
|
2000-09-19 21:04:50 +04:00
|
|
|
#ifdef NFS_V2_ONLY
|
|
|
|
#define NFS_ISV3(v) (0)
|
|
|
|
#else
|
1996-02-18 14:53:36 +03:00
|
|
|
#define NFS_ISV3(v) (VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3)
|
2000-09-19 21:04:50 +04:00
|
|
|
#endif
|
1996-02-18 14:53:36 +03:00
|
|
|
#define NFS_SRVMAXDATA(n) \
|
|
|
|
(((n)->nd_flag & ND_NFSV3) ? (((n)->nd_nam2) ? \
|
|
|
|
NFS_MAXDGRAMDATA : NFS_MAXDATA) : NFS_V2MAXDATA)
|
|
|
|
|
|
|
|
/*
|
2000-11-27 11:39:39 +03:00
|
|
|
* Use the vm_page flag reserved for pager use to indicate pages
|
|
|
|
* which have been written to the server but not yet committed.
|
1996-02-18 14:53:36 +03:00
|
|
|
*/
|
2000-11-27 11:39:39 +03:00
|
|
|
#define PG_NEEDCOMMIT PG_PAGER1
|
1996-02-18 14:53:36 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The IO_METASYNC flag should be implemented for local file systems.
|
|
|
|
* (Until then, it is nothin at all.)
|
|
|
|
*/
|
|
|
|
#ifndef IO_METASYNC
|
|
|
|
#define IO_METASYNC 0
|
|
|
|
#endif
|
1993-04-20 15:20:47 +04:00
|
|
|
|
1994-06-08 15:33:09 +04:00
|
|
|
/*
|
|
|
|
* Set the attribute timeout based on how recently the file has been modified.
|
|
|
|
*/
|
2005-09-19 03:44:54 +04:00
|
|
|
#define NFS_ATTRTIMEO(nmp, np) \
|
|
|
|
((nmp->nm_flag & NFSMNT_NOAC) ? 0 : \
|
1994-06-08 15:33:09 +04:00
|
|
|
((((np)->n_flag & NMODIFIED) || \
|
2006-06-08 02:33:33 +04:00
|
|
|
(time_second - (np)->n_mtime.tv_sec) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
|
|
|
|
((time_second - (np)->n_mtime.tv_sec) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
|
|
|
|
(time_second - (np)->n_mtime.tv_sec) / 10)))
|
1994-06-08 15:33:09 +04:00
|
|
|
|
|
|
|
/*
|
Apply the NFS exports list rototill patch:
- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.
Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.
2005-09-23 16:10:31 +04:00
|
|
|
* Export arguments for local filesystem mount calls.
|
|
|
|
* Keep in mind that changing this structure modifies nfssvc(2)'s ABI (see
|
|
|
|
* 'struct mountd_exports_list' below).
|
2005-09-26 01:57:40 +04:00
|
|
|
* When modifying this structure, take care to also edit the
|
|
|
|
* nfs_update_exports_30 function in nfs_export.c accordingly to convert
|
|
|
|
* export_args to export_args30.
|
Apply the NFS exports list rototill patch:
- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.
Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.
2005-09-23 16:10:31 +04:00
|
|
|
*/
|
|
|
|
struct export_args {
|
|
|
|
int ex_flags; /* export related flags */
|
|
|
|
uid_t ex_root; /* mapping for root uid */
|
|
|
|
struct uucred ex_anon; /* mapping for anonymous user */
|
|
|
|
struct sockaddr *ex_addr; /* net address to which exported */
|
|
|
|
int ex_addrlen; /* and the net address length */
|
|
|
|
struct sockaddr *ex_mask; /* mask of valid bits in saddr */
|
|
|
|
int ex_masklen; /* and the smask length */
|
|
|
|
char *ex_indexfile; /* index file for WebNFS URLs */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structures for the nfssvc(2) syscall. Not that anyone but mountd, nfsd and
|
|
|
|
* mount_nfs should ever try and use it.
|
1994-06-08 15:33:09 +04:00
|
|
|
*/
|
|
|
|
struct nfsd_args {
|
|
|
|
int sock; /* Socket to serve */
|
2007-03-04 08:59:00 +03:00
|
|
|
void * name; /* Client addr for connection based sockets */
|
1994-06-08 15:33:09 +04:00
|
|
|
int namelen; /* Length of name */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct nfsd_srvargs {
|
|
|
|
struct nfsd *nsd_nfsd; /* Pointer to in kernel nfsd struct */
|
|
|
|
uid_t nsd_uid; /* Effective uid mapped to cred */
|
1995-12-20 02:07:11 +03:00
|
|
|
u_int32_t nsd_haddr; /* Ip address of client */
|
2001-11-30 00:22:50 +03:00
|
|
|
struct uucred nsd_cr; /* Cred. uid maps to */
|
1994-06-08 15:33:09 +04:00
|
|
|
int nsd_authlen; /* Length of auth string (ret) */
|
1996-02-18 14:53:36 +03:00
|
|
|
u_char *nsd_authstr; /* Auth string (ret) */
|
|
|
|
int nsd_verflen; /* and the verfier */
|
|
|
|
u_char *nsd_verfstr;
|
|
|
|
struct timeval nsd_timestamp; /* timestamp from verifier */
|
|
|
|
u_int32_t nsd_ttl; /* credential ttl (sec) */
|
|
|
|
NFSKERBKEY_T nsd_key; /* Session key */
|
1994-06-08 15:33:09 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct nfsd_cargs {
|
|
|
|
char *ncd_dirp; /* Mount dir path */
|
|
|
|
uid_t ncd_authuid; /* Effective uid */
|
|
|
|
int ncd_authtype; /* Type of authenticator */
|
2001-08-03 10:00:13 +04:00
|
|
|
u_int ncd_authlen; /* Length of authenticator string */
|
1996-02-18 14:53:36 +03:00
|
|
|
u_char *ncd_authstr; /* Authenticator string */
|
2001-08-03 10:00:13 +04:00
|
|
|
u_int ncd_verflen; /* and the verifier */
|
1996-02-18 14:53:36 +03:00
|
|
|
u_char *ncd_verfstr;
|
|
|
|
NFSKERBKEY_T ncd_key; /* Session key */
|
1994-06-08 15:33:09 +04:00
|
|
|
};
|
|
|
|
|
Apply the NFS exports list rototill patch:
- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.
Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.
2005-09-23 16:10:31 +04:00
|
|
|
struct mountd_exports_list {
|
|
|
|
const char *mel_path;
|
|
|
|
size_t mel_nexports;
|
|
|
|
struct export_args *mel_exports;
|
|
|
|
};
|
|
|
|
|
2006-12-27 15:10:09 +03:00
|
|
|
/*
|
|
|
|
* try to keep nfsstats, which is exposed to userland via sysctl,
|
|
|
|
* compatible after NQNFS removal.
|
|
|
|
* 26 is the old value of NFS_NPROCS, which includes NQNFS procedures.
|
|
|
|
*/
|
|
|
|
#define NFSSTATS_NPROCS 26
|
|
|
|
|
1994-06-08 15:33:09 +04:00
|
|
|
/*
|
|
|
|
* Stats structure
|
|
|
|
*/
|
|
|
|
struct nfsstats {
|
|
|
|
int attrcache_hits;
|
|
|
|
int attrcache_misses;
|
|
|
|
int lookupcache_hits;
|
|
|
|
int lookupcache_misses;
|
|
|
|
int direofcache_hits;
|
|
|
|
int direofcache_misses;
|
|
|
|
int biocache_reads;
|
|
|
|
int read_bios;
|
|
|
|
int read_physios;
|
|
|
|
int biocache_writes;
|
|
|
|
int write_bios;
|
|
|
|
int write_physios;
|
|
|
|
int biocache_readlinks;
|
|
|
|
int readlink_bios;
|
|
|
|
int biocache_readdirs;
|
|
|
|
int readdir_bios;
|
2006-12-27 15:10:09 +03:00
|
|
|
int rpccnt[NFSSTATS_NPROCS];
|
1994-06-08 15:33:09 +04:00
|
|
|
int rpcretries;
|
2006-12-27 15:10:09 +03:00
|
|
|
int srvrpccnt[NFSSTATS_NPROCS];
|
1994-06-08 15:33:09 +04:00
|
|
|
int srvrpc_errs;
|
|
|
|
int srv_errs;
|
|
|
|
int rpcrequests;
|
|
|
|
int rpctimeouts;
|
|
|
|
int rpcunexpected;
|
|
|
|
int rpcinvalid;
|
|
|
|
int srvcache_inproghits;
|
|
|
|
int srvcache_idemdonehits;
|
|
|
|
int srvcache_nonidemdonehits;
|
|
|
|
int srvcache_misses;
|
2006-12-27 15:10:09 +03:00
|
|
|
int __srvnqnfs_leases; /* unused */
|
|
|
|
int __srvnqnfs_maxleases; /* unused */
|
|
|
|
int __srvnqnfs_getleases; /* unused */
|
1996-02-18 14:53:36 +03:00
|
|
|
int srvvop_writes;
|
1994-06-08 15:33:09 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Flags for nfssvc() system call.
|
|
|
|
*/
|
|
|
|
#define NFSSVC_BIOD 0x002
|
|
|
|
#define NFSSVC_NFSD 0x004
|
|
|
|
#define NFSSVC_ADDSOCK 0x008
|
|
|
|
#define NFSSVC_AUTHIN 0x010
|
|
|
|
#define NFSSVC_GOTAUTH 0x040
|
|
|
|
#define NFSSVC_AUTHINFAIL 0x080
|
|
|
|
#define NFSSVC_MNTD 0x100
|
Apply the NFS exports list rototill patch:
- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.
Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.
2005-09-23 16:10:31 +04:00
|
|
|
#define NFSSVC_SETEXPORTSLIST 0x200
|
1994-06-08 15:33:09 +04:00
|
|
|
|
1996-02-18 14:53:36 +03:00
|
|
|
/*
|
|
|
|
* fs.nfs sysctl(3) identifiers
|
|
|
|
*/
|
|
|
|
#define NFS_NFSSTATS 1 /* struct: struct nfsstats */
|
2000-04-16 01:14:48 +04:00
|
|
|
#define NFS_IOTHREADS 2 /* number of io threads */
|
|
|
|
#define NFS_MAXID 3
|
1996-02-18 14:53:36 +03:00
|
|
|
|
1998-11-13 23:09:54 +03:00
|
|
|
#define NFS_NAMES { \
|
|
|
|
{ 0, 0 }, \
|
|
|
|
{ "nfsstats", CTLTYPE_STRUCT }, \
|
2000-04-16 01:14:48 +04:00
|
|
|
{ "iothreads", CTLTYPE_INT }, \
|
1996-02-18 14:53:36 +03:00
|
|
|
}
|
|
|
|
|
1993-04-20 15:20:47 +04:00
|
|
|
/*
|
|
|
|
* The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.
|
|
|
|
* What should be in this set is open to debate, but I believe that since
|
|
|
|
* I/O system calls on ufs are never interrupted by signals the set should
|
|
|
|
* be minimal. My reasoning is that many current programs that use signals
|
|
|
|
* such as SIGALRM will not expect file I/O system calls to be interrupted
|
|
|
|
* by them and break.
|
|
|
|
*/
|
1995-03-27 00:35:13 +04:00
|
|
|
#ifdef _KERNEL
|
1996-02-18 14:53:36 +03:00
|
|
|
|
|
|
|
struct uio; struct buf; struct vattr; struct nameidata; /* XXX */
|
|
|
|
|
1993-04-20 15:20:47 +04:00
|
|
|
/*
|
|
|
|
* Socket errors ignored for connectionless sockets??
|
|
|
|
* For now, ignore them all
|
|
|
|
*/
|
|
|
|
#define NFSIGNORE_SOERROR(s, e) \
|
|
|
|
((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \
|
|
|
|
((s) & PR_CONNREQUIRED) == 0)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Nfs outstanding request list element
|
|
|
|
*/
|
|
|
|
struct nfsreq {
|
1994-08-17 15:41:36 +04:00
|
|
|
TAILQ_ENTRY(nfsreq) r_chain;
|
1993-04-20 15:20:47 +04:00
|
|
|
struct mbuf *r_mreq;
|
|
|
|
struct mbuf *r_mrep;
|
1994-06-08 15:33:09 +04:00
|
|
|
struct mbuf *r_md;
|
2007-03-04 08:59:00 +03:00
|
|
|
void * r_dpos;
|
1993-04-20 15:20:47 +04:00
|
|
|
struct nfsmount *r_nmp;
|
1995-12-20 02:07:11 +03:00
|
|
|
u_int32_t r_xid;
|
1994-06-08 15:33:09 +04:00
|
|
|
int r_flags; /* flags on request, see below */
|
|
|
|
int r_retry; /* max retransmission count */
|
|
|
|
int r_rexmit; /* current retrans count */
|
|
|
|
int r_timer; /* tick counter on reply */
|
1997-05-13 03:36:04 +04:00
|
|
|
u_int32_t r_procnum; /* NFS procedure number */
|
1994-06-08 15:33:09 +04:00
|
|
|
int r_rtt; /* RTT for rpc */
|
2005-12-11 15:16:03 +03:00
|
|
|
struct lwp *r_lwp; /* LWP that did I/O system call */
|
1993-04-20 15:20:47 +04:00
|
|
|
};
|
|
|
|
|
1994-08-17 15:41:36 +04:00
|
|
|
/*
|
|
|
|
* Queue head for nfsreq's
|
|
|
|
*/
|
2002-05-13 03:04:35 +04:00
|
|
|
extern TAILQ_HEAD(nfsreqhead, nfsreq) nfs_reqq;
|
1994-08-17 15:41:36 +04:00
|
|
|
|
1993-04-20 15:20:47 +04:00
|
|
|
/* Flag values for r_flags */
|
|
|
|
#define R_TIMING 0x01 /* timing request (in mntp) */
|
|
|
|
#define R_SENT 0x02 /* request has been sent */
|
|
|
|
#define R_SOFTTERM 0x04 /* soft mnt, too many retries */
|
|
|
|
#define R_INTR 0x08 /* intr mnt, signal pending */
|
|
|
|
#define R_SOCKERR 0x10 /* Fatal error on socket */
|
|
|
|
#define R_TPRINTFMSG 0x20 /* Did a tprintf msg. */
|
|
|
|
#define R_MUSTRESEND 0x40 /* Must resend request */
|
2004-05-10 14:40:42 +04:00
|
|
|
#define R_REXMITTED 0x100 /* retransmitted after reconnect */
|
1994-06-08 15:33:09 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* A list of nfssvc_sock structures is maintained with all the sockets
|
|
|
|
* that require service by the nfsd.
|
|
|
|
* The nfsuid structs hang off of the nfssvc_sock structs in both lru
|
|
|
|
* and uid hash lists.
|
|
|
|
*/
|
1996-02-18 14:53:36 +03:00
|
|
|
#ifndef NFS_UIDHASHSIZ
|
|
|
|
#define NFS_UIDHASHSIZ 29 /* Tune the size of nfssvc_sock with this */
|
|
|
|
#endif
|
1994-08-17 18:43:47 +04:00
|
|
|
#define NUIDHASH(sock, uid) \
|
1996-02-18 14:53:36 +03:00
|
|
|
(&(sock)->ns_uidhashtbl[(uid) % NFS_UIDHASHSIZ])
|
|
|
|
#ifndef NFS_WDELAYHASHSIZ
|
|
|
|
#define NFS_WDELAYHASHSIZ 16 /* and with this */
|
|
|
|
#endif
|
|
|
|
#ifndef NFS_MUIDHASHSIZ
|
1996-12-03 01:55:39 +03:00
|
|
|
#define NFS_MUIDHASHSIZ 63 /* Tune the size of nfsmount with this */
|
1996-02-18 14:53:36 +03:00
|
|
|
#endif
|
|
|
|
#define NMUIDHASH(nmp, uid) \
|
|
|
|
(&(nmp)->nm_uidhashtbl[(uid) % NFS_MUIDHASHSIZ])
|
2001-09-15 20:12:54 +04:00
|
|
|
#define NFSNOHASH(fhsum) ((fhsum) & nfsnodehash)
|
1993-04-20 15:20:47 +04:00
|
|
|
|
1997-10-10 05:53:17 +04:00
|
|
|
#ifndef NFS_DIRHASHSIZ
|
1997-10-19 05:46:15 +04:00
|
|
|
#define NFS_DIRHASHSIZ 64
|
1997-10-10 05:53:17 +04:00
|
|
|
#endif
|
|
|
|
#define NFSDIRHASH(np, off) \
|
|
|
|
(&np->n_dircache[(nfs_dirhash((off)) & nfsdirhashmask)])
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Macros for storing/retrieving cookies into directory buffers.
|
|
|
|
*/
|
|
|
|
#define NFS_STASHCOOKIE(dp,off) \
|
2007-03-04 08:59:00 +03:00
|
|
|
*((off_t *)((char *)(dp) + (dp)->d_reclen - sizeof (off_t))) = off
|
1997-10-10 05:53:17 +04:00
|
|
|
#define NFS_GETCOOKIE(dp) \
|
2007-03-04 08:59:00 +03:00
|
|
|
(*((off_t *)((char *)(dp) + (dp)->d_reclen - sizeof (off_t))))
|
1997-10-19 05:46:15 +04:00
|
|
|
#define NFS_STASHCOOKIE32(dp, val) \
|
2007-03-04 08:59:00 +03:00
|
|
|
*((u_int32_t *)((char *)(dp) + (dp)->d_reclen - sizeof (off_t) - \
|
1997-10-10 05:53:17 +04:00
|
|
|
sizeof (int))) = val
|
1997-10-19 05:46:15 +04:00
|
|
|
#define NFS_GETCOOKIE32(dp) \
|
2007-03-04 08:59:00 +03:00
|
|
|
(*((u_int32_t *)((char *)(dp) + (dp)->d_reclen - sizeof (off_t) - \
|
1997-10-10 05:53:17 +04:00
|
|
|
sizeof (int))))
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Flags passed to nfs_bioread().
|
|
|
|
*/
|
|
|
|
#define NFSBIO_CACHECOOKIES 0x0001 /* Cache dir offset cookies */
|
|
|
|
|
1993-04-20 15:20:47 +04:00
|
|
|
/*
|
1994-06-08 15:33:09 +04:00
|
|
|
* Network address hash list element
|
1993-04-20 15:20:47 +04:00
|
|
|
*/
|
1994-06-08 15:33:09 +04:00
|
|
|
union nethostaddr {
|
1995-12-20 02:07:11 +03:00
|
|
|
u_int32_t had_inetaddr;
|
1994-06-08 15:33:09 +04:00
|
|
|
struct mbuf *had_nam;
|
1993-04-20 15:20:47 +04:00
|
|
|
};
|
|
|
|
|
1994-06-08 15:33:09 +04:00
|
|
|
struct nfsuid {
|
1994-08-17 18:43:47 +04:00
|
|
|
TAILQ_ENTRY(nfsuid) nu_lru; /* LRU chain */
|
|
|
|
LIST_ENTRY(nfsuid) nu_hash; /* Hash list */
|
1994-06-08 15:33:09 +04:00
|
|
|
int nu_flag; /* Flags */
|
|
|
|
union nethostaddr nu_haddr; /* Host addr. for dgram sockets */
|
2006-05-15 01:31:52 +04:00
|
|
|
kauth_cred_t nu_cr; /* Cred uid mapped to */
|
1996-02-18 14:53:36 +03:00
|
|
|
int nu_expire; /* Expiry time (sec) */
|
|
|
|
struct timeval nu_timestamp; /* Kerb. timestamp */
|
|
|
|
u_int32_t nu_nickname; /* Nickname on server */
|
|
|
|
NFSKERBKEY_T nu_key; /* and session key */
|
1994-06-08 15:33:09 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#define nu_inetaddr nu_haddr.had_inetaddr
|
|
|
|
#define nu_nam nu_haddr.had_nam
|
|
|
|
/* Bits for nu_flag */
|
|
|
|
#define NU_INETADDR 0x1
|
1996-02-18 14:53:36 +03:00
|
|
|
#define NU_NAM 0x2
|
2000-06-09 04:00:17 +04:00
|
|
|
#ifdef INET6
|
|
|
|
#define NU_NETFAM(u) \
|
|
|
|
(((u)->nu_flag & NU_INETADDR) ? \
|
|
|
|
(((u)->nu_flag & NU_NAM) ? AF_INET6 : AF_INET) : AF_ISO)
|
|
|
|
#else
|
1996-02-18 14:53:36 +03:00
|
|
|
#define NU_NETFAM(u) (((u)->nu_flag & NU_INETADDR) ? AF_INET : AF_ISO)
|
2000-06-09 04:00:17 +04:00
|
|
|
#endif
|
1994-06-08 15:33:09 +04:00
|
|
|
|
|
|
|
struct nfssvc_sock {
|
2007-06-01 15:56:03 +04:00
|
|
|
kmutex_t ns_lock;
|
|
|
|
kcondvar_t ns_cv;
|
1994-08-17 18:43:47 +04:00
|
|
|
TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */
|
2003-06-25 18:37:50 +04:00
|
|
|
TAILQ_ENTRY(nfssvc_sock) ns_pending; /* List of pending sockets */
|
1994-08-19 02:47:43 +04:00
|
|
|
TAILQ_HEAD(, nfsuid) ns_uidlruhead;
|
1994-06-08 15:33:09 +04:00
|
|
|
struct file *ns_fp;
|
|
|
|
struct socket *ns_so;
|
|
|
|
struct mbuf *ns_nam;
|
|
|
|
struct mbuf *ns_raw;
|
|
|
|
struct mbuf *ns_rawend;
|
|
|
|
struct mbuf *ns_rec;
|
|
|
|
struct mbuf *ns_recend;
|
1996-02-18 14:53:36 +03:00
|
|
|
struct mbuf *ns_frag;
|
|
|
|
int ns_flag;
|
|
|
|
int ns_solock;
|
|
|
|
int ns_cc;
|
|
|
|
int ns_reclen;
|
1994-06-08 15:33:09 +04:00
|
|
|
int ns_numuids;
|
1996-02-18 14:53:36 +03:00
|
|
|
u_int32_t ns_sref;
|
2006-01-03 15:30:01 +03:00
|
|
|
SIMPLEQ_HEAD(, nfsrv_descript) ns_sendq; /* send reply list */
|
1996-02-18 14:53:36 +03:00
|
|
|
LIST_HEAD(, nfsrv_descript) ns_tq; /* Write gather lists */
|
|
|
|
LIST_HEAD(, nfsuid) ns_uidhashtbl[NFS_UIDHASHSIZ];
|
|
|
|
LIST_HEAD(nfsrvw_delayhash, nfsrv_descript) ns_wdelayhashtbl[NFS_WDELAYHASHSIZ];
|
1994-06-08 15:33:09 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Bits for "ns_flag" */
|
|
|
|
#define SLP_VALID 0x01
|
2006-01-03 14:41:03 +03:00
|
|
|
#define SLP_DOREC 0x02 /* on nfssvc_sockpending queue */
|
1994-06-08 15:33:09 +04:00
|
|
|
#define SLP_NEEDQ 0x04
|
|
|
|
#define SLP_DISCONN 0x08
|
2006-01-03 14:41:03 +03:00
|
|
|
#define SLP_BUSY 0x10
|
|
|
|
#define SLP_LASTFRAG 0x40
|
2006-01-03 15:30:01 +03:00
|
|
|
#define SLP_SENDING 0x80
|
1993-04-20 15:20:47 +04:00
|
|
|
|
2002-05-13 03:04:35 +04:00
|
|
|
extern TAILQ_HEAD(nfssvc_sockhead, nfssvc_sock) nfssvc_sockhead;
|
2003-06-25 18:37:50 +04:00
|
|
|
extern struct nfssvc_sockhead nfssvc_sockpending;
|
2002-05-13 03:04:35 +04:00
|
|
|
extern int nfssvc_sockhead_flag;
|
1994-08-17 18:43:47 +04:00
|
|
|
#define SLP_INIT 0x01
|
|
|
|
|
1993-04-20 15:20:47 +04:00
|
|
|
/*
|
1994-06-08 15:33:09 +04:00
|
|
|
* One of these structures is allocated for each nfsd.
|
1993-04-20 15:20:47 +04:00
|
|
|
*/
|
1994-06-08 15:33:09 +04:00
|
|
|
struct nfsd {
|
1996-02-18 14:53:36 +03:00
|
|
|
TAILQ_ENTRY(nfsd) nfsd_chain; /* List of all nfsd's */
|
2003-06-25 18:37:50 +04:00
|
|
|
SLIST_ENTRY(nfsd) nfsd_idle; /* List of idle nfsd's */
|
2007-06-01 15:56:03 +04:00
|
|
|
kcondvar_t nfsd_cv;
|
1996-02-18 14:53:36 +03:00
|
|
|
int nfsd_flag; /* NFSD_ flags */
|
|
|
|
struct nfssvc_sock *nfsd_slp; /* Current socket */
|
|
|
|
int nfsd_authlen; /* Authenticator len */
|
|
|
|
u_char nfsd_authstr[RPCAUTH_MAXSIZ]; /* Authenticator data */
|
|
|
|
int nfsd_verflen; /* and the Verifier */
|
|
|
|
u_char nfsd_verfstr[RPCVERF_MAXSIZ];
|
|
|
|
struct proc *nfsd_procp; /* Proc ptr */
|
|
|
|
struct nfsrv_descript *nfsd_nd; /* Associated nfsrv_descript */
|
1993-04-20 15:20:47 +04:00
|
|
|
};
|
|
|
|
|
1996-02-18 14:53:36 +03:00
|
|
|
/* Bits for "nfsd_flag" */
|
1994-08-17 18:43:47 +04:00
|
|
|
#define NFSD_NEEDAUTH 0x04
|
|
|
|
#define NFSD_AUTHFAIL 0x08
|
|
|
|
|
2006-09-02 16:40:36 +04:00
|
|
|
#define NFSD_MAXFHSIZE 64
|
|
|
|
typedef struct nfsrvfh {
|
|
|
|
size_t nsfh_size;
|
|
|
|
union {
|
|
|
|
fhandle_t u_fh;
|
|
|
|
uint8_t u_opaque[NFSD_MAXFHSIZE];
|
|
|
|
} nsfh_u;
|
|
|
|
} nfsrvfh_t;
|
|
|
|
#define NFSRVFH_SIZE(nsfh) ((nsfh)->nsfh_size)
|
2006-09-04 12:27:49 +04:00
|
|
|
#define NFSRVFH_DATA(nsfh) ((nsfh)->nsfh_u.u_opaque)
|
2006-09-02 16:40:36 +04:00
|
|
|
#define NFSRVFH_FHANDLE(nsfh) (&(nsfh)->nsfh_u.u_fh)
|
|
|
|
|
1996-02-18 14:53:36 +03:00
|
|
|
/*
|
|
|
|
* This structure is used by the server for describing each request.
|
|
|
|
* Some fields are used only when write request gathering is performed.
|
|
|
|
*/
|
|
|
|
struct nfsrv_descript {
|
|
|
|
u_quad_t nd_time; /* Write deadline (usec) */
|
|
|
|
off_t nd_off; /* Start byte offset */
|
|
|
|
off_t nd_eoff; /* and end byte offset */
|
|
|
|
LIST_ENTRY(nfsrv_descript) nd_hash; /* Hash list */
|
|
|
|
LIST_ENTRY(nfsrv_descript) nd_tq; /* and timer list */
|
|
|
|
LIST_HEAD(,nfsrv_descript) nd_coalesce; /* coalesced writes */
|
2006-01-03 15:30:01 +03:00
|
|
|
SIMPLEQ_ENTRY(nfsrv_descript) nd_sendq; /* send reply list */
|
1996-02-18 14:53:36 +03:00
|
|
|
struct mbuf *nd_mrep; /* Request mbuf list */
|
|
|
|
struct mbuf *nd_md; /* Current dissect mbuf */
|
|
|
|
struct mbuf *nd_mreq; /* Reply mbuf list */
|
|
|
|
struct mbuf *nd_nam; /* and socket addr */
|
|
|
|
struct mbuf *nd_nam2; /* return socket addr */
|
2007-03-04 08:59:00 +03:00
|
|
|
void * nd_dpos; /* Current dissect pos */
|
1997-05-13 03:36:04 +04:00
|
|
|
u_int32_t nd_procnum; /* RPC # */
|
1996-02-18 14:53:36 +03:00
|
|
|
int nd_stable; /* storage type */
|
|
|
|
int nd_flag; /* nd_flag */
|
|
|
|
int nd_len; /* Length of this write */
|
|
|
|
int nd_repstat; /* Reply status */
|
|
|
|
u_int32_t nd_retxid; /* Reply xid */
|
|
|
|
u_int32_t nd_duration; /* Lease duration */
|
|
|
|
struct timeval nd_starttime; /* Time RPC initiated */
|
2006-09-02 16:40:36 +04:00
|
|
|
nfsrvfh_t nd_fh; /* File handle */
|
2006-05-15 01:31:52 +04:00
|
|
|
kauth_cred_t nd_cr; /* Credentials */
|
1996-02-18 14:53:36 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Bits for "nd_flag" */
|
|
|
|
#define ND_READ LEASE_READ
|
|
|
|
#define ND_WRITE LEASE_WRITE
|
|
|
|
#define ND_CHECK 0x04
|
|
|
|
#define ND_LEASE (ND_READ | ND_WRITE | ND_CHECK)
|
|
|
|
#define ND_NFSV3 0x08
|
|
|
|
#define ND_KERBNICK 0x20
|
|
|
|
#define ND_KERBFULL 0x40
|
|
|
|
#define ND_KERBAUTH (ND_KERBNICK | ND_KERBFULL)
|
|
|
|
|
2007-06-01 15:56:03 +04:00
|
|
|
extern kmutex_t nfsd_lock;
|
|
|
|
extern kcondvar_t nfsd_initcv;
|
2002-05-13 03:04:35 +04:00
|
|
|
extern TAILQ_HEAD(nfsdhead, nfsd) nfsd_head;
|
2003-06-25 18:37:50 +04:00
|
|
|
extern SLIST_HEAD(nfsdidlehead, nfsd) nfsd_idle_head;
|
2002-05-13 03:04:35 +04:00
|
|
|
extern int nfsd_head_flag;
|
1994-08-17 18:43:47 +04:00
|
|
|
#define NFSD_CHECKSLP 0x01
|
|
|
|
|
2003-02-26 09:31:08 +03:00
|
|
|
extern struct mowner nfs_mowner;
|
2002-05-13 03:04:35 +04:00
|
|
|
extern struct nfsstats nfsstats;
|
|
|
|
extern int nfs_numasync;
|
|
|
|
|
1996-02-18 14:53:36 +03:00
|
|
|
/*
|
|
|
|
* These macros compare nfsrv_descript structures.
|
|
|
|
*/
|
|
|
|
#define NFSW_CONTIG(o, n) \
|
|
|
|
((o)->nd_eoff >= (n)->nd_off && \
|
2007-03-04 08:59:00 +03:00
|
|
|
!memcmp((void *)&(o)->nd_fh, (void *)&(n)->nd_fh, NFSX_V3FH))
|
1996-02-18 14:53:36 +03:00
|
|
|
|
1997-06-25 03:28:15 +04:00
|
|
|
/*
|
|
|
|
* Defines for WebNFS
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define WEBNFS_ESC_CHAR '%'
|
|
|
|
#define WEBNFS_SPECCHAR_START 0x80
|
|
|
|
|
|
|
|
#define WEBNFS_NATIVE_CHAR 0x80
|
|
|
|
/*
|
|
|
|
* ..
|
|
|
|
* Possibly more here in the future.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Macro for converting escape characters in WebNFS pathnames.
|
|
|
|
* Should really be in libkern.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define HEXTOC(c) \
|
|
|
|
((c) >= 'a' ? ((c) - ('a' - 10)) : \
|
|
|
|
((c) >= 'A' ? ((c) - ('A' - 10)) : ((c) - '0')))
|
|
|
|
#define HEXSTRTOI(p) \
|
|
|
|
((HEXTOC(p[0]) << 4) + HEXTOC(p[1]))
|
Apply the NFS exports list rototill patch:
- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.
Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.
2005-09-23 16:10:31 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure holding information for a publicly exported filesystem
|
|
|
|
* (WebNFS). Currently the specs allow just for one such filesystem.
|
|
|
|
*/
|
|
|
|
struct nfs_public {
|
|
|
|
int np_valid; /* Do we hold valid information */
|
2006-07-13 16:00:24 +04:00
|
|
|
fhandle_t *np_handle; /* Filehandle for pub fs (internal) */
|
Apply the NFS exports list rototill patch:
- Remove all NFS related stuff from file system specific code.
- Drop the vfs_checkexp hook and generalize it in the new nfs_check_export
function, thus removing redundancy from all file systems.
- Move all NFS export-related stuff from kern/vfs_subr.c to the new
file sys/nfs/nfs_export.c. The former was becoming large and its code
is always compiled, regardless of the build options. Using the latter,
the code is only compiled in when NFSSERVER is enabled. While doing this,
also make some functions in nfs_subs.c conditional to NFSSERVER.
- Add a new command in nfssvc(2), called NFSSVC_SETEXPORTSLIST, that takes a
path and a set of export entries. At the moment it can only clear the
exports list or append entries, one by one, but it is done in a way that
allows setting the whole set of entries atomically in the future (see the
comment in mountd_set_exports_list or in doc/TODO).
- Change mountd(8) to use the nfssvc(2) system call instead of mount(2) so
that it becomes file system agnostic. In fact, all this whole thing was
done to remove a 'XXX' block from this utility!
- Change the mount*, newfs and fsck* userland utilities to not deal with NFS
exports initialization; done internally by the kernel when initializing
the NFS support for each file system.
- Implement an interface for VFS (called VFS hooks) so that several kernel
subsystems can run arbitrary code upon receipt of specific VFS events.
At the moment, this only provides support for unmount and is used to
destroy NFS exports lists from the file systems being unmounted, though it
has room for extension.
Thanks go to yamt@, chs@, thorpej@, wrstuden@ and others for their comments
and advice in the development of this patch.
2005-09-23 16:10:31 +04:00
|
|
|
struct mount *np_mount; /* Mountpoint of exported fs */
|
|
|
|
char *np_index; /* Index file */
|
|
|
|
};
|
1995-03-27 00:35:13 +04:00
|
|
|
#endif /* _KERNEL */
|
1996-02-18 14:53:36 +03:00
|
|
|
|
|
|
|
#endif /* _NFS_NFS_H */
|