From a9f28ccb91ab50e877abb29ad84b5d50562048bb Mon Sep 17 00:00:00 2001 From: wollman Date: Sun, 23 Oct 1994 23:26:18 +0000 Subject: Implement fs.nfs MIB variables. --- sys/nfs/nfs.h | 14 ++++++++++++-- sys/nfs/nfs_vfsops.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 3 deletions(-) (limited to 'sys/nfs') diff --git a/sys/nfs/nfs.h b/sys/nfs/nfs.h index c79eefb..e77353f 100644 --- a/sys/nfs/nfs.h +++ b/sys/nfs/nfs.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs.h 8.1 (Berkeley) 6/10/93 - * $Id: nfs.h,v 1.5 1994/10/02 17:26:54 phk Exp $ + * $Id: nfs.h,v 1.6 1994/10/17 17:47:30 phk Exp $ */ #ifndef _NFS_NFS_H_ @@ -156,6 +156,16 @@ struct nfsstats { #define NFSSVC_MNTD 0x100 /* + * fs.nfs sysctl(3) identifiers + */ +#define NFS_NFSSTATS 1 /* struct: struct nfsstats */ + +#define FS_NFS_NAMES { \ + { 0, 0 }, \ + { "nfsstats", CTLTYPE_STRUCT }, \ +} + +/* * 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 @@ -211,7 +221,7 @@ TAILQ_HEAD(, nfsreq) nfs_reqq; #define R_MUSTRESEND 0x40 /* Must resend request */ #define R_GETONEREP 0x80 /* Probe for one reply only */ -struct nfsstats nfsstats; +extern struct nfsstats nfsstats; /* * A list of nfssvc_sock structures is maintained with all the sockets diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index 5e7bd7d..5d7d9c4 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vfsops.c 8.3 (Berkeley) 1/4/94 - * $Id: nfs_vfsops.c,v 1.6 1994/10/17 17:47:39 phk Exp $ + * $Id: nfs_vfsops.c,v 1.7 1994/10/22 17:52:59 phk Exp $ */ #include @@ -66,6 +66,10 @@ #include #include +struct nfsstats nfsstats; +static int nfs_sysctl(int *, u_int, void *, size_t *, void *, size_t, + struct proc *); + /* * nfs vfs operations. */ @@ -81,6 +85,7 @@ struct vfsops nfs_vfsops = { nfs_fhtovp, nfs_vptofh, nfs_init, + nfs_sysctl }; VFS_SET(nfs_vfsops, nfs, MOUNT_NFS, 0); @@ -772,3 +777,47 @@ nfs_quotactl(mp, cmd, uid, arg, p) return (EOPNOTSUPP); } + +/* + * Do that sysctl thang... + */ +static int +nfs_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, + size_t newlen, struct proc *p) +{ + int rv; + + /* + * All names at this level are terminal. + */ + if(namelen > 1) + return ENOTDIR; /* overloaded */ + + switch(name[0]) { + case NFS_NFSSTATS: + if(!oldp) { + *oldlenp = sizeof nfsstats; + return 0; + } + + if(*oldlenp < sizeof nfsstats) { + *oldlenp = sizeof nfsstats; + return ENOMEM; + } + + rv = copyout(&nfsstats, oldp, sizeof nfsstats); + if(rv) return rv; + + if(newp && newlen != sizeof nfsstats) + return EINVAL; + + if(newp) { + return copyin(newp, &nfsstats, sizeof nfsstats); + } + return 0; + + default: + return EOPNOTSUPP; + } +} + -- cgit v1.1