version 1.211, 2003/12/01 18:53:10 |
version 1.212, 2003/12/04 19:38:24 |
Line 1997 printlockedvnodes() |
|
Line 1997 printlockedvnodes() |
|
#endif |
#endif |
|
|
/* |
/* |
|
* sysctl helper routine for vfs.generic.conf lookups. |
|
*/ |
|
#if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_44) |
|
static int |
|
sysctl_vfs_generic_conf(SYSCTLFN_ARGS) |
|
{ |
|
struct vfsconf vfc; |
|
extern const char * const mountcompatnames[]; |
|
extern int nmountcompatnames; |
|
struct sysctlnode node; |
|
struct vfsops *vfsp; |
|
u_int vfsnum; |
|
|
|
if (namelen != 1) |
|
return (ENOTDIR); |
|
vfsnum = name[0]; |
|
if (vfsnum >= nmountcompatnames || |
|
mountcompatnames[vfsnum] == NULL) |
|
return (EOPNOTSUPP); |
|
vfsp = vfs_getopsbyname(mountcompatnames[vfsnum]); |
|
if (vfsp == NULL) |
|
return (EOPNOTSUPP); |
|
|
|
vfc.vfc_vfsops = vfsp; |
|
strncpy(vfc.vfc_name, vfsp->vfs_name, MFSNAMELEN); |
|
vfc.vfc_typenum = vfsnum; |
|
vfc.vfc_refcount = vfsp->vfs_refcount; |
|
vfc.vfc_flags = 0; |
|
vfc.vfc_mountroot = vfsp->vfs_mountroot; |
|
vfc.vfc_next = NULL; |
|
|
|
node = *rnode; |
|
node.sysctl_data = &vfc; |
|
return (sysctl_lookup(SYSCTLFN_CALL(&node))); |
|
} |
|
#endif |
|
|
|
/* |
* Top level filesystem related information gathering. |
* Top level filesystem related information gathering. |
*/ |
*/ |
int |
SYSCTL_SETUP(sysctl_vfs_setup, "sysctl vfs subtree setup") |
vfs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) |
|
int *name; |
|
u_int namelen; |
|
void *oldp; |
|
size_t *oldlenp; |
|
void *newp; |
|
size_t newlen; |
|
struct proc *p; |
|
{ |
{ |
#if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_44) |
#if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_44) |
struct vfsconf vfc; |
|
extern const char * const mountcompatnames[]; |
|
extern int nmountcompatnames; |
extern int nmountcompatnames; |
#endif |
#endif |
struct vfsops *vfsp; |
|
|
|
/* all sysctl names at this level are at least name and field */ |
sysctl_createv(SYSCTL_PERMANENT, |
if (namelen < 2) |
CTLTYPE_NODE, "vfs", NULL, |
return (ENOTDIR); /* overloaded */ |
NULL, 0, NULL, 0, |
|
CTL_VFS, CTL_EOL); |
/* Not generic: goes to file system. */ |
sysctl_createv(SYSCTL_PERMANENT, |
if (name[0] != VFS_GENERIC) { |
CTLTYPE_NODE, "generic", NULL, |
static const struct ctlname vfsnames[VFS_MAXID+1]=CTL_VFS_NAMES; |
NULL, 0, NULL, 0, |
const char *vfsname; |
CTL_VFS, VFS_GENERIC, CTL_EOL); |
|
|
if (name[0] < 0 || name[0] > VFS_MAXID |
|
|| (vfsname = vfsnames[name[0]].ctl_name) == NULL) |
|
return (EOPNOTSUPP); |
|
|
|
vfsp = vfs_getopsbyname(vfsname); |
|
if (vfsp == NULL || vfsp->vfs_sysctl == NULL) |
|
return (EOPNOTSUPP); |
|
return ((*vfsp->vfs_sysctl)(&name[1], namelen - 1, |
|
oldp, oldlenp, newp, newlen, p)); |
|
} |
|
|
|
/* The rest are generic vfs sysctls. */ |
|
switch (name[1]) { |
|
case VFS_USERMOUNT: |
|
return sysctl_int(oldp, oldlenp, newp, newlen, &dovfsusermount); |
|
#if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_44) |
#if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_44) |
case VFS_MAXTYPENUM: |
sysctl_createv(SYSCTL_PERMANENT|SYSCTL_IMMEDIATE, |
/* |
CTLTYPE_INT, "maxtypenum", NULL, |
* Provided for 4.4BSD-Lite2 compatibility. |
NULL, nmountcompatnames, NULL, 0, |
*/ |
CTL_VFS, VFS_GENERIC, VFS_MAXTYPENUM, CTL_EOL); |
return (sysctl_rdint(oldp, oldlenp, newp, nmountcompatnames)); |
#endif |
case VFS_CONF: |
sysctl_createv(SYSCTL_PERMANENT|SYSCTL_READWRITE, |
/* |
CTLTYPE_INT, "usermount", NULL, |
* Special: a node, next is a file system name. |
NULL, 0, &dovfsusermount, 0, |
* Provided for 4.4BSD-Lite2 compatibility. |
CTL_VFS, VFS_GENERIC, VFS_USERMOUNT, CTL_EOL); |
*/ |
#if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_44) |
if (namelen < 3) |
sysctl_createv(SYSCTL_PERMANENT, |
return (ENOTDIR); /* overloaded */ |
CTLTYPE_STRUCT, "conf", NULL, |
if (name[2] >= nmountcompatnames || name[2] < 0 || |
sysctl_vfs_generic_conf, 0, NULL, |
mountcompatnames[name[2]] == NULL) |
sizeof(struct vfsconf), |
return (EOPNOTSUPP); |
CTL_VFS, VFS_GENERIC, VFS_CONF, CTL_EOL); |
vfsp = vfs_getopsbyname(mountcompatnames[name[2]]); |
|
if (vfsp == NULL) |
|
return (EOPNOTSUPP); |
|
vfc.vfc_vfsops = vfsp; |
|
strncpy(vfc.vfc_name, vfsp->vfs_name, MFSNAMELEN); |
|
vfc.vfc_typenum = name[2]; |
|
vfc.vfc_refcount = vfsp->vfs_refcount; |
|
vfc.vfc_flags = 0; |
|
vfc.vfc_mountroot = vfsp->vfs_mountroot; |
|
vfc.vfc_next = NULL; |
|
return (sysctl_rdstruct(oldp, oldlenp, newp, &vfc, |
|
sizeof(struct vfsconf))); |
|
#endif |
#endif |
default: |
|
break; |
|
} |
|
return (EOPNOTSUPP); |
|
} |
} |
|
|
|
|
int kinfo_vdebug = 1; |
int kinfo_vdebug = 1; |
int kinfo_vgetfailed; |
int kinfo_vgetfailed; |
#define KINFO_VNODESLOP 10 |
#define KINFO_VNODESLOP 10 |
Line 2084 int kinfo_vgetfailed; |
|
Line 2081 int kinfo_vgetfailed; |
|
*/ |
*/ |
/* ARGSUSED */ |
/* ARGSUSED */ |
int |
int |
sysctl_vnode(where, sizep, p) |
sysctl_kern_vnode(SYSCTLFN_ARGS) |
char *where; |
|
size_t *sizep; |
|
struct proc *p; |
|
{ |
{ |
|
char *where = oldp; |
|
size_t *sizep = oldlenp; |
struct mount *mp, *nmp; |
struct mount *mp, *nmp; |
struct vnode *nvp, *vp; |
struct vnode *nvp, *vp; |
char *bp = where, *savebp; |
char *bp = where, *savebp; |
char *ewhere; |
char *ewhere; |
int error; |
int error; |
|
|
|
if (namelen != 0) |
|
return (EOPNOTSUPP); |
|
if (newp != NULL) |
|
return (EPERM); |
|
|
#define VPTRSZ sizeof(struct vnode *) |
#define VPTRSZ sizeof(struct vnode *) |
#define VNODESZ sizeof(struct vnode) |
#define VNODESZ sizeof(struct vnode) |
if (where == NULL) { |
if (where == NULL) { |