1994-05-24 10:09:53 +00:00
|
|
|
/*
|
1997-02-10 02:22:35 +00:00
|
|
|
* Copyright (c) 1989, 1993, 1995
|
1994-05-24 10:09:53 +00:00
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
1997-02-10 02:22:35 +00:00
|
|
|
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
|
1999-08-28 01:08:13 +00:00
|
|
|
* $FreeBSD$
|
1994-05-24 10:09:53 +00:00
|
|
|
*/
|
|
|
|
|
1994-08-21 06:50:16 +00:00
|
|
|
#ifndef _NFS_NFS_H_
|
|
|
|
#define _NFS_NFS_H_
|
|
|
|
|
1998-06-30 11:19:22 +00:00
|
|
|
#ifdef KERNEL
|
1998-06-30 03:01:37 +00:00
|
|
|
#include "opt_nfs.h"
|
1998-06-30 11:19:22 +00:00
|
|
|
#endif
|
1998-06-30 03:01:37 +00:00
|
|
|
|
1994-05-24 10:09:53 +00:00
|
|
|
/*
|
|
|
|
* Tunable constants for nfs
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define NFS_MAXIOVEC 34
|
1995-06-27 11:07:30 +00:00
|
|
|
#define NFS_TICKINTVL 5 /* Desired time for a tick (msec) */
|
|
|
|
#define NFS_HZ (hz / nfs_ticks) /* Ticks/sec */
|
|
|
|
#define NFS_TIMEO (1 * NFS_HZ) /* Default timeout = 1 second */
|
|
|
|
#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*/
|
1994-05-24 10:09:53 +00: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 */
|
|
|
|
#define NFS_MAXGRPS 16 /* Max. size of groups list */
|
1994-08-04 06:03:46 +00:00
|
|
|
#ifndef NFS_MINATTRTIMO
|
1998-05-19 07:11:27 +00:00
|
|
|
#define NFS_MINATTRTIMO 3 /* VREG attrib cache timeout in sec */
|
1994-08-04 06:03:46 +00:00
|
|
|
#endif
|
|
|
|
#ifndef NFS_MAXATTRTIMO
|
1994-05-24 10:09:53 +00:00
|
|
|
#define NFS_MAXATTRTIMO 60
|
1994-08-04 06:03:46 +00:00
|
|
|
#endif
|
1998-05-19 07:11:27 +00:00
|
|
|
#ifndef NFS_MINDIRATTRTIMO
|
|
|
|
#define NFS_MINDIRATTRTIMO 30 /* VDIR attrib cache timeout in sec */
|
|
|
|
#endif
|
|
|
|
#ifndef NFS_MAXDIRATTRTIMO
|
|
|
|
#define NFS_MAXDIRATTRTIMO 60
|
|
|
|
#endif
|
1994-05-24 10:09:53 +00:00
|
|
|
#define NFS_WSIZE 8192 /* Def. write data size <= 8192 */
|
|
|
|
#define NFS_RSIZE 8192 /* Def. read data size <= 8192 */
|
1995-06-27 11:07:30 +00:00
|
|
|
#define NFS_READDIRSIZE 8192 /* Def. readdir size */
|
1994-05-24 10:09:53 +00:00
|
|
|
#define NFS_DEFRAHEAD 1 /* Def. read ahead # blocks */
|
|
|
|
#define NFS_MAXRAHEAD 4 /* Max. read ahead # blocks */
|
|
|
|
#define NFS_MAXUIDHASH 64 /* Max. # of hashed uid entries/mp */
|
1997-03-29 12:34:33 +00:00
|
|
|
#define NFS_MAXASYNCDAEMON 20 /* Max. number async_daemons runnable */
|
1995-06-27 11:07:30 +00:00
|
|
|
#define NFS_MAXGATHERDELAY 100 /* Max. write gather delay (msec) */
|
|
|
|
#ifndef NFS_GATHERDELAY
|
|
|
|
#define NFS_GATHERDELAY 10 /* Default write gather delay (msec) */
|
|
|
|
#endif
|
|
|
|
#define NFS_DIRBLKSIZ 4096 /* Must be a multiple of DIRBLKSIZ */
|
1997-03-29 12:34:33 +00:00
|
|
|
#ifdef KERNEL
|
|
|
|
#define DIRBLKSIZ 512 /* XXX we used to use ufs's DIRBLKSIZ */
|
|
|
|
#endif
|
1995-06-27 11:07:30 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Oddballs
|
|
|
|
*/
|
1994-05-24 10:09:53 +00:00
|
|
|
#define NMOD(a) ((a) % nfs_asyncdaemons)
|
1995-06-27 11:07:30 +00:00
|
|
|
#define NFS_CMPFH(n, f, s) \
|
|
|
|
((n)->n_fhsize == (s) && !bcmp((caddr_t)(n)->n_fhp, (caddr_t)(f), (s)))
|
|
|
|
#define NFS_ISV3(v) (VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3)
|
|
|
|
#define NFS_SRVMAXDATA(n) \
|
|
|
|
(((n)->nd_flag & ND_NFSV3) ? (((n)->nd_nam2) ? \
|
|
|
|
NFS_MAXDGRAMDATA : NFS_MAXDATA) : NFS_V2MAXDATA)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* XXX
|
|
|
|
* The B_INVAFTERWRITE flag should be set to whatever is required by the
|
|
|
|
* buffer cache code to say "Invalidate the block after it is written back".
|
|
|
|
*/
|
|
|
|
#define B_INVAFTERWRITE B_NOCACHE
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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
|
1994-05-24 10:09:53 +00:00
|
|
|
|
1995-06-27 11:07:30 +00:00
|
|
|
/*
|
|
|
|
* Expected allocation sizes for major data structures. If the actual size
|
|
|
|
* of the structure exceeds these sizes, then malloc() will be allocating
|
|
|
|
* almost twice the memory required. This is used in nfs_init() to warn
|
|
|
|
* the sysadmin that the size of a structure should be reduced.
|
|
|
|
* (These sizes are always a power of 2. If the kernel malloc() changes
|
|
|
|
* to one that does not allocate space in powers of 2 size, then this all
|
|
|
|
* becomes bunk!)
|
|
|
|
*/
|
|
|
|
#define NFS_SVCALLOC 256
|
|
|
|
#define NFS_UIDALLOC 128
|
|
|
|
|
1997-02-10 02:22:35 +00:00
|
|
|
/*
|
|
|
|
* Arguments to mount NFS
|
|
|
|
*/
|
|
|
|
#define NFS_ARGSVERSION 3 /* change when nfs_args changes */
|
|
|
|
struct nfs_args {
|
|
|
|
int version; /* args structure version number */
|
|
|
|
struct sockaddr *addr; /* file server address */
|
|
|
|
int addrlen; /* length of address */
|
|
|
|
int sotype; /* Socket type */
|
|
|
|
int proto; /* and Protocol */
|
|
|
|
u_char *fh; /* File handle to be mounted */
|
|
|
|
int fhsize; /* Size, in bytes, of fh */
|
|
|
|
int flags; /* flags */
|
|
|
|
int wsize; /* write size in bytes */
|
|
|
|
int rsize; /* read size in bytes */
|
|
|
|
int readdirsize; /* readdir size in bytes */
|
|
|
|
int timeo; /* initial timeout in .1 secs */
|
|
|
|
int retrans; /* times to retry send */
|
|
|
|
int maxgrouplist; /* Max. size of group list */
|
|
|
|
int readahead; /* # of blocks to readahead */
|
|
|
|
int leaseterm; /* Term (sec) of lease */
|
|
|
|
int deadthresh; /* Retrans threshold */
|
|
|
|
char *hostname; /* server's name */
|
1998-05-19 07:11:27 +00:00
|
|
|
int acregmin; /* cache attrs for reg files min time */
|
|
|
|
int acregmax; /* cache attrs for reg files max time */
|
|
|
|
int acdirmin; /* cache attrs for dirs min time */
|
|
|
|
int acdirmax; /* cache attrs for dirs max time */
|
1997-02-10 02:22:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* NFS mount option flags
|
|
|
|
*/
|
|
|
|
#define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */
|
|
|
|
#define NFSMNT_WSIZE 0x00000002 /* set write size */
|
|
|
|
#define NFSMNT_RSIZE 0x00000004 /* set read size */
|
|
|
|
#define NFSMNT_TIMEO 0x00000008 /* set initial timeout */
|
|
|
|
#define NFSMNT_RETRANS 0x00000010 /* set number of request retries */
|
|
|
|
#define NFSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */
|
|
|
|
#define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */
|
|
|
|
#define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */
|
|
|
|
#define NFSMNT_NQNFS 0x00000100 /* Use Nqnfs protocol */
|
|
|
|
#define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */
|
|
|
|
#define NFSMNT_KERB 0x00000400 /* Use Kerberos authentication */
|
|
|
|
#define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */
|
|
|
|
#define NFSMNT_LEASETERM 0x00001000 /* set lease term (nqnfs) */
|
|
|
|
#define NFSMNT_READAHEAD 0x00002000 /* set read ahead */
|
|
|
|
#define NFSMNT_DEADTHRESH 0x00004000 /* set dead server retry thresh */
|
|
|
|
#define NFSMNT_RESVPORT 0x00008000 /* Allocate a reserved port */
|
|
|
|
#define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */
|
|
|
|
#define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */
|
1998-05-19 07:11:27 +00:00
|
|
|
#define NFSMNT_ACREGMIN 0x00040000
|
|
|
|
#define NFSMNT_ACREGMAX 0x00080000
|
|
|
|
#define NFSMNT_ACDIRMIN 0x00100000
|
|
|
|
#define NFSMNT_ACDIRMAX 0x00200000
|
|
|
|
|
|
|
|
#define NFSSTA_HASWRITEVERF 0x00040000 /* Has write verifier for V3 */
|
|
|
|
#define NFSSTA_GOTPATHCONF 0x00080000 /* Got the V3 pathconf info */
|
|
|
|
#define NFSSTA_GOTFSINFO 0x00100000 /* Got the V3 fsinfo */
|
|
|
|
#define NFSSTA_MNTD 0x00200000 /* Mnt server for mnt point */
|
|
|
|
#define NFSSTA_DISMINPROG 0x00400000 /* Dismount in progress */
|
|
|
|
#define NFSSTA_DISMNT 0x00800000 /* Dismounted */
|
|
|
|
#define NFSSTA_SNDLOCK 0x01000000 /* Send socket lock */
|
|
|
|
#define NFSSTA_WANTSND 0x02000000 /* Want above */
|
|
|
|
#define NFSSTA_RCVLOCK 0x04000000 /* Rcv socket lock */
|
|
|
|
#define NFSSTA_WANTRCV 0x08000000 /* Want above */
|
|
|
|
#define NFSSTA_WAITAUTH 0x10000000 /* Wait for authentication */
|
|
|
|
#define NFSSTA_HASAUTH 0x20000000 /* Has authenticator */
|
|
|
|
#define NFSSTA_WANTAUTH 0x40000000 /* Wants an authenticator */
|
|
|
|
#define NFSSTA_AUTHERR 0x80000000 /* Authentication error */
|
1997-02-10 02:22:35 +00:00
|
|
|
|
1994-05-24 10:09:53 +00:00
|
|
|
/*
|
|
|
|
* Structures for the nfssvc(2) syscall. Not that anyone but nfsd and mount_nfs
|
|
|
|
* should ever try and use it.
|
|
|
|
*/
|
|
|
|
struct nfsd_args {
|
|
|
|
int sock; /* Socket to serve */
|
1997-02-10 02:22:35 +00:00
|
|
|
caddr_t name; /* Client addr for connection based sockets */
|
1994-05-24 10:09:53 +00: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 */
|
1998-05-31 20:09:01 +00:00
|
|
|
u_int32_t nsd_haddr; /* Ip address of client */
|
1994-05-24 10:09:53 +00:00
|
|
|
struct ucred nsd_cr; /* Cred. uid maps to */
|
|
|
|
int nsd_authlen; /* Length of auth string (ret) */
|
1995-06-27 11:07:30 +00: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 */
|
1998-05-31 20:09:01 +00:00
|
|
|
u_int32_t nsd_ttl; /* credential ttl (sec) */
|
1995-06-27 11:07:30 +00:00
|
|
|
NFSKERBKEY_T nsd_key; /* Session key */
|
1994-05-24 10:09:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct nfsd_cargs {
|
|
|
|
char *ncd_dirp; /* Mount dir path */
|
|
|
|
uid_t ncd_authuid; /* Effective uid */
|
|
|
|
int ncd_authtype; /* Type of authenticator */
|
|
|
|
int ncd_authlen; /* Length of authenticator string */
|
1995-06-27 11:07:30 +00:00
|
|
|
u_char *ncd_authstr; /* Authenticator string */
|
|
|
|
int ncd_verflen; /* and the verifier */
|
|
|
|
u_char *ncd_verfstr;
|
|
|
|
NFSKERBKEY_T ncd_key; /* Session key */
|
1994-05-24 10:09:53 +00:00
|
|
|
};
|
|
|
|
|
1997-02-10 02:22:35 +00:00
|
|
|
/*
|
|
|
|
* XXX to allow amd to include nfs.h without nfsproto.h
|
|
|
|
*/
|
|
|
|
#ifdef NFS_NPROCS
|
1994-05-24 10:09:53 +00: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;
|
|
|
|
int rpccnt[NFS_NPROCS];
|
|
|
|
int rpcretries;
|
|
|
|
int srvrpccnt[NFS_NPROCS];
|
|
|
|
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;
|
|
|
|
int srvnqnfs_leases;
|
|
|
|
int srvnqnfs_maxleases;
|
|
|
|
int srvnqnfs_getleases;
|
1995-06-27 11:07:30 +00:00
|
|
|
int srvvop_writes;
|
1994-05-24 10:09:53 +00:00
|
|
|
};
|
1997-02-10 02:22:35 +00:00
|
|
|
#endif
|
1994-05-24 10:09:53 +00: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
|
|
|
|
|
1994-10-23 23:26:18 +00:00
|
|
|
/*
|
|
|
|
* fs.nfs sysctl(3) identifiers
|
|
|
|
*/
|
|
|
|
#define NFS_NFSSTATS 1 /* struct: struct nfsstats */
|
1997-03-27 20:01:07 +00:00
|
|
|
#define NFS_NFSPRIVPORT 2 /* int: prohibit nfs to resvports */
|
1994-10-23 23:26:18 +00:00
|
|
|
|
|
|
|
#define FS_NFS_NAMES { \
|
|
|
|
{ 0, 0 }, \
|
|
|
|
{ "nfsstats", CTLTYPE_STRUCT }, \
|
1997-03-27 20:01:07 +00:00
|
|
|
{ "nfsprivport", CTLTYPE_INT }, \
|
1994-10-23 23:26:18 +00:00
|
|
|
}
|
|
|
|
|
1997-02-10 02:22:35 +00:00
|
|
|
#ifdef KERNEL
|
1994-11-02 00:11:00 +00:00
|
|
|
|
1997-10-12 20:26:33 +00:00
|
|
|
#ifdef MALLOC_DECLARE
|
|
|
|
MALLOC_DECLARE(M_NFSREQ);
|
|
|
|
MALLOC_DECLARE(M_NFSDIROFF);
|
|
|
|
MALLOC_DECLARE(M_NFSRVDESC);
|
|
|
|
MALLOC_DECLARE(M_NFSUID);
|
|
|
|
MALLOC_DECLARE(M_NQLEASE);
|
|
|
|
MALLOC_DECLARE(M_NFSD);
|
|
|
|
MALLOC_DECLARE(M_NFSBIGFH);
|
1998-05-24 14:41:56 +00:00
|
|
|
MALLOC_DECLARE(M_NFSHASH);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ZONE_INTERRUPT
|
|
|
|
extern vm_zone_t nfsmount_zone;
|
1997-10-12 20:26:33 +00:00
|
|
|
#endif
|
|
|
|
|
1998-09-07 05:42:15 +00:00
|
|
|
extern struct callout_handle nfs_timer_handle;
|
|
|
|
|
1994-11-02 00:11:00 +00:00
|
|
|
struct uio; struct buf; struct vattr; struct nameidata; /* XXX */
|
|
|
|
|
1998-02-01 21:23:29 +00: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.
|
|
|
|
*/
|
1994-05-24 10:09:53 +00:00
|
|
|
#define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
|
|
|
|
sigmask(SIGHUP)|sigmask(SIGQUIT))
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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-10-17 17:47:45 +00:00
|
|
|
TAILQ_ENTRY(nfsreq) r_chain;
|
1994-05-24 10:09:53 +00:00
|
|
|
struct mbuf *r_mreq;
|
|
|
|
struct mbuf *r_mrep;
|
|
|
|
struct mbuf *r_md;
|
|
|
|
caddr_t r_dpos;
|
|
|
|
struct nfsmount *r_nmp;
|
|
|
|
struct vnode *r_vp;
|
1998-05-31 20:09:01 +00:00
|
|
|
u_int32_t r_xid;
|
1994-05-24 10:09:53 +00: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-06-03 17:22:47 +00:00
|
|
|
u_int32_t r_procnum; /* NFS procedure number */
|
1994-05-24 10:09:53 +00:00
|
|
|
int r_rtt; /* RTT for rpc */
|
|
|
|
struct proc *r_procp; /* Proc that did I/O system call */
|
|
|
|
};
|
|
|
|
|
1994-10-17 17:47:45 +00:00
|
|
|
/*
|
|
|
|
* Queue head for nfsreq's
|
|
|
|
*/
|
1995-07-29 11:44:31 +00:00
|
|
|
extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq;
|
1994-10-17 17:47:45 +00:00
|
|
|
|
1994-05-24 10:09:53 +00: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 */
|
|
|
|
#define R_GETONEREP 0x80 /* Probe for one reply only */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
1995-06-27 11:07:30 +00:00
|
|
|
#ifndef NFS_UIDHASHSIZ
|
|
|
|
#define NFS_UIDHASHSIZ 29 /* Tune the size of nfssvc_sock with this */
|
|
|
|
#endif
|
1994-10-17 17:47:45 +00:00
|
|
|
#define NUIDHASH(sock, uid) \
|
1995-06-27 11:07:30 +00:00
|
|
|
(&(sock)->ns_uidhashtbl[(uid) % NFS_UIDHASHSIZ])
|
|
|
|
#ifndef NFS_WDELAYHASHSIZ
|
|
|
|
#define NFS_WDELAYHASHSIZ 16 /* and with this */
|
|
|
|
#endif
|
|
|
|
#define NWDELAYHASH(sock, f) \
|
1998-05-31 20:09:01 +00:00
|
|
|
(&(sock)->ns_wdelayhashtbl[(*((u_int32_t *)(f))) % NFS_WDELAYHASHSIZ])
|
1995-06-27 11:07:30 +00:00
|
|
|
#ifndef NFS_MUIDHASHSIZ
|
1996-11-06 10:53:16 +00:00
|
|
|
#define NFS_MUIDHASHSIZ 63 /* Tune the size of nfsmount with this */
|
1995-06-27 11:07:30 +00:00
|
|
|
#endif
|
|
|
|
#define NMUIDHASH(nmp, uid) \
|
|
|
|
(&(nmp)->nm_uidhashtbl[(uid) % NFS_MUIDHASHSIZ])
|
|
|
|
#define NFSNOHASH(fhsum) \
|
|
|
|
(&nfsnodehashtbl[(fhsum) & nfsnodehash])
|
1994-05-24 10:09:53 +00:00
|
|
|
|
1998-05-31 17:27:58 +00:00
|
|
|
/*
|
|
|
|
* Network address hash list element
|
|
|
|
*/
|
|
|
|
union nethostaddr {
|
1998-05-31 20:09:01 +00:00
|
|
|
u_int32_t had_inetaddr;
|
1998-05-31 17:27:58 +00:00
|
|
|
struct sockaddr *had_nam;
|
|
|
|
};
|
|
|
|
|
1994-05-24 10:09:53 +00:00
|
|
|
struct nfsuid {
|
1994-10-17 17:47:45 +00:00
|
|
|
TAILQ_ENTRY(nfsuid) nu_lru; /* LRU chain */
|
|
|
|
LIST_ENTRY(nfsuid) nu_hash; /* Hash list */
|
1994-05-24 10:09:53 +00:00
|
|
|
int nu_flag; /* Flags */
|
|
|
|
union nethostaddr nu_haddr; /* Host addr. for dgram sockets */
|
|
|
|
struct ucred nu_cr; /* Cred uid mapped to */
|
1995-06-27 11:07:30 +00:00
|
|
|
int nu_expire; /* Expiry time (sec) */
|
|
|
|
struct timeval nu_timestamp; /* Kerb. timestamp */
|
1998-05-31 20:09:01 +00:00
|
|
|
u_int32_t nu_nickname; /* Nickname on server */
|
1995-06-27 11:07:30 +00:00
|
|
|
NFSKERBKEY_T nu_key; /* and session key */
|
1994-05-24 10:09:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define nu_inetaddr nu_haddr.had_inetaddr
|
|
|
|
#define nu_nam nu_haddr.had_nam
|
|
|
|
/* Bits for nu_flag */
|
|
|
|
#define NU_INETADDR 0x1
|
1995-06-27 11:07:30 +00:00
|
|
|
#define NU_NAM 0x2
|
|
|
|
#define NU_NETFAM(u) (((u)->nu_flag & NU_INETADDR) ? AF_INET : AF_ISO)
|
1994-05-24 10:09:53 +00:00
|
|
|
|
1997-05-13 17:25:44 +00:00
|
|
|
struct nfsrv_rec {
|
|
|
|
STAILQ_ENTRY(nfsrv_rec) nr_link;
|
1997-08-16 19:16:27 +00:00
|
|
|
struct sockaddr *nr_address;
|
1997-05-13 17:25:44 +00:00
|
|
|
struct mbuf *nr_packet;
|
|
|
|
};
|
|
|
|
|
1994-05-24 10:09:53 +00:00
|
|
|
struct nfssvc_sock {
|
1994-10-17 17:47:45 +00:00
|
|
|
TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */
|
|
|
|
TAILQ_HEAD(, nfsuid) ns_uidlruhead;
|
1994-05-24 10:09:53 +00:00
|
|
|
struct file *ns_fp;
|
|
|
|
struct socket *ns_so;
|
1997-08-16 19:16:27 +00:00
|
|
|
struct sockaddr *ns_nam;
|
1994-05-24 10:09:53 +00:00
|
|
|
struct mbuf *ns_raw;
|
|
|
|
struct mbuf *ns_rawend;
|
1997-05-13 17:25:44 +00:00
|
|
|
STAILQ_HEAD(, nfsrv_rec) ns_rec;
|
1995-06-27 11:07:30 +00:00
|
|
|
struct mbuf *ns_frag;
|
|
|
|
int ns_flag;
|
|
|
|
int ns_solock;
|
|
|
|
int ns_cc;
|
|
|
|
int ns_reclen;
|
1994-05-24 10:09:53 +00:00
|
|
|
int ns_numuids;
|
1998-05-31 20:09:01 +00:00
|
|
|
u_int32_t ns_sref;
|
1995-06-27 11:07:30 +00: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-05-24 10:09:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Bits for "ns_flag" */
|
|
|
|
#define SLP_VALID 0x01
|
|
|
|
#define SLP_DOREC 0x02
|
|
|
|
#define SLP_NEEDQ 0x04
|
|
|
|
#define SLP_DISCONN 0x08
|
|
|
|
#define SLP_GETSTREAM 0x10
|
1995-06-27 11:07:30 +00:00
|
|
|
#define SLP_LASTFRAG 0x20
|
1994-05-24 10:09:53 +00:00
|
|
|
#define SLP_ALLFLAGS 0xff
|
|
|
|
|
1995-07-29 11:44:31 +00:00
|
|
|
extern TAILQ_HEAD(nfssvc_sockhead, nfssvc_sock) nfssvc_sockhead;
|
|
|
|
extern int nfssvc_sockhead_flag;
|
1994-10-17 17:47:45 +00:00
|
|
|
#define SLP_INIT 0x01
|
|
|
|
#define SLP_WANTINIT 0x02
|
|
|
|
|
1994-05-24 10:09:53 +00:00
|
|
|
/*
|
|
|
|
* One of these structures is allocated for each nfsd.
|
|
|
|
*/
|
|
|
|
struct nfsd {
|
1995-06-27 11:07:30 +00:00
|
|
|
TAILQ_ENTRY(nfsd) nfsd_chain; /* List of all nfsd's */
|
|
|
|
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 */
|
1994-05-24 10:09:53 +00:00
|
|
|
};
|
|
|
|
|
1995-06-27 11:07:30 +00:00
|
|
|
/* Bits for "nfsd_flag" */
|
1994-05-24 10:09:53 +00:00
|
|
|
#define NFSD_WAITING 0x01
|
1994-10-17 17:47:45 +00:00
|
|
|
#define NFSD_REQINPROG 0x02
|
|
|
|
#define NFSD_NEEDAUTH 0x04
|
|
|
|
#define NFSD_AUTHFAIL 0x08
|
|
|
|
|
1995-06-27 11:07:30 +00: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 */
|
|
|
|
struct mbuf *nd_mrep; /* Request mbuf list */
|
|
|
|
struct mbuf *nd_md; /* Current dissect mbuf */
|
|
|
|
struct mbuf *nd_mreq; /* Reply mbuf list */
|
1997-08-16 19:16:27 +00:00
|
|
|
struct sockaddr *nd_nam; /* and socket addr */
|
|
|
|
struct sockaddr *nd_nam2; /* return socket addr */
|
1995-06-27 11:07:30 +00:00
|
|
|
caddr_t nd_dpos; /* Current dissect pos */
|
1997-06-03 17:22:47 +00:00
|
|
|
u_int32_t nd_procnum; /* RPC # */
|
1995-06-27 11:07:30 +00:00
|
|
|
int nd_stable; /* storage type */
|
|
|
|
int nd_flag; /* nd_flag */
|
|
|
|
int nd_len; /* Length of this write */
|
|
|
|
int nd_repstat; /* Reply status */
|
1998-05-31 20:09:01 +00:00
|
|
|
u_int32_t nd_retxid; /* Reply xid */
|
|
|
|
u_int32_t nd_duration; /* Lease duration */
|
1995-06-27 11:07:30 +00:00
|
|
|
struct timeval nd_starttime; /* Time RPC initiated */
|
|
|
|
fhandle_t nd_fh; /* File handle */
|
|
|
|
struct ucred nd_cr; /* Credentials */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* 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_NQNFS 0x10
|
|
|
|
#define ND_KERBNICK 0x20
|
|
|
|
#define ND_KERBFULL 0x40
|
|
|
|
#define ND_KERBAUTH (ND_KERBNICK | ND_KERBFULL)
|
|
|
|
|
1995-07-29 11:44:31 +00:00
|
|
|
extern TAILQ_HEAD(nfsd_head, nfsd) nfsd_head;
|
|
|
|
extern int nfsd_head_flag;
|
1994-10-17 17:47:45 +00:00
|
|
|
#define NFSD_CHECKSLP 0x01
|
1994-10-02 17:27:07 +00:00
|
|
|
|
1995-06-27 11:07:30 +00:00
|
|
|
/*
|
|
|
|
* These macros compare nfsrv_descript structures.
|
|
|
|
*/
|
|
|
|
#define NFSW_CONTIG(o, n) \
|
|
|
|
((o)->nd_eoff >= (n)->nd_off && \
|
|
|
|
!bcmp((caddr_t)&(o)->nd_fh, (caddr_t)&(n)->nd_fh, NFSX_V3FH))
|
|
|
|
|
|
|
|
#define NFSW_SAMECRED(o, n) \
|
|
|
|
(((o)->nd_flag & ND_KERBAUTH) == ((n)->nd_flag & ND_KERBAUTH) && \
|
|
|
|
!bcmp((caddr_t)&(o)->nd_cr, (caddr_t)&(n)->nd_cr, \
|
|
|
|
sizeof (struct ucred)))
|
|
|
|
|
1997-07-16 09:06:30 +00: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]))
|
|
|
|
|
1997-05-10 16:12:03 +00:00
|
|
|
#ifdef NFS_DEBUG
|
|
|
|
|
|
|
|
extern int nfs_debug;
|
|
|
|
#define NFS_DEBUG_ASYNCIO 1 /* asynchronous i/o */
|
|
|
|
#define NFS_DEBUG_WG 2 /* server write gathering */
|
|
|
|
#define NFS_DEBUG_RC 4 /* server request caching */
|
|
|
|
|
|
|
|
#define NFS_DPF(cat, args) \
|
|
|
|
do { \
|
|
|
|
if (nfs_debug & NFS_DEBUG_##cat) printf args; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define NFS_DPF(cat, args)
|
|
|
|
|
|
|
|
#endif
|
1997-02-10 02:22:35 +00:00
|
|
|
|
1998-03-30 09:56:58 +00:00
|
|
|
u_quad_t nfs_curusec __P((void));
|
1997-02-10 02:22:35 +00:00
|
|
|
int nfs_init __P((struct vfsconf *vfsp));
|
1998-09-07 05:42:15 +00:00
|
|
|
int nfs_uninit __P((struct vfsconf *vfsp));
|
1994-10-02 17:27:07 +00:00
|
|
|
int nfs_reply __P((struct nfsreq *));
|
1995-06-27 11:07:30 +00:00
|
|
|
int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int));
|
1997-08-16 19:16:27 +00:00
|
|
|
int nfs_send __P((struct socket *, struct sockaddr *, struct mbuf *,
|
|
|
|
struct nfsreq *));
|
|
|
|
int nfs_rephead __P((int, struct nfsrv_descript *, struct nfssvc_sock *,
|
|
|
|
int, int, u_quad_t *, struct mbuf **, struct mbuf **,
|
|
|
|
caddr_t *));
|
1999-02-25 00:03:51 +00:00
|
|
|
int nfs_sndlock __P((struct nfsreq *));
|
|
|
|
void nfs_sndunlock __P((struct nfsreq *));
|
|
|
|
int nfs_slplock __P((struct nfssvc_sock *, int));
|
|
|
|
void nfs_slpunlock __P((struct nfssvc_sock *));
|
1997-08-16 19:16:27 +00:00
|
|
|
int nfs_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
|
|
|
|
int nfs_vinvalbuf __P((struct vnode *, int, struct ucred *, struct proc *,
|
|
|
|
int));
|
|
|
|
int nfs_readrpc __P((struct vnode *, struct uio *, struct ucred *));
|
|
|
|
int nfs_writerpc __P((struct vnode *, struct uio *, struct ucred *, int *,
|
|
|
|
int *));
|
|
|
|
int nfs_readdirrpc __P((struct vnode *, struct uio *, struct ucred *));
|
1999-05-06 20:00:34 +00:00
|
|
|
int nfs_asyncio __P((struct buf *, struct ucred *, struct proc *));
|
1997-08-16 19:16:27 +00:00
|
|
|
int nfs_doio __P((struct buf *, struct ucred *, struct proc *));
|
|
|
|
int nfs_readlinkrpc __P((struct vnode *, struct uio *, struct ucred *));
|
|
|
|
int nfs_sigintr __P((struct nfsmount *, struct nfsreq *, struct proc *));
|
|
|
|
int nfs_readdirplusrpc __P((struct vnode *, struct uio *, struct ucred *));
|
|
|
|
int nfsm_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
|
|
|
|
void nfsm_srvfattr __P((struct nfsrv_descript *, struct vattr *,
|
|
|
|
struct nfs_fattr *));
|
|
|
|
void nfsm_srvwcc __P((struct nfsrv_descript *, int, struct vattr *, int,
|
|
|
|
struct vattr *, struct mbuf **, char **));
|
|
|
|
void nfsm_srvpostopattr __P((struct nfsrv_descript *, int, struct vattr *,
|
|
|
|
struct mbuf **, char **));
|
|
|
|
int netaddr_match __P((int, union nethostaddr *, struct sockaddr *));
|
|
|
|
int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *,
|
|
|
|
struct ucred *, struct mbuf **, struct mbuf **,
|
|
|
|
caddr_t *));
|
|
|
|
int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *,
|
|
|
|
struct vattr *));
|
|
|
|
int nfs_namei __P((struct nameidata *, fhandle_t *, int,
|
|
|
|
struct nfssvc_sock *, struct sockaddr *, struct mbuf **,
|
|
|
|
caddr_t *, struct vnode **, struct proc *, int, int));
|
|
|
|
void nfsm_adj __P((struct mbuf *, int, int));
|
|
|
|
int nfsm_mbuftouio __P((struct mbuf **, struct uio *, int, caddr_t *));
|
1994-10-02 17:27:07 +00:00
|
|
|
void nfsrv_initcache __P((void));
|
1997-08-16 19:16:27 +00:00
|
|
|
int nfs_getauth __P((struct nfsmount *, struct nfsreq *, struct ucred *,
|
|
|
|
char **, int *, char *, int *, NFSKERBKEY_T));
|
|
|
|
int nfs_getnickauth __P((struct nfsmount *, struct ucred *, char **,
|
|
|
|
int *, char *, int));
|
|
|
|
int nfs_savenickauth __P((struct nfsmount *, struct ucred *, int,
|
|
|
|
NFSKERBKEY_T, struct mbuf **, char **,
|
|
|
|
struct mbuf *));
|
|
|
|
int nfs_adv __P((struct mbuf **, caddr_t *, int, int));
|
1994-10-02 17:27:07 +00:00
|
|
|
void nfs_nhinit __P((void));
|
|
|
|
void nfs_timer __P((void*));
|
1997-08-16 19:16:27 +00:00
|
|
|
u_long nfs_hash __P((nfsfh_t *, int));
|
|
|
|
int nfsrv_dorec __P((struct nfssvc_sock *, struct nfsd *,
|
|
|
|
struct nfsrv_descript **));
|
|
|
|
int nfsrv_getcache __P((struct nfsrv_descript *, struct nfssvc_sock *,
|
|
|
|
struct mbuf **));
|
|
|
|
void nfsrv_updatecache __P((struct nfsrv_descript *, int, struct mbuf *));
|
1997-02-10 02:22:35 +00:00
|
|
|
void nfsrv_cleancache __P((void));
|
1997-08-16 19:16:27 +00:00
|
|
|
int nfs_connect __P((struct nfsmount *, struct nfsreq *));
|
1997-02-10 02:22:35 +00:00
|
|
|
void nfs_disconnect __P((struct nfsmount *));
|
1998-05-31 19:49:31 +00:00
|
|
|
void nfs_safedisconnect __P((struct nfsmount *));
|
1997-08-16 19:16:27 +00:00
|
|
|
int nfs_getattrcache __P((struct vnode *, struct vattr *));
|
1998-05-31 17:48:07 +00:00
|
|
|
int nfsm_strtmbuf __P((struct mbuf **, char **, const char *, long));
|
The VFS/BIO subsystem contained a number of hacks in order to optimize
piecemeal, middle-of-file writes for NFS. These hacks have caused no
end of trouble, especially when combined with mmap(). I've removed
them. Instead, NFS will issue a read-before-write to fully
instantiate the struct buf containing the write. NFS does, however,
optimize piecemeal appends to files. For most common file operations,
you will not notice the difference. The sole remaining fragment in
the VFS/BIO system is b_dirtyoff/end, which NFS uses to avoid cache
coherency issues with read-merge-write style operations. NFS also
optimizes the write-covers-entire-buffer case by avoiding the
read-before-write. There is quite a bit of room for further
optimization in these areas.
The VM system marks pages fully-valid (AKA vm_page_t->valid =
VM_PAGE_BITS_ALL) in several places, most noteably in vm_fault. This
is not correct operation. The vm_pager_get_pages() code is now
responsible for marking VM pages all-valid. A number of VM helper
routines have been added to aid in zeroing-out the invalid portions of
a VM page prior to the page being marked all-valid. This operation is
necessary to properly support mmap(). The zeroing occurs most often
when dealing with file-EOF situations. Several bugs have been fixed
in the NFS subsystem, including bits handling file and directory EOF
situations and buf->b_flags consistancy issues relating to clearing
B_ERROR & B_INVAL, and handling B_DONE.
getblk() and allocbuf() have been rewritten. B_CACHE operation is now
formally defined in comments and more straightforward in
implementation. B_CACHE for VMIO buffers is based on the validity of
the backing store. B_CACHE for non-VMIO buffers is based simply on
whether the buffer is B_INVAL or not (B_CACHE set if B_INVAL clear,
and vise-versa). biodone() is now responsible for setting B_CACHE
when a successful read completes. B_CACHE is also set when a bdwrite()
is initiated and when a bwrite() is initiated. VFS VOP_BWRITE
routines (there are only two - nfs_bwrite() and bwrite()) are now
expected to set B_CACHE. This means that bowrite() and bawrite() also
set B_CACHE indirectly.
There are a number of places in the code which were previously using
buf->b_bufsize (which is DEV_BSIZE aligned) when they should have
been using buf->b_bcount. These have been fixed. getblk() now clears
B_DONE on return because the rest of the system is so bad about
dealing with B_DONE.
Major fixes to NFS/TCP have been made. A server-side bug could cause
requests to be lost by the server due to nfs_realign() overwriting
other rpc's in the same TCP mbuf chain. The server's kernel must be
recompiled to get the benefit of the fixes.
Submitted by: Matthew Dillon <dillon@apollo.backplane.com>
1999-05-02 23:57:16 +00:00
|
|
|
int nfs_bioread __P((struct vnode *, struct uio *, int, struct ucred *));
|
1997-08-16 19:16:27 +00:00
|
|
|
int nfsm_uiotombuf __P((struct uio *, struct mbuf **, int, caddr_t *));
|
1994-10-02 17:27:07 +00:00
|
|
|
void nfsrv_init __P((int));
|
1995-06-27 11:07:30 +00:00
|
|
|
void nfs_clearcommit __P((struct mount *));
|
|
|
|
int nfsrv_errmap __P((struct nfsrv_descript *, int));
|
1997-08-16 19:16:27 +00:00
|
|
|
void nfsrvw_sort __P((gid_t *, int));
|
|
|
|
void nfsrv_setcred __P((struct ucred *, struct ucred *));
|
1999-05-06 20:00:34 +00:00
|
|
|
int nfs_writebp __P((struct buf *, int, struct proc *));
|
1997-08-16 19:16:27 +00:00
|
|
|
int nfsrv_object_create __P((struct vnode *));
|
1995-12-03 10:03:12 +00:00
|
|
|
void nfsrv_wakenfsd __P((struct nfssvc_sock *slp));
|
1995-06-27 11:07:30 +00:00
|
|
|
int nfsrv_writegather __P((struct nfsrv_descript **, struct nfssvc_sock *,
|
|
|
|
struct proc *, struct mbuf **));
|
|
|
|
int nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *,
|
|
|
|
struct proc *p));
|
1995-02-14 06:22:18 +00:00
|
|
|
|
1997-08-16 19:16:27 +00:00
|
|
|
int nfsrv3_access __P((struct nfsrv_descript *nfsd,
|
|
|
|
struct nfssvc_sock *slp,
|
1995-12-03 10:03:12 +00:00
|
|
|
struct proc *procp, struct mbuf **mrq));
|
|
|
|
int nfsrv_commit __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
|
|
|
struct proc *procp, struct mbuf **mrq));
|
|
|
|
int nfsrv_create __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
|
|
|
struct proc *procp, struct mbuf **mrq));
|
1997-08-16 19:16:27 +00:00
|
|
|
int nfsrv_fhtovp __P((fhandle_t *, int, struct vnode **, struct ucred *,
|
|
|
|
struct nfssvc_sock *, struct sockaddr *, int *,
|
|
|
|
int, int));
|
1997-07-16 09:06:30 +00:00
|
|
|
int nfsrv_setpublicfs __P((struct mount *, struct netexport *,
|
|
|
|
struct export_args *));
|
|
|
|
int nfs_ispublicfh __P((fhandle_t *));
|
1995-12-03 10:03:12 +00:00
|
|
|
int nfsrv_fsinfo __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
|
|
|
struct proc *procp, struct mbuf **mrq));
|
|
|
|
int nfsrv_getattr __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
|
|
|
struct proc *procp, struct mbuf **mrq));
|
|
|
|
int nfsrv_link __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
|
|
|
struct proc *procp, struct mbuf **mrq));
|
|
|
|
int nfsrv_lookup __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
|
|
|
struct proc *procp, struct mbuf **mrq));
|
|
|
|
int nfsrv_mkdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
|
|
|
struct proc *procp, struct mbuf **mrq));
|
|
|
|
int nfsrv_mknod __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
|
|
|
struct proc *procp, struct mbuf **mrq));
|
|
|
|
int nfsrv_noop __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
|
|
|
struct proc *procp, struct mbuf **mrq));
|
|
|
|
int nfsrv_null __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
|
|
|
struct proc *procp, struct mbuf **mrq));
|
|
|
|
int nfsrv_pathconf __P((struct nfsrv_descript *nfsd,
|
|
|
|
struct nfssvc_sock *slp, struct proc *procp,
|
|
|
|
struct mbuf **mrq));
|
|
|
|
int nfsrv_read __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
|
|
|
struct proc *procp, struct mbuf **mrq));
|
1997-08-16 19:16:27 +00:00
|
|
|
int nfsrv_readdir __P((struct nfsrv_descript *nfsd,
|
|
|
|
struct nfssvc_sock *slp,
|
1995-12-03 10:03:12 +00:00
|
|
|
struct proc *procp, struct mbuf **mrq));
|
|
|
|
int nfsrv_readdirplus __P((struct nfsrv_descript *nfsd,
|
|
|
|
struct nfssvc_sock *slp, struct proc *procp,
|
|
|
|
struct mbuf **mrq));
|
|
|
|
int nfsrv_readlink __P((struct nfsrv_descript *nfsd,
|
|
|
|
struct nfssvc_sock *slp, struct proc *procp,
|
|
|
|
struct mbuf **mrq));
|
|
|
|
int nfsrv_remove __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
|
|
|
struct proc *procp, struct mbuf **mrq));
|
|
|
|
int nfsrv_rename __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
|
|
|
struct proc *procp, struct mbuf **mrq));
|
|
|
|
int nfsrv_rmdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
|
|
|
struct proc *procp, struct mbuf **mrq));
|
1997-08-16 19:16:27 +00:00
|
|
|
int nfsrv_setattr __P((struct nfsrv_descript *nfsd,
|
|
|
|
struct nfssvc_sock *slp,
|
1995-12-03 10:03:12 +00:00
|
|
|
struct proc *procp, struct mbuf **mrq));
|
1997-08-16 19:16:27 +00:00
|
|
|
int nfsrv_statfs __P((struct nfsrv_descript *nfsd,
|
|
|
|
struct nfssvc_sock *slp,
|
1995-12-03 10:03:12 +00:00
|
|
|
struct proc *procp, struct mbuf **mrq));
|
1997-08-16 19:16:27 +00:00
|
|
|
int nfsrv_symlink __P((struct nfsrv_descript *nfsd,
|
|
|
|
struct nfssvc_sock *slp,
|
1995-12-03 10:03:12 +00:00
|
|
|
struct proc *procp, struct mbuf **mrq));
|
|
|
|
int nfsrv_write __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
|
|
|
|
struct proc *procp, struct mbuf **mrq));
|
1998-08-23 03:07:17 +00:00
|
|
|
void nfsrv_rcv __P((struct socket *so, void *arg, int waitflag));
|
1997-02-10 02:22:35 +00:00
|
|
|
void nfsrv_slpderef __P((struct nfssvc_sock *slp));
|
1994-05-24 10:09:53 +00:00
|
|
|
#endif /* KERNEL */
|
1994-08-21 06:50:16 +00:00
|
|
|
|
|
|
|
#endif
|