Implement fs.nfs MIB variables.

This commit is contained in:
Garrett Wollman 1994-10-23 23:26:18 +00:00
parent 07e532e7d6
commit b43e29afed
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=3820
8 changed files with 172 additions and 14 deletions

View File

@ -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_
@ -155,6 +155,16 @@ struct nfsstats {
#define NFSSVC_AUTHINFAIL 0x080
#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
@ -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

View File

@ -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 <sys/param.h>
@ -66,6 +66,10 @@
#include <nfs/nfsdiskless.h>
#include <nfs/nqnfs.h>
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;
}
}

View File

@ -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_
@ -155,6 +155,16 @@ struct nfsstats {
#define NFSSVC_AUTHINFAIL 0x080
#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
@ -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

View File

@ -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 <sys/param.h>
@ -66,6 +66,10 @@
#include <nfs/nfsdiskless.h>
#include <nfs/nqnfs.h>
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;
}
}

View File

@ -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_
@ -155,6 +155,16 @@ struct nfsstats {
#define NFSSVC_AUTHINFAIL 0x080
#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
@ -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

View File

@ -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_
@ -155,6 +155,16 @@ struct nfsstats {
#define NFSSVC_AUTHINFAIL 0x080
#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
@ -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

View File

@ -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_
@ -155,6 +155,16 @@ struct nfsstats {
#define NFSSVC_AUTHINFAIL 0x080
#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
@ -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

View File

@ -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_
@ -155,6 +155,16 @@ struct nfsstats {
#define NFSSVC_AUTHINFAIL 0x080
#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
@ -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