Mega commit for sysctl.
Convert the remaining sysctl stuff to the new way of doing things. the devconf stuff is the reason for the large number of files. Cleaned up some compiler warnings while I were there.
This commit is contained in:
parent
fe66bbf488
commit
4b2af45f4b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=12429
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.150 1995/11/12 19:51:22 phk Exp $
|
||||
* $Id: machdep.c,v 1.151 1995/11/14 09:52:25 phk Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -1821,12 +1821,7 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
|
||||
}
|
||||
|
||||
int
|
||||
disk_externalize(int drive, void *userp, size_t *maxlen)
|
||||
disk_externalize(int drive, struct sysctl_req *req)
|
||||
{
|
||||
if(*maxlen < sizeof drive) {
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
*maxlen -= sizeof drive;
|
||||
return copyout(&drive, userp, sizeof drive);
|
||||
return SYSCTL_OUT(req, &drive, sizeof drive);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
|
||||
* $Id: isa.c,v 1.54 1995/10/31 21:03:57 peter Exp $
|
||||
* $Id: isa.c,v 1.55 1995/11/05 04:45:15 gibbs Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -50,6 +50,7 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h> /* isn't it a joy */
|
||||
#include <sys/kernel.h> /* to have three of these */
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/file.h>
|
||||
@ -508,14 +509,9 @@ config_isadev_c(isdp, mp, reconfig)
|
||||
* hw.devconf interface.
|
||||
*/
|
||||
int
|
||||
isa_externalize(struct isa_device *id, void *userp, size_t *maxlen)
|
||||
isa_externalize(struct isa_device *id, struct sysctl_req *req)
|
||||
{
|
||||
if(*maxlen < sizeof *id) {
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
*maxlen -= sizeof *id;
|
||||
return copyout(id, userp, sizeof *id);
|
||||
return (SYSCTL_OUT(req, id, sizeof *id));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -524,20 +520,14 @@ isa_externalize(struct isa_device *id, void *userp, size_t *maxlen)
|
||||
* what the `internalize' routine is supposed to do.
|
||||
*/
|
||||
int
|
||||
isa_internalize(struct isa_device *id, void **userpp, size_t *len)
|
||||
isa_internalize(struct isa_device *id, struct sysctl_req *req)
|
||||
{
|
||||
struct isa_device myid;
|
||||
char *userp = *userpp;
|
||||
int rv;
|
||||
|
||||
if(*len < sizeof *id) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
rv = copyin(userp, &myid, sizeof myid);
|
||||
if(rv) return rv;
|
||||
*userpp = userp + sizeof myid;
|
||||
*len -= sizeof myid;
|
||||
rv = SYSCTL_IN(req, &myid, sizeof *id);
|
||||
if(rv)
|
||||
return rv;
|
||||
|
||||
rv = EOPNOTSUPP;
|
||||
/* code would go here to validate the configuration request */
|
||||
@ -546,10 +536,9 @@ isa_internalize(struct isa_device *id, void **userpp, size_t *len)
|
||||
}
|
||||
|
||||
int
|
||||
isa_generic_externalize(struct proc *p, struct kern_devconf *kdc,
|
||||
void *userp, size_t l)
|
||||
isa_generic_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
|
||||
{
|
||||
return isa_externalize(kdc->kdc_isa, userp, &l);
|
||||
return isa_externalize(kdc->kdc_isa, req);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -18,11 +18,12 @@
|
||||
* 4. Modifications may be freely made to this file if the above conditions
|
||||
* are met.
|
||||
*
|
||||
* $Id: eisaconf.c,v 1.6 1995/11/09 22:43:25 gibbs Exp $
|
||||
* $Id: eisaconf.c,v 1.7 1995/11/10 01:32:12 gibbs Exp $
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/devconf.h>
|
||||
@ -464,25 +465,14 @@ eisa_registerdev(e_dev, driver, kdc_template)
|
||||
* hw.devconf interface.
|
||||
*/
|
||||
int
|
||||
eisa_externalize(e_dev, userp, maxlen)
|
||||
struct eisa_device *e_dev;
|
||||
void *userp;
|
||||
size_t *maxlen;
|
||||
eisa_externalize(struct eisa_device *e_dev, struct sysctl_req *req)
|
||||
{
|
||||
if (*maxlen < sizeof *e_dev) {
|
||||
return ENOMEM;
|
||||
}
|
||||
*maxlen -= sizeof *e_dev;
|
||||
return (copyout(e_dev, userp, sizeof *e_dev));
|
||||
return (SYSCTL_OUT(req, e_dev, sizeof *e_dev));
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
eisa_generic_externalize(p, kdc, userp, l)
|
||||
struct proc *p;
|
||||
struct kern_devconf *kdc;
|
||||
void *userp;
|
||||
size_t l;
|
||||
eisa_generic_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
|
||||
{
|
||||
return eisa_externalize(kdc->kdc_eisa, userp, &l);
|
||||
return eisa_externalize(kdc->kdc_eisa, req);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
* 4. Modifications may be freely made to this file if the above conditions
|
||||
* are met.
|
||||
*
|
||||
* $Id: eisaconf.h,v 1.3 1995/11/05 04:42:50 gibbs Exp $
|
||||
* $Id: eisaconf.h,v 1.4 1995/11/06 05:21:01 gibbs Exp $
|
||||
*/
|
||||
|
||||
#ifndef _I386_EISA_EISACONF_H_
|
||||
@ -85,9 +85,10 @@ int eisa_reg_iospace __P((struct eisa_device *, u_long, int));
|
||||
int eisa_registerdev __P((struct eisa_device *, struct eisa_driver *, struct kern_devconf *));
|
||||
|
||||
|
||||
extern int eisa_externalize __P((struct eisa_device *, void *, size_t *));
|
||||
struct sysctl_req;
|
||||
int eisa_externalize (struct eisa_device *, struct sysctl_req*);
|
||||
|
||||
extern int eisa_generic_externalize __P((struct proc *,struct kern_devconf *, void *, size_t));
|
||||
int eisa_generic_externalize (struct kern_devconf *, struct sysctl_req *);
|
||||
extern struct kern_devconf kdc_eisa0;
|
||||
|
||||
#define EISA_EXTERNALLEN (sizeof(struct eisa_device))
|
||||
|
@ -43,7 +43,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
|
||||
* $Id: fd.c,v 1.69 1995/11/04 17:07:17 bde Exp $
|
||||
* $Id: fd.c,v 1.70 1995/11/18 07:48:11 bde Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -89,8 +89,7 @@
|
||||
|
||||
static int fd_goaway(struct kern_devconf *, int);
|
||||
static int fdc_goaway(struct kern_devconf *, int);
|
||||
static int
|
||||
fd_externalize(struct proc *, struct kern_devconf *, void *, size_t);
|
||||
static int fd_externalize(struct kern_devconf *, struct sysctl_req *);
|
||||
|
||||
/*
|
||||
* Templates for the kern_devconf structures used when we attach.
|
||||
@ -344,17 +343,9 @@ struct isa_device *fdcdevs[NFDC];
|
||||
* Provide hw.devconf information.
|
||||
*/
|
||||
static int
|
||||
fd_externalize(struct proc *p, struct kern_devconf *kdc,
|
||||
void *userp, size_t len)
|
||||
fd_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
|
||||
{
|
||||
return disk_externalize(fd_data[kdc->kdc_unit].fdsu, userp, &len);
|
||||
}
|
||||
|
||||
static int
|
||||
fdc_externalize(struct proc *p, struct kern_devconf *kdc,
|
||||
void *userp, size_t len)
|
||||
{
|
||||
return isa_externalize(fdcdevs[kdc->kdc_unit], userp, &len);
|
||||
return disk_externalize(fd_data[kdc->kdc_unit].fdsu, req);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** $Id: pci.c,v 1.31 1995/09/14 23:24:29 se Exp $
|
||||
** $Id: pci.c,v 1.32 1995/10/02 13:43:11 davidg Exp $
|
||||
**
|
||||
** General subroutines for the PCI bus.
|
||||
** pci_configure ()
|
||||
@ -51,6 +51,7 @@
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/proc.h> /* declaration of wakeup(), used by vm.h */
|
||||
#include <sys/devconf.h>
|
||||
|
||||
@ -109,11 +110,9 @@ struct pcicb {
|
||||
u_long pcicb_p_memlimit;
|
||||
};
|
||||
|
||||
static int
|
||||
pci_externalize (struct proc *, struct kern_devconf *, void *, size_t);
|
||||
static int pci_externalize (struct kern_devconf *, struct sysctl_req *);
|
||||
|
||||
static int
|
||||
pci_internalize (struct proc *, struct kern_devconf *, void *, size_t);
|
||||
static int pci_internalize (struct kern_devconf *, struct sysctl_req *);
|
||||
|
||||
static void
|
||||
not_supported (pcici_t tag, u_long type);
|
||||
@ -1091,17 +1090,13 @@ int pci_map_mem (pcici_t tag, u_long reg, vm_offset_t* va, vm_offset_t* pa)
|
||||
*/
|
||||
|
||||
static int
|
||||
pci_externalize (struct proc *p, struct kern_devconf *kdcp, void *u, size_t l)
|
||||
pci_externalize (struct kern_devconf *kdcp, struct sysctl_req *req)
|
||||
{
|
||||
struct pci_externalize_buffer buffer;
|
||||
struct pci_info * pip = kdcp->kdc_parentdata;
|
||||
pcici_t tag;
|
||||
int i;
|
||||
|
||||
if (l < sizeof buffer) {
|
||||
return ENOMEM;
|
||||
};
|
||||
|
||||
tag = pcibus->pb_tag (pip->pi_bus, pip->pi_device, 0);
|
||||
|
||||
buffer.peb_pci_info = *pip;
|
||||
@ -1110,12 +1105,12 @@ pci_externalize (struct proc *p, struct kern_devconf *kdcp, void *u, size_t l)
|
||||
buffer.peb_config[i] = pcibus->pb_read (tag, i*4);
|
||||
};
|
||||
|
||||
return copyout(&buffer, u, sizeof buffer);
|
||||
return SYSCTL_OUT(req, &buffer, sizeof buffer);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
pci_internalize (struct proc *p, struct kern_devconf *kdcp, void *u, size_t s)
|
||||
pci_internalize (struct kern_devconf *kdcp, struct sysctl_req *re)
|
||||
{
|
||||
return EOPNOTSUPP;
|
||||
}
|
||||
|
@ -18,11 +18,12 @@
|
||||
* 4. Modifications may be freely made to this file if the above conditions
|
||||
* are met.
|
||||
*
|
||||
* $Id: eisaconf.c,v 1.6 1995/11/09 22:43:25 gibbs Exp $
|
||||
* $Id: eisaconf.c,v 1.7 1995/11/10 01:32:12 gibbs Exp $
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/devconf.h>
|
||||
@ -464,25 +465,14 @@ eisa_registerdev(e_dev, driver, kdc_template)
|
||||
* hw.devconf interface.
|
||||
*/
|
||||
int
|
||||
eisa_externalize(e_dev, userp, maxlen)
|
||||
struct eisa_device *e_dev;
|
||||
void *userp;
|
||||
size_t *maxlen;
|
||||
eisa_externalize(struct eisa_device *e_dev, struct sysctl_req *req)
|
||||
{
|
||||
if (*maxlen < sizeof *e_dev) {
|
||||
return ENOMEM;
|
||||
}
|
||||
*maxlen -= sizeof *e_dev;
|
||||
return (copyout(e_dev, userp, sizeof *e_dev));
|
||||
return (SYSCTL_OUT(req, e_dev, sizeof *e_dev));
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
eisa_generic_externalize(p, kdc, userp, l)
|
||||
struct proc *p;
|
||||
struct kern_devconf *kdc;
|
||||
void *userp;
|
||||
size_t l;
|
||||
eisa_generic_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
|
||||
{
|
||||
return eisa_externalize(kdc->kdc_eisa, userp, &l);
|
||||
return eisa_externalize(kdc->kdc_eisa, req);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
* 4. Modifications may be freely made to this file if the above conditions
|
||||
* are met.
|
||||
*
|
||||
* $Id: eisaconf.h,v 1.3 1995/11/05 04:42:50 gibbs Exp $
|
||||
* $Id: eisaconf.h,v 1.4 1995/11/06 05:21:01 gibbs Exp $
|
||||
*/
|
||||
|
||||
#ifndef _I386_EISA_EISACONF_H_
|
||||
@ -85,9 +85,10 @@ int eisa_reg_iospace __P((struct eisa_device *, u_long, int));
|
||||
int eisa_registerdev __P((struct eisa_device *, struct eisa_driver *, struct kern_devconf *));
|
||||
|
||||
|
||||
extern int eisa_externalize __P((struct eisa_device *, void *, size_t *));
|
||||
struct sysctl_req;
|
||||
int eisa_externalize (struct eisa_device *, struct sysctl_req*);
|
||||
|
||||
extern int eisa_generic_externalize __P((struct proc *,struct kern_devconf *, void *, size_t));
|
||||
int eisa_generic_externalize (struct kern_devconf *, struct sysctl_req *);
|
||||
extern struct kern_devconf kdc_eisa0;
|
||||
|
||||
#define EISA_EXTERNALLEN (sizeof(struct eisa_device))
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.150 1995/11/12 19:51:22 phk Exp $
|
||||
* $Id: machdep.c,v 1.151 1995/11/14 09:52:25 phk Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -1821,12 +1821,7 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
|
||||
}
|
||||
|
||||
int
|
||||
disk_externalize(int drive, void *userp, size_t *maxlen)
|
||||
disk_externalize(int drive, struct sysctl_req *req)
|
||||
{
|
||||
if(*maxlen < sizeof drive) {
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
*maxlen -= sizeof drive;
|
||||
return copyout(&drive, userp, sizeof drive);
|
||||
return SYSCTL_OUT(req, &drive, sizeof drive);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: devconf.h,v 1.10 1995/11/05 04:43:22 gibbs Exp $
|
||||
* $Id: devconf.h,v 1.11 1995/11/14 20:52:14 phk Exp $
|
||||
*/
|
||||
/*
|
||||
* devconf.h - machine-dependent device configuration table
|
||||
@ -67,23 +67,13 @@ struct machdep_devconf {
|
||||
#define kdc_eisa kdc_parentdata
|
||||
#define kdc_scsi kdc_parentdata
|
||||
|
||||
|
||||
|
||||
/* XXX Don't do this, compile time increases too much
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include <i386/eisa/eisaconf.h>
|
||||
#include <pci/pcireg.h>
|
||||
#include <pci/pcivar.h>
|
||||
#include <scsi/scsi_all.h>
|
||||
#include <scsi/scsiconf.h>
|
||||
*/
|
||||
|
||||
#define CPU_EXTERNALLEN (0)
|
||||
#define DISK_EXTERNALLEN (sizeof(int))
|
||||
#define BUS_EXTERNALLEN (0)
|
||||
|
||||
#ifdef KERNEL /* XXX move this */
|
||||
extern int disk_externalize(int, void *, size_t *);
|
||||
struct sysctl_req;
|
||||
extern int disk_externalize(int, struct sysctl_req *);
|
||||
#endif
|
||||
|
||||
#endif /* _MACHINE_DEVCONF_H_ */
|
||||
|
@ -43,7 +43,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
|
||||
* $Id: fd.c,v 1.69 1995/11/04 17:07:17 bde Exp $
|
||||
* $Id: fd.c,v 1.70 1995/11/18 07:48:11 bde Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -89,8 +89,7 @@
|
||||
|
||||
static int fd_goaway(struct kern_devconf *, int);
|
||||
static int fdc_goaway(struct kern_devconf *, int);
|
||||
static int
|
||||
fd_externalize(struct proc *, struct kern_devconf *, void *, size_t);
|
||||
static int fd_externalize(struct kern_devconf *, struct sysctl_req *);
|
||||
|
||||
/*
|
||||
* Templates for the kern_devconf structures used when we attach.
|
||||
@ -344,17 +343,9 @@ struct isa_device *fdcdevs[NFDC];
|
||||
* Provide hw.devconf information.
|
||||
*/
|
||||
static int
|
||||
fd_externalize(struct proc *p, struct kern_devconf *kdc,
|
||||
void *userp, size_t len)
|
||||
fd_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
|
||||
{
|
||||
return disk_externalize(fd_data[kdc->kdc_unit].fdsu, userp, &len);
|
||||
}
|
||||
|
||||
static int
|
||||
fdc_externalize(struct proc *p, struct kern_devconf *kdc,
|
||||
void *userp, size_t len)
|
||||
{
|
||||
return isa_externalize(fdcdevs[kdc->kdc_unit], userp, &len);
|
||||
return disk_externalize(fd_data[kdc->kdc_unit].fdsu, req);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -17,7 +17,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* ft.c - QIC-40/80 floppy tape driver
|
||||
* $Id: ft.c,v 1.21 1995/05/06 19:34:28 joerg Exp $
|
||||
* $Id: ft.c,v 1.22 1995/05/30 08:01:41 rgrimes Exp $
|
||||
*
|
||||
* 01/19/95 ++sg
|
||||
* Cleaned up recalibrate/seek code at attach time for FreeBSD 2.x.
|
||||
@ -401,8 +401,7 @@ segio_free(ft_p ft, SegReq *sp)
|
||||
DPRT(("segio_free: nfree=%d ndone=%d nreq=%d\n", ft->nfreelist, ft->ndoneq, ft->nsegq));
|
||||
}
|
||||
|
||||
static int ft_externalize(struct proc *, struct kern_devconf *, void *,
|
||||
size_t);
|
||||
static int ft_externalize(struct kern_devconf *, struct sysctl_req *);
|
||||
|
||||
extern struct kern_devconf kdc_fdc[];
|
||||
static struct kern_devconf kdc_ft[NFT] = { {
|
||||
@ -430,10 +429,9 @@ ft_registerdev(int ctlr, int unit)
|
||||
|
||||
|
||||
static int
|
||||
ft_externalize(struct proc *p, struct kern_devconf *kdc, void *userp,
|
||||
size_t len)
|
||||
ft_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
|
||||
{
|
||||
return disk_externalize(ft_data[kdc->kdc_unit].ftsu, userp, &len);
|
||||
return disk_externalize(ft_data[kdc->kdc_unit].ftsu, req);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
|
||||
* $Id: isa.c,v 1.54 1995/10/31 21:03:57 peter Exp $
|
||||
* $Id: isa.c,v 1.55 1995/11/05 04:45:15 gibbs Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -50,6 +50,7 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h> /* isn't it a joy */
|
||||
#include <sys/kernel.h> /* to have three of these */
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/file.h>
|
||||
@ -508,14 +509,9 @@ config_isadev_c(isdp, mp, reconfig)
|
||||
* hw.devconf interface.
|
||||
*/
|
||||
int
|
||||
isa_externalize(struct isa_device *id, void *userp, size_t *maxlen)
|
||||
isa_externalize(struct isa_device *id, struct sysctl_req *req)
|
||||
{
|
||||
if(*maxlen < sizeof *id) {
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
*maxlen -= sizeof *id;
|
||||
return copyout(id, userp, sizeof *id);
|
||||
return (SYSCTL_OUT(req, id, sizeof *id));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -524,20 +520,14 @@ isa_externalize(struct isa_device *id, void *userp, size_t *maxlen)
|
||||
* what the `internalize' routine is supposed to do.
|
||||
*/
|
||||
int
|
||||
isa_internalize(struct isa_device *id, void **userpp, size_t *len)
|
||||
isa_internalize(struct isa_device *id, struct sysctl_req *req)
|
||||
{
|
||||
struct isa_device myid;
|
||||
char *userp = *userpp;
|
||||
int rv;
|
||||
|
||||
if(*len < sizeof *id) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
rv = copyin(userp, &myid, sizeof myid);
|
||||
if(rv) return rv;
|
||||
*userpp = userp + sizeof myid;
|
||||
*len -= sizeof myid;
|
||||
rv = SYSCTL_IN(req, &myid, sizeof *id);
|
||||
if(rv)
|
||||
return rv;
|
||||
|
||||
rv = EOPNOTSUPP;
|
||||
/* code would go here to validate the configuration request */
|
||||
@ -546,10 +536,9 @@ isa_internalize(struct isa_device *id, void **userpp, size_t *len)
|
||||
}
|
||||
|
||||
int
|
||||
isa_generic_externalize(struct proc *p, struct kern_devconf *kdc,
|
||||
void *userp, size_t l)
|
||||
isa_generic_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
|
||||
{
|
||||
return isa_externalize(kdc->kdc_isa, userp, &l);
|
||||
return isa_externalize(kdc->kdc_isa, req);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)isa_device.h 7.1 (Berkeley) 5/9/91
|
||||
* $Id: isa_device.h,v 1.24 1995/09/10 21:35:10 bde Exp $
|
||||
* $Id: isa_device.h,v 1.25 1995/11/05 04:45:16 gibbs Exp $
|
||||
*/
|
||||
|
||||
#ifndef _I386_ISA_ISA_DEVICE_H_
|
||||
@ -156,11 +156,12 @@ int register_intr __P((int intr, int device_id, u_int flags,
|
||||
int unregister_intr __P((int intr, inthand2_t *handler));
|
||||
int update_intr_masks __P((void));
|
||||
|
||||
extern int isa_externalize(struct isa_device *, void *, size_t *);
|
||||
extern int isa_internalize(struct isa_device *, void **, size_t *);
|
||||
struct sysctl_req;
|
||||
extern int isa_externalize(struct isa_device *, struct sysctl_req *);
|
||||
extern int isa_internalize(struct isa_device *, struct sysctl_req *);
|
||||
|
||||
struct kern_devconf;
|
||||
extern int isa_generic_externalize(struct proc *, struct kern_devconf *, void *, size_t);
|
||||
extern int isa_generic_externalize(struct kern_devconf *, struct sysctl_req *);
|
||||
extern struct kern_devconf kdc_isa0;
|
||||
#endif /* KERNEL */
|
||||
|
||||
|
@ -209,7 +209,7 @@ static int wcd_read_toc (struct wcd *t);
|
||||
static int wcd_request_wait (struct wcd *t, u_char cmd, u_char a1, u_char a2,
|
||||
u_char a3, u_char a4, u_char a5, u_char a6, u_char a7, u_char a8,
|
||||
u_char a9, char *addr, int count);
|
||||
static int wcd_externalize (struct proc*, struct kern_devconf*, void*, size_t);
|
||||
static int wcd_externalize (struct kern_devconf*, struct sysctl_req *);
|
||||
static int wcd_goaway (struct kern_devconf *kdc, int force);
|
||||
static void wcd_describe (struct wcd *t);
|
||||
static int wcd_open(dev_t dev, int rawflag);
|
||||
@ -236,10 +236,9 @@ static void wcd_dump (int lun, char *label, void *data, int len)
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
static int wcd_externalize (struct proc *p, struct kern_devconf *kdc,
|
||||
void *userp, size_t len)
|
||||
static int wcd_externalize (struct kern_devconf *kdc, struct sysctl_req *req)
|
||||
{
|
||||
return disk_externalize (wcdtab[kdc->kdc_unit]->unit, userp, &len);
|
||||
return disk_externalize (wcdtab[kdc->kdc_unit]->unit, req);
|
||||
}
|
||||
|
||||
static int wcd_goaway (struct kern_devconf *kdc, int force)
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
|
||||
* $Id: wd.c,v 1.89 1995/10/28 15:39:28 phk Exp $
|
||||
* $Id: wd.c,v 1.90 1995/10/29 17:34:17 bde Exp $
|
||||
*/
|
||||
|
||||
/* TODO:
|
||||
@ -107,8 +107,7 @@ extern void wdstart(int ctrlr);
|
||||
|
||||
static int wd_goaway(struct kern_devconf *, int);
|
||||
static int wdc_goaway(struct kern_devconf *, int);
|
||||
static int wd_externalize(struct proc *, struct kern_devconf *, void *, size_t);
|
||||
static int wdc_externalize(struct proc *, struct kern_devconf *, void *, size_t);
|
||||
static int wd_externalize(struct kern_devconf *, struct sysctl_req *);
|
||||
|
||||
/*
|
||||
* Templates for the kern_devconf structures used when we attach.
|
||||
@ -274,9 +273,9 @@ static int wdwait(struct disk *du, u_char bits_wanted, int timeout);
|
||||
* Provide hw.devconf information.
|
||||
*/
|
||||
static int
|
||||
wd_externalize(struct proc *p, struct kern_devconf *kdc, void *userp, size_t len)
|
||||
wd_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
|
||||
{
|
||||
return disk_externalize(wddrives[kdc->kdc_unit]->dk_unit, userp, &len);
|
||||
return disk_externalize(wddrives[kdc->kdc_unit]->dk_unit, req);
|
||||
}
|
||||
|
||||
struct isa_driver wdcdriver = {
|
||||
|
17
sys/isa/fd.c
17
sys/isa/fd.c
@ -43,7 +43,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
|
||||
* $Id: fd.c,v 1.69 1995/11/04 17:07:17 bde Exp $
|
||||
* $Id: fd.c,v 1.70 1995/11/18 07:48:11 bde Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -89,8 +89,7 @@
|
||||
|
||||
static int fd_goaway(struct kern_devconf *, int);
|
||||
static int fdc_goaway(struct kern_devconf *, int);
|
||||
static int
|
||||
fd_externalize(struct proc *, struct kern_devconf *, void *, size_t);
|
||||
static int fd_externalize(struct kern_devconf *, struct sysctl_req *);
|
||||
|
||||
/*
|
||||
* Templates for the kern_devconf structures used when we attach.
|
||||
@ -344,17 +343,9 @@ struct isa_device *fdcdevs[NFDC];
|
||||
* Provide hw.devconf information.
|
||||
*/
|
||||
static int
|
||||
fd_externalize(struct proc *p, struct kern_devconf *kdc,
|
||||
void *userp, size_t len)
|
||||
fd_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
|
||||
{
|
||||
return disk_externalize(fd_data[kdc->kdc_unit].fdsu, userp, &len);
|
||||
}
|
||||
|
||||
static int
|
||||
fdc_externalize(struct proc *p, struct kern_devconf *kdc,
|
||||
void *userp, size_t len)
|
||||
{
|
||||
return isa_externalize(fdcdevs[kdc->kdc_unit], userp, &len);
|
||||
return disk_externalize(fd_data[kdc->kdc_unit].fdsu, req);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -22,7 +22,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: kern_devconf.c,v 1.9 1995/04/13 15:33:14 wollman Exp $
|
||||
* $Id: kern_devconf.c,v 1.10 1995/05/30 08:05:23 rgrimes Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -126,67 +126,49 @@ make_devconf(struct kern_devconf *kdc, struct devconf *dc)
|
||||
dc->dc_descr[(sizeof dc->dc_descr) - 1] = '\0';
|
||||
}
|
||||
|
||||
int
|
||||
dev_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
|
||||
void *newp, size_t newlen, struct proc *p)
|
||||
static int
|
||||
sysctl_hw_devconfig SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int *name = (int *) arg1;
|
||||
u_int namelen = arg2;
|
||||
struct kern_devconf *kdc;
|
||||
struct devconf dc;
|
||||
int rv;
|
||||
size_t len;
|
||||
|
||||
/* all sysctl names at this level are terminal */
|
||||
if (namelen != 1)
|
||||
return ENOTDIR;
|
||||
|
||||
switch(name[0]) {
|
||||
case DEVCONF_NUMBER:
|
||||
return (sysctl_rdint(oldp, oldlenp, newp, dc_lastnum));
|
||||
if (name[0] == DEVCONF_NUMBER)
|
||||
return sysctl_handle_int(oidp, 0, dc_lastnum, req);
|
||||
|
||||
default:
|
||||
for(kdc = dc_list; kdc; kdc = kdc->kdc_next) {
|
||||
if(kdc->kdc_number == name[0])
|
||||
break;
|
||||
}
|
||||
|
||||
if(!kdc)
|
||||
return ENXIO;
|
||||
|
||||
if(!oldp) {
|
||||
*oldlenp = sizeof(struct devconf) - 1;
|
||||
|
||||
*oldlenp += kdc->kdc_datalen;
|
||||
return 0;
|
||||
}
|
||||
|
||||
len = *oldlenp;
|
||||
make_devconf(kdc, &dc);
|
||||
*oldlenp = (sizeof dc) - 1 + dc.dc_datalen;
|
||||
|
||||
if(len < *oldlenp) {
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
rv = copyout(&dc, oldp, (sizeof dc) - 1);
|
||||
if(rv)
|
||||
return rv;
|
||||
|
||||
if(kdc->kdc_externalize)
|
||||
rv = kdc->kdc_externalize(p, kdc,
|
||||
&((struct devconf *)oldp)->dc_data,
|
||||
len - ((sizeof dc) - 1));
|
||||
if(rv)
|
||||
return rv;
|
||||
|
||||
if(!newp)
|
||||
return 0;
|
||||
|
||||
if(!kdc->kdc_internalize)
|
||||
return EOPNOTSUPP;
|
||||
|
||||
rv = kdc->kdc_internalize(p, kdc,
|
||||
&((struct devconf *)newp)->dc_data,
|
||||
newlen - ((sizeof dc) - 1));
|
||||
return rv;
|
||||
for(kdc = dc_list; kdc; kdc = kdc->kdc_next) {
|
||||
if(kdc->kdc_number == name[0])
|
||||
break;
|
||||
}
|
||||
|
||||
if(!kdc)
|
||||
return ENXIO;
|
||||
|
||||
make_devconf(kdc, &dc);
|
||||
|
||||
rv = SYSCTL_OUT(req, &dc, (sizeof dc) -1);
|
||||
if(rv)
|
||||
return rv;
|
||||
|
||||
if(kdc->kdc_externalize)
|
||||
rv = kdc->kdc_externalize(kdc, req);
|
||||
if(rv)
|
||||
return rv;
|
||||
|
||||
if(!req->newptr)
|
||||
return 0;
|
||||
|
||||
if(!kdc->kdc_internalize)
|
||||
return EOPNOTSUPP;
|
||||
|
||||
rv = kdc->kdc_internalize(kdc, req);
|
||||
return rv;
|
||||
}
|
||||
|
||||
SYSCTL_NODE(_hw, HW_DEVCONF, devconfig, CTLFLAG_RW, sysctl_hw_devconfig,"");
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
|
||||
* $Id: kern_sysctl.c,v 1.50 1995/11/14 20:43:29 phk Exp $
|
||||
* $Id: kern_sysctl.c,v 1.51 1995/11/16 18:59:49 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -50,6 +50,17 @@
|
||||
#include <sys/conf.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
/*
|
||||
* Locking and stats
|
||||
*/
|
||||
static struct sysctl_lock {
|
||||
int sl_lock;
|
||||
int sl_want;
|
||||
int sl_locked;
|
||||
} memlock;
|
||||
|
||||
static int sysctl_root SYSCTL_HANDLER_ARGS;
|
||||
|
||||
extern struct linker_set sysctl_;
|
||||
|
||||
/* BEGIN_MIB */
|
||||
@ -145,6 +156,66 @@ char hostname[MAXHOSTNAMELEN];
|
||||
SYSCTL_STRING(_kern, KERN_HOSTNAME, hostname, CTLFLAG_RW,
|
||||
hostname, sizeof(hostname), "");
|
||||
|
||||
int securelevel = -1;
|
||||
|
||||
static int
|
||||
sysctl_kern_securelvl SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error, level;
|
||||
|
||||
level = securelevel;
|
||||
error = sysctl_handle_int(oidp, &level, 0, req);
|
||||
if (error || !req->newptr)
|
||||
return (error);
|
||||
if (level < securelevel && req->p->p_pid != 1)
|
||||
return (EPERM);
|
||||
securelevel = level;
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_kern, KERN_SECURELVL, securelevel, CTLTYPE_INT|CTLFLAG_RW,
|
||||
0, 0, sysctl_kern_securelvl, "");
|
||||
|
||||
static int
|
||||
sysctl_kern_dumpdev SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error;
|
||||
dev_t ndumpdev;
|
||||
|
||||
ndumpdev = dumpdev;
|
||||
error = sysctl_handle_opaque(oidp, &ndumpdev, sizeof ndumpdev, req);
|
||||
if (!error && ndumpdev != dumpdev) {
|
||||
error = setdumpdev(ndumpdev);
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_kern, KERN_DUMPDEV, dumpdev, CTLTYPE_OPAQUE|CTLFLAG_RW,
|
||||
0, sizeof dumpdev, sysctl_kern_dumpdev, "");
|
||||
|
||||
static int
|
||||
sysctl_hw_physmem SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error = sysctl_handle_int(oidp, 0, ctob(physmem), req);
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_INT|CTLFLAG_RD,
|
||||
0, 0, sysctl_hw_physmem, "");
|
||||
|
||||
static int
|
||||
sysctl_hw_usermem SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error = sysctl_handle_int(oidp, 0,
|
||||
ctob(physmem - cnt.v_wire_count), req);
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_INT|CTLFLAG_RD,
|
||||
0, 0, sysctl_hw_usermem, "");
|
||||
|
||||
/* END_MIB */
|
||||
|
||||
static int
|
||||
sysctl_order_cmp(const void *a, const void *b)
|
||||
{
|
||||
@ -370,6 +441,10 @@ sysctl_old_user(struct sysctl_req *req, void *p, int l)
|
||||
{
|
||||
int error = 0, i = 0;
|
||||
|
||||
if (req->lock == 1 && req->oldptr) {
|
||||
vslock(req->oldptr, req->oldlen);
|
||||
req->lock = 2;
|
||||
}
|
||||
if (req->oldptr) {
|
||||
i = min(req->oldlen - req->oldidx, l);
|
||||
if (i > 0)
|
||||
@ -397,24 +472,11 @@ sysctl_new_user(struct sysctl_req *req, void *p, int l)
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Locking and stats
|
||||
*/
|
||||
static struct sysctl_lock {
|
||||
int sl_lock;
|
||||
int sl_want;
|
||||
int sl_locked;
|
||||
} memlock;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Traverse our tree, and find the right node, execute whatever it points
|
||||
* at, and return the resulting error code.
|
||||
* We work entirely in kernel-space at this time.
|
||||
*/
|
||||
|
||||
|
||||
int
|
||||
sysctl_root SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
@ -431,6 +493,8 @@ sysctl_root SYSCTL_HANDLER_ARGS
|
||||
while (j-- && indx < CTL_MAXNAME) {
|
||||
if (*oidpp && ((*oidpp)->oid_number == name[indx])) {
|
||||
indx++;
|
||||
if ((*oidpp)->oid_kind & CTLFLAG_NOLOCK)
|
||||
req->lock = 0;
|
||||
if (((*oidpp)->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
|
||||
if ((*oidpp)->oid_handler)
|
||||
goto found;
|
||||
@ -482,10 +546,7 @@ struct sysctl_args {
|
||||
#endif
|
||||
|
||||
int
|
||||
__sysctl(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct sysctl_args *uap;
|
||||
int *retval;
|
||||
__sysctl(struct proc *p, struct sysctl_args *uap, int *retval)
|
||||
{
|
||||
int error, i, j, name[CTL_MAXNAME];
|
||||
|
||||
@ -509,8 +570,6 @@ __sysctl(p, uap, retval)
|
||||
return (error);
|
||||
}
|
||||
|
||||
static sysctlfn kern_sysctl;
|
||||
|
||||
/*
|
||||
* This is used from various compatibility syscalls too. That's why name
|
||||
* must be in kernel space.
|
||||
@ -518,9 +577,7 @@ static sysctlfn kern_sysctl;
|
||||
int
|
||||
userland_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *oldlenp, int inkernel, void *new, size_t newlen, int *retval)
|
||||
{
|
||||
int error = 0, dolock = 1, oldlen = 0;
|
||||
u_int savelen = 0;
|
||||
sysctlfn *fn;
|
||||
int error = 0;
|
||||
struct sysctl_req req;
|
||||
|
||||
bzero(&req, sizeof req);
|
||||
@ -555,15 +612,30 @@ userland_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *old
|
||||
|
||||
req.oldfunc = sysctl_old_user;
|
||||
req.newfunc = sysctl_new_user;
|
||||
req.lock = 1;
|
||||
|
||||
/* XXX this should probably be done in a general way */
|
||||
while (memlock.sl_lock) {
|
||||
memlock.sl_want = 1;
|
||||
(void) tsleep((caddr_t)&memlock, PRIBIO+1, "sysctl", 0);
|
||||
memlock.sl_locked++;
|
||||
}
|
||||
memlock.sl_lock = 1;
|
||||
|
||||
error = sysctl_root(0, name, namelen, &req);
|
||||
|
||||
/*
|
||||
if (req.lock == 2)
|
||||
vsunlock(req.oldptr, req.oldlen, B_WRITE);
|
||||
|
||||
memlock.sl_lock = 0;
|
||||
|
||||
if (memlock.sl_want) {
|
||||
memlock.sl_want = 0;
|
||||
wakeup((caddr_t)&memlock);
|
||||
}
|
||||
|
||||
if (error && error != ENOMEM)
|
||||
return (error);
|
||||
*/
|
||||
if (error == ENOENT)
|
||||
goto oldstuff;
|
||||
|
||||
if (retval) {
|
||||
if (req.oldptr && req.oldidx > req.oldlen)
|
||||
@ -572,334 +644,6 @@ userland_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *old
|
||||
*retval = req.oldidx;
|
||||
}
|
||||
return (error);
|
||||
|
||||
oldstuff:
|
||||
oldlen = req.oldlen;
|
||||
|
||||
switch (name[0]) {
|
||||
case CTL_KERN:
|
||||
fn = kern_sysctl;
|
||||
if (name[1] != KERN_VNODE) /* XXX */
|
||||
dolock = 0;
|
||||
break;
|
||||
case CTL_HW:
|
||||
fn = hw_sysctl;
|
||||
break;
|
||||
case CTL_FS:
|
||||
fn = fs_sysctl;
|
||||
break;
|
||||
default:
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
if (old != NULL) {
|
||||
if (!useracc(old, oldlen, B_WRITE))
|
||||
return (EFAULT);
|
||||
while (memlock.sl_lock) {
|
||||
memlock.sl_want = 1;
|
||||
(void) tsleep((caddr_t)&memlock, PRIBIO+1, "sysctl", 0);
|
||||
memlock.sl_locked++;
|
||||
}
|
||||
memlock.sl_lock = 1;
|
||||
if (dolock)
|
||||
vslock(old, oldlen);
|
||||
savelen = oldlen;
|
||||
}
|
||||
|
||||
|
||||
error = (*fn)(name + 1, namelen - 1, old, &oldlen,
|
||||
new, newlen, p);
|
||||
|
||||
|
||||
if (old != NULL) {
|
||||
if (dolock)
|
||||
vsunlock(old, savelen, B_WRITE);
|
||||
memlock.sl_lock = 0;
|
||||
if (memlock.sl_want) {
|
||||
memlock.sl_want = 0;
|
||||
wakeup((caddr_t)&memlock);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
if (error) {
|
||||
printf("SYSCTL_ERROR: ");
|
||||
for(i=0;i<namelen;i++)
|
||||
printf("%d ", name[i]);
|
||||
printf("= %d\n", error);
|
||||
}
|
||||
#endif
|
||||
if (error)
|
||||
return (error);
|
||||
if (retval)
|
||||
*retval = oldlen;
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Attributes stored in the kernel.
|
||||
*/
|
||||
int securelevel = -1;
|
||||
|
||||
/*
|
||||
* kernel related system variables.
|
||||
*/
|
||||
static int
|
||||
kern_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;
|
||||
{
|
||||
|
||||
/* all sysctl names at this level are terminal */
|
||||
if (namelen != 1 && !(name[0] == KERN_PROC || name[0] == KERN_PROF
|
||||
|| name[0] == KERN_NTP_PLL))
|
||||
return (ENOTDIR); /* overloaded */
|
||||
|
||||
switch (name[0]) {
|
||||
|
||||
case KERN_VNODE:
|
||||
return (sysctl_vnode(oldp, oldlenp));
|
||||
#ifdef GPROF
|
||||
case KERN_PROF:
|
||||
return (sysctl_doprof(name + 1, namelen - 1, oldp, oldlenp,
|
||||
newp, newlen));
|
||||
#endif
|
||||
default:
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_kern_securelvl SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error, level;
|
||||
|
||||
level = securelevel;
|
||||
error = sysctl_handle_int(oidp, &level, 0, req);
|
||||
if (error || !req->newptr)
|
||||
return (error);
|
||||
if (level < securelevel && req->p->p_pid != 1)
|
||||
return (EPERM);
|
||||
securelevel = level;
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_kern, KERN_SECURELVL, securelevel, CTLTYPE_INT|CTLFLAG_RW,
|
||||
0, 0, sysctl_kern_securelvl, "");
|
||||
|
||||
static int
|
||||
sysctl_kern_dumpdev SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int error;
|
||||
dev_t ndumpdev;
|
||||
|
||||
ndumpdev = dumpdev;
|
||||
error = sysctl_handle_opaque(oidp, &ndumpdev, sizeof ndumpdev, req);
|
||||
if (!error && ndumpdev != dumpdev) {
|
||||
error = setdumpdev(ndumpdev);
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_kern, KERN_DUMPDEV, dumpdev, CTLTYPE_OPAQUE|CTLFLAG_RW,
|
||||
0, sizeof dumpdev, sysctl_kern_dumpdev, "");
|
||||
/*
|
||||
* hardware related system variables.
|
||||
*/
|
||||
int
|
||||
hw_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;
|
||||
{
|
||||
/* almost all sysctl names at this level are terminal */
|
||||
if (namelen != 1 && name[0] != HW_DEVCONF)
|
||||
return (ENOTDIR); /* overloaded */
|
||||
|
||||
switch (name[0]) {
|
||||
case HW_PHYSMEM:
|
||||
return (sysctl_rdint(oldp, oldlenp, newp, ctob(physmem)));
|
||||
case HW_USERMEM:
|
||||
return (sysctl_rdint(oldp, oldlenp, newp,
|
||||
ctob(physmem - cnt.v_wire_count)));
|
||||
case HW_DEVCONF:
|
||||
return (dev_sysctl(name + 1, namelen - 1, oldp, oldlenp,
|
||||
newp, newlen, p));
|
||||
default:
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate parameters and get old / set new parameters
|
||||
* for an integer-valued sysctl function.
|
||||
*/
|
||||
int
|
||||
sysctl_int(oldp, oldlenp, newp, newlen, valp)
|
||||
void *oldp;
|
||||
size_t *oldlenp;
|
||||
void *newp;
|
||||
size_t newlen;
|
||||
int *valp;
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
if (oldp && *oldlenp < sizeof(int))
|
||||
return (ENOMEM);
|
||||
if (newp && newlen != sizeof(int))
|
||||
return (EINVAL);
|
||||
*oldlenp = sizeof(int);
|
||||
if (oldp)
|
||||
error = copyout(valp, oldp, sizeof(int));
|
||||
if (error == 0 && newp)
|
||||
error = copyin(newp, valp, sizeof(int));
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* As above, but read-only.
|
||||
*/
|
||||
int
|
||||
sysctl_rdint(oldp, oldlenp, newp, val)
|
||||
void *oldp;
|
||||
size_t *oldlenp;
|
||||
void *newp;
|
||||
int val;
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
if (oldp && *oldlenp < sizeof(int))
|
||||
return (ENOMEM);
|
||||
if (newp)
|
||||
return (EPERM);
|
||||
*oldlenp = sizeof(int);
|
||||
if (oldp)
|
||||
error = copyout((caddr_t)&val, oldp, sizeof(int));
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate parameters and get old / set new parameters
|
||||
* for a string-valued sysctl function.
|
||||
*/
|
||||
int
|
||||
sysctl_string(oldp, oldlenp, newp, newlen, str, maxlen)
|
||||
void *oldp;
|
||||
size_t *oldlenp;
|
||||
void *newp;
|
||||
size_t newlen;
|
||||
char *str;
|
||||
int maxlen;
|
||||
{
|
||||
int len, error = 0, rval = 0;
|
||||
|
||||
len = strlen(str) + 1;
|
||||
if (oldp && *oldlenp < len) {
|
||||
len = *oldlenp;
|
||||
rval = ENOMEM;
|
||||
}
|
||||
if (newp && newlen >= maxlen)
|
||||
return (EINVAL);
|
||||
if (oldp) {
|
||||
*oldlenp = len;
|
||||
error = copyout(str, oldp, len);
|
||||
if (error)
|
||||
rval = error;
|
||||
}
|
||||
if ((error == 0 || error == ENOMEM) && newp) {
|
||||
error = copyin(newp, str, newlen);
|
||||
if (error)
|
||||
rval = error;
|
||||
str[newlen] = 0;
|
||||
}
|
||||
return (rval);
|
||||
}
|
||||
|
||||
/*
|
||||
* As above, but read-only.
|
||||
*/
|
||||
int
|
||||
sysctl_rdstring(oldp, oldlenp, newp, str)
|
||||
void *oldp;
|
||||
size_t *oldlenp;
|
||||
void *newp;
|
||||
char *str;
|
||||
{
|
||||
int len, error = 0, rval = 0;
|
||||
|
||||
len = strlen(str) + 1;
|
||||
if (oldp && *oldlenp < len) {
|
||||
len = *oldlenp;
|
||||
rval = ENOMEM;
|
||||
}
|
||||
if (newp)
|
||||
return (EPERM);
|
||||
*oldlenp = len;
|
||||
if (oldp)
|
||||
error = copyout(str, oldp, len);
|
||||
if (error)
|
||||
rval = error;
|
||||
return (rval);
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate parameters and get old / set new parameters
|
||||
* for a structure oriented sysctl function.
|
||||
*/
|
||||
int
|
||||
sysctl_struct(oldp, oldlenp, newp, newlen, sp, len)
|
||||
void *oldp;
|
||||
size_t *oldlenp;
|
||||
void *newp;
|
||||
size_t newlen;
|
||||
void *sp;
|
||||
int len;
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
if (oldp && *oldlenp < len)
|
||||
return (ENOMEM);
|
||||
if (newp && newlen > len)
|
||||
return (EINVAL);
|
||||
if (oldp) {
|
||||
*oldlenp = len;
|
||||
error = copyout(sp, oldp, len);
|
||||
}
|
||||
if (error == 0 && newp)
|
||||
error = copyin(newp, sp, len);
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate parameters and get old parameters
|
||||
* for a structure oriented sysctl function.
|
||||
*/
|
||||
int
|
||||
sysctl_rdstruct(oldp, oldlenp, newp, sp, len)
|
||||
void *oldp;
|
||||
size_t *oldlenp;
|
||||
void *newp, *sp;
|
||||
int len;
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
if (oldp && *oldlenp < len)
|
||||
return (ENOMEM);
|
||||
if (newp)
|
||||
return (EPERM);
|
||||
*oldlenp = len;
|
||||
if (oldp)
|
||||
error = copyout(sp, oldp, len);
|
||||
return (error);
|
||||
}
|
||||
|
||||
#ifdef COMPAT_43
|
||||
@ -969,10 +713,7 @@ struct getkerninfo_args {
|
||||
#endif
|
||||
|
||||
int
|
||||
ogetkerninfo(p, uap, retval)
|
||||
struct proc *p;
|
||||
register struct getkerninfo_args *uap;
|
||||
int *retval;
|
||||
ogetkerninfo(struct proc *p, struct getkerninfo_args *uap, int *retval)
|
||||
{
|
||||
int error, name[6];
|
||||
u_int size;
|
||||
@ -987,14 +728,14 @@ ogetkerninfo(p, uap, retval)
|
||||
name[4] = uap->op & 0xff;
|
||||
name[5] = uap->arg;
|
||||
error = userland_sysctl(p, name, 6, uap->where, uap->size,
|
||||
0, 0, 0, 0);
|
||||
0, 0, 0, &size);
|
||||
break;
|
||||
|
||||
case KINFO_VNODE:
|
||||
name[0] = CTL_KERN;
|
||||
name[1] = KERN_VNODE;
|
||||
error = userland_sysctl(p, name, 2, uap->where, uap->size,
|
||||
0, 0, 0, 0);
|
||||
0, 0, 0, &size);
|
||||
break;
|
||||
|
||||
case KINFO_PROC:
|
||||
@ -1003,35 +744,35 @@ ogetkerninfo(p, uap, retval)
|
||||
name[2] = uap->op & 0xff;
|
||||
name[3] = uap->arg;
|
||||
error = userland_sysctl(p, name, 4, uap->where, uap->size,
|
||||
0, 0, 0, 0);
|
||||
0, 0, 0, &size);
|
||||
break;
|
||||
|
||||
case KINFO_FILE:
|
||||
name[0] = CTL_KERN;
|
||||
name[1] = KERN_FILE;
|
||||
error = userland_sysctl(p, name, 2, uap->where, uap->size,
|
||||
0, 0, 0, 0);
|
||||
0, 0, 0, &size);
|
||||
break;
|
||||
|
||||
case KINFO_METER:
|
||||
name[0] = CTL_VM;
|
||||
name[1] = VM_METER;
|
||||
error = userland_sysctl(p, name, 2, uap->where, uap->size,
|
||||
0, 0, 0, 0);
|
||||
0, 0, 0, &size);
|
||||
break;
|
||||
|
||||
case KINFO_LOADAVG:
|
||||
name[0] = CTL_VM;
|
||||
name[1] = VM_LOADAVG;
|
||||
error = userland_sysctl(p, name, 2, uap->where, uap->size,
|
||||
0, 0, 0, 0);
|
||||
0, 0, 0, &size);
|
||||
break;
|
||||
|
||||
case KINFO_CLOCKRATE:
|
||||
name[0] = CTL_KERN;
|
||||
name[1] = KERN_CLOCKRATE;
|
||||
error = userland_sysctl(p, name, 2, uap->where, uap->size,
|
||||
0, 0, 0, 0);
|
||||
0, 0, 0, &size);
|
||||
break;
|
||||
|
||||
case KINFO_BSDI_SYSINFO: {
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)subr_prof.c 8.3 (Berkeley) 9/23/93
|
||||
* $Id: subr_prof.c,v 1.9 1995/09/09 18:10:05 davidg Exp $
|
||||
* $Id: subr_prof.c,v 1.10 1995/11/12 06:43:04 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -98,15 +98,11 @@ kmstartup(udata)
|
||||
/*
|
||||
* Return kernel profiling information.
|
||||
*/
|
||||
int
|
||||
sysctl_doprof(name, namelen, oldp, oldlenp, newp, newlen)
|
||||
int *name;
|
||||
u_int namelen;
|
||||
void *oldp;
|
||||
size_t *oldlenp;
|
||||
void *newp;
|
||||
size_t newlen;
|
||||
static int
|
||||
sysctl_kern_prof SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int *name = (int *) arg1;
|
||||
u_int namelen = arg2;
|
||||
struct gmonparam *gp = &_gmonparam;
|
||||
int error;
|
||||
|
||||
@ -116,7 +112,7 @@ sysctl_doprof(name, namelen, oldp, oldlenp, newp, newlen)
|
||||
|
||||
switch (name[0]) {
|
||||
case GPROF_STATE:
|
||||
error = sysctl_int(oldp, oldlenp, newp, newlen, &gp->state);
|
||||
error = sysctl_handle_int(oidp, &gp->state, 0, req);
|
||||
if (error)
|
||||
return (error);
|
||||
if (gp->state == GMON_PROF_OFF)
|
||||
@ -125,21 +121,23 @@ sysctl_doprof(name, namelen, oldp, oldlenp, newp, newlen)
|
||||
startprofclock(&proc0);
|
||||
return (0);
|
||||
case GPROF_COUNT:
|
||||
return (sysctl_struct(oldp, oldlenp, newp, newlen,
|
||||
gp->kcount, gp->kcountsize));
|
||||
return (sysctl_handle_opaque(oidp,
|
||||
gp->kcount, gp->kcountsize, req));
|
||||
case GPROF_FROMS:
|
||||
return (sysctl_struct(oldp, oldlenp, newp, newlen,
|
||||
gp->froms, gp->fromssize));
|
||||
return (sysctl_handle_opaque(oidp,
|
||||
gp->froms, gp->fromssize, req));
|
||||
case GPROF_TOS:
|
||||
return (sysctl_struct(oldp, oldlenp, newp, newlen,
|
||||
gp->tos, gp->tossize));
|
||||
return (sysctl_handle_opaque(oidp,
|
||||
gp->tos, gp->tossize, req));
|
||||
case GPROF_GMONPARAM:
|
||||
return (sysctl_rdstruct(oldp, oldlenp, newp, gp, sizeof *gp));
|
||||
return (sysctl_handle_opaque(oidp, gp, sizeof *gp, req));
|
||||
default:
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
SYSCTL_NODE(_kern, KERN_PROF, prof, CTLFLAG_RW, sysctl_kern_prof, "");
|
||||
#endif /* GPROF */
|
||||
|
||||
/*
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94
|
||||
* $Id: vfs_subr.c,v 1.41 1995/11/14 09:19:12 phk Exp $
|
||||
* $Id: vfs_subr.c,v 1.42 1995/11/16 09:45:23 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -175,8 +175,7 @@ vfs_unbusy(mp)
|
||||
}
|
||||
|
||||
void
|
||||
vfs_unmountroot(rootfs)
|
||||
struct mount *rootfs;
|
||||
vfs_unmountroot(struct mount *rootfs)
|
||||
{
|
||||
struct mount *mp = rootfs;
|
||||
int error;
|
||||
@ -953,9 +952,7 @@ vflush(mp, skipvp, flags)
|
||||
* Disassociate the underlying file system from a vnode.
|
||||
*/
|
||||
void
|
||||
vclean(vp, flags)
|
||||
register struct vnode *vp;
|
||||
int flags;
|
||||
vclean(struct vnode *vp, int flags)
|
||||
{
|
||||
int active;
|
||||
|
||||
@ -1247,7 +1244,7 @@ vprint(label, vp)
|
||||
* Called when debugging the kernel.
|
||||
*/
|
||||
void
|
||||
printlockedvnodes()
|
||||
printlockedvnodes(void)
|
||||
{
|
||||
register struct mount *mp;
|
||||
register struct vnode *vp;
|
||||
@ -1273,30 +1270,25 @@ int kinfo_vgetfailed;
|
||||
* Copyout address of vnode followed by vnode.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
sysctl_vnode(where, sizep)
|
||||
char *where;
|
||||
size_t *sizep;
|
||||
static int
|
||||
sysctl_vnode SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
register struct mount *mp, *nmp;
|
||||
struct vnode *vp;
|
||||
register char *bp = where, *savebp;
|
||||
char *ewhere;
|
||||
int error;
|
||||
|
||||
#define VPTRSZ sizeof (struct vnode *)
|
||||
#define VNODESZ sizeof (struct vnode)
|
||||
if (where == NULL) {
|
||||
*sizep = (numvnodes + KINFO_VNODESLOP) * (VPTRSZ + VNODESZ);
|
||||
return (0);
|
||||
}
|
||||
ewhere = where + *sizep;
|
||||
|
||||
req->lock = 0;
|
||||
if (req->oldptr) /* Make an estimate */
|
||||
return (SYSCTL_OUT(req, 0,
|
||||
(numvnodes + KINFO_VNODESLOP) * (VPTRSZ + VNODESZ)));
|
||||
|
||||
for (mp = mountlist.cqh_first; mp != (void *)&mountlist; mp = nmp) {
|
||||
nmp = mp->mnt_list.cqe_next;
|
||||
if (vfs_busy(mp))
|
||||
continue;
|
||||
savebp = bp;
|
||||
again:
|
||||
for (vp = mp->mnt_vnodelist.lh_first;
|
||||
vp != NULL;
|
||||
@ -1309,29 +1301,24 @@ sysctl_vnode(where, sizep)
|
||||
if (vp->v_mount != mp) {
|
||||
if (kinfo_vdebug)
|
||||
printf("kinfo: vp changed\n");
|
||||
bp = savebp;
|
||||
goto again;
|
||||
}
|
||||
if (bp + VPTRSZ + VNODESZ > ewhere) {
|
||||
if ((error = SYSCTL_OUT(req, &vp, VPTRSZ)) ||
|
||||
(error = SYSCTL_OUT(req, vp, VNODESZ))) {
|
||||
vfs_unbusy(mp);
|
||||
*sizep = bp - where;
|
||||
return (ENOMEM);
|
||||
}
|
||||
if ((error = copyout(&vp, bp, VPTRSZ)) ||
|
||||
(error = copyout(vp, bp + VPTRSZ, VNODESZ))) {
|
||||
vfs_unbusy(mp);
|
||||
*sizep = bp - where;
|
||||
return (error);
|
||||
}
|
||||
bp += VPTRSZ + VNODESZ;
|
||||
}
|
||||
vfs_unbusy(mp);
|
||||
}
|
||||
|
||||
*sizep = bp - where;
|
||||
return (0);
|
||||
}
|
||||
|
||||
SYSCTL_NODE(_kern, KERN_VNODE, vnode, CTLTYPE_OPAQUE|CTLFLAG_RD,
|
||||
sysctl_vnode, "");
|
||||
|
||||
|
||||
/*
|
||||
* Check to see if a filesystem is mounted on a block device.
|
||||
*/
|
||||
@ -1360,10 +1347,8 @@ vfs_mountedon(vp)
|
||||
* Called by ufs_mount() to set up the lists of export addresses.
|
||||
*/
|
||||
static int
|
||||
vfs_hang_addrlist(mp, nep, argp)
|
||||
struct mount *mp;
|
||||
struct netexport *nep;
|
||||
struct export_args *argp;
|
||||
vfs_hang_addrlist(struct mount *mp, struct netexport *nep,
|
||||
struct export_args *argp)
|
||||
{
|
||||
register struct netcred *np;
|
||||
register struct radix_node_head *rnh;
|
||||
@ -1433,9 +1418,7 @@ vfs_hang_addrlist(mp, nep, argp)
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
vfs_free_netcred(rn, w)
|
||||
struct radix_node *rn;
|
||||
void *w;
|
||||
vfs_free_netcred(struct radix_node *rn, void *w)
|
||||
{
|
||||
register struct radix_node_head *rnh = (struct radix_node_head *) w;
|
||||
|
||||
@ -1448,8 +1431,7 @@ vfs_free_netcred(rn, w)
|
||||
* Free the net address hash lists that are hanging off the mount points.
|
||||
*/
|
||||
static void
|
||||
vfs_free_addrlist(nep)
|
||||
struct netexport *nep;
|
||||
vfs_free_addrlist(struct netexport *nep)
|
||||
{
|
||||
register int i;
|
||||
register struct radix_node_head *rnh;
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_init.c 8.3 (Berkeley) 1/4/94
|
||||
* $Id: vfs_init.c,v 1.12 1995/09/09 18:10:16 davidg Exp $
|
||||
* $Id: vfs_init.c,v 1.13 1995/11/09 08:13:51 bde Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -287,66 +287,26 @@ vfsinit(udata)
|
||||
/*
|
||||
* kernel related system variables.
|
||||
*/
|
||||
int
|
||||
fs_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;
|
||||
|
||||
static int
|
||||
sysctl_fs_vfsconf SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
int i;
|
||||
int error;
|
||||
int buflen = *oldlenp;
|
||||
caddr_t where = oldp, start = oldp;
|
||||
int i, error;
|
||||
|
||||
switch (name[0]) {
|
||||
case FS_VFSCONF:
|
||||
if (namelen != 1) return ENOTDIR;
|
||||
|
||||
if (oldp == NULL) {
|
||||
*oldlenp = (MOUNT_MAXTYPE+1) * sizeof(struct vfsconf);
|
||||
return 0;
|
||||
}
|
||||
if (newp) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
for(i = 0; i < MOUNT_MAXTYPE + 1; i++) {
|
||||
if(buflen < sizeof *vfsconf[i]) {
|
||||
*oldlenp = where - start;
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
error = copyout(vfsconf[i], where, sizeof *vfsconf[i]);
|
||||
if(error)
|
||||
return error;
|
||||
where += sizeof *vfsconf[i];
|
||||
buflen -= sizeof *vfsconf[i];
|
||||
}
|
||||
*oldlenp = where - start;
|
||||
return 0;
|
||||
|
||||
default:
|
||||
if(namelen < 1) return EINVAL;
|
||||
|
||||
i = name[0];
|
||||
|
||||
if(i <= MOUNT_MAXTYPE
|
||||
&& vfssw[i]
|
||||
&& vfssw[i]->vfs_sysctl) {
|
||||
return vfssw[i]->vfs_sysctl(name + 1, namelen - 1,
|
||||
oldp, oldlenp,
|
||||
newp, newlen, p);
|
||||
}
|
||||
|
||||
return (EOPNOTSUPP);
|
||||
if (req->newptr)
|
||||
return EINVAL;
|
||||
for(i = 0; i < MOUNT_MAXTYPE + 1; i++) {
|
||||
error = SYSCTL_OUT(req, vfsconf[i], sizeof *vfsconf[i]);
|
||||
if(error)
|
||||
return error;
|
||||
}
|
||||
/* NOTREACHED */
|
||||
return (error);
|
||||
|
||||
}
|
||||
|
||||
SYSCTL_PROC(_fs, FS_VFSCONF, vfsconf, CTLTYPE_OPAQUE|CTLFLAG_RD,
|
||||
0, 0, sysctl_fs_vfsconf, "");
|
||||
|
||||
/*
|
||||
* This goop is here to support a loadable NFS module... grumble...
|
||||
*/
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_subr.c 8.13 (Berkeley) 4/18/94
|
||||
* $Id: vfs_subr.c,v 1.41 1995/11/14 09:19:12 phk Exp $
|
||||
* $Id: vfs_subr.c,v 1.42 1995/11/16 09:45:23 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -175,8 +175,7 @@ vfs_unbusy(mp)
|
||||
}
|
||||
|
||||
void
|
||||
vfs_unmountroot(rootfs)
|
||||
struct mount *rootfs;
|
||||
vfs_unmountroot(struct mount *rootfs)
|
||||
{
|
||||
struct mount *mp = rootfs;
|
||||
int error;
|
||||
@ -953,9 +952,7 @@ vflush(mp, skipvp, flags)
|
||||
* Disassociate the underlying file system from a vnode.
|
||||
*/
|
||||
void
|
||||
vclean(vp, flags)
|
||||
register struct vnode *vp;
|
||||
int flags;
|
||||
vclean(struct vnode *vp, int flags)
|
||||
{
|
||||
int active;
|
||||
|
||||
@ -1247,7 +1244,7 @@ vprint(label, vp)
|
||||
* Called when debugging the kernel.
|
||||
*/
|
||||
void
|
||||
printlockedvnodes()
|
||||
printlockedvnodes(void)
|
||||
{
|
||||
register struct mount *mp;
|
||||
register struct vnode *vp;
|
||||
@ -1273,30 +1270,25 @@ int kinfo_vgetfailed;
|
||||
* Copyout address of vnode followed by vnode.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
sysctl_vnode(where, sizep)
|
||||
char *where;
|
||||
size_t *sizep;
|
||||
static int
|
||||
sysctl_vnode SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
register struct mount *mp, *nmp;
|
||||
struct vnode *vp;
|
||||
register char *bp = where, *savebp;
|
||||
char *ewhere;
|
||||
int error;
|
||||
|
||||
#define VPTRSZ sizeof (struct vnode *)
|
||||
#define VNODESZ sizeof (struct vnode)
|
||||
if (where == NULL) {
|
||||
*sizep = (numvnodes + KINFO_VNODESLOP) * (VPTRSZ + VNODESZ);
|
||||
return (0);
|
||||
}
|
||||
ewhere = where + *sizep;
|
||||
|
||||
req->lock = 0;
|
||||
if (req->oldptr) /* Make an estimate */
|
||||
return (SYSCTL_OUT(req, 0,
|
||||
(numvnodes + KINFO_VNODESLOP) * (VPTRSZ + VNODESZ)));
|
||||
|
||||
for (mp = mountlist.cqh_first; mp != (void *)&mountlist; mp = nmp) {
|
||||
nmp = mp->mnt_list.cqe_next;
|
||||
if (vfs_busy(mp))
|
||||
continue;
|
||||
savebp = bp;
|
||||
again:
|
||||
for (vp = mp->mnt_vnodelist.lh_first;
|
||||
vp != NULL;
|
||||
@ -1309,29 +1301,24 @@ sysctl_vnode(where, sizep)
|
||||
if (vp->v_mount != mp) {
|
||||
if (kinfo_vdebug)
|
||||
printf("kinfo: vp changed\n");
|
||||
bp = savebp;
|
||||
goto again;
|
||||
}
|
||||
if (bp + VPTRSZ + VNODESZ > ewhere) {
|
||||
if ((error = SYSCTL_OUT(req, &vp, VPTRSZ)) ||
|
||||
(error = SYSCTL_OUT(req, vp, VNODESZ))) {
|
||||
vfs_unbusy(mp);
|
||||
*sizep = bp - where;
|
||||
return (ENOMEM);
|
||||
}
|
||||
if ((error = copyout(&vp, bp, VPTRSZ)) ||
|
||||
(error = copyout(vp, bp + VPTRSZ, VNODESZ))) {
|
||||
vfs_unbusy(mp);
|
||||
*sizep = bp - where;
|
||||
return (error);
|
||||
}
|
||||
bp += VPTRSZ + VNODESZ;
|
||||
}
|
||||
vfs_unbusy(mp);
|
||||
}
|
||||
|
||||
*sizep = bp - where;
|
||||
return (0);
|
||||
}
|
||||
|
||||
SYSCTL_NODE(_kern, KERN_VNODE, vnode, CTLTYPE_OPAQUE|CTLFLAG_RD,
|
||||
sysctl_vnode, "");
|
||||
|
||||
|
||||
/*
|
||||
* Check to see if a filesystem is mounted on a block device.
|
||||
*/
|
||||
@ -1360,10 +1347,8 @@ vfs_mountedon(vp)
|
||||
* Called by ufs_mount() to set up the lists of export addresses.
|
||||
*/
|
||||
static int
|
||||
vfs_hang_addrlist(mp, nep, argp)
|
||||
struct mount *mp;
|
||||
struct netexport *nep;
|
||||
struct export_args *argp;
|
||||
vfs_hang_addrlist(struct mount *mp, struct netexport *nep,
|
||||
struct export_args *argp)
|
||||
{
|
||||
register struct netcred *np;
|
||||
register struct radix_node_head *rnh;
|
||||
@ -1433,9 +1418,7 @@ vfs_hang_addrlist(mp, nep, argp)
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
vfs_free_netcred(rn, w)
|
||||
struct radix_node *rn;
|
||||
void *w;
|
||||
vfs_free_netcred(struct radix_node *rn, void *w)
|
||||
{
|
||||
register struct radix_node_head *rnh = (struct radix_node_head *) w;
|
||||
|
||||
@ -1448,8 +1431,7 @@ vfs_free_netcred(rn, w)
|
||||
* Free the net address hash lists that are hanging off the mount points.
|
||||
*/
|
||||
static void
|
||||
vfs_free_addrlist(nep)
|
||||
struct netexport *nep;
|
||||
vfs_free_addrlist(struct netexport *nep)
|
||||
{
|
||||
register int i;
|
||||
register struct radix_node_head *rnh;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** $Id: pci.c,v 1.31 1995/09/14 23:24:29 se Exp $
|
||||
** $Id: pci.c,v 1.32 1995/10/02 13:43:11 davidg Exp $
|
||||
**
|
||||
** General subroutines for the PCI bus.
|
||||
** pci_configure ()
|
||||
@ -51,6 +51,7 @@
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/proc.h> /* declaration of wakeup(), used by vm.h */
|
||||
#include <sys/devconf.h>
|
||||
|
||||
@ -109,11 +110,9 @@ struct pcicb {
|
||||
u_long pcicb_p_memlimit;
|
||||
};
|
||||
|
||||
static int
|
||||
pci_externalize (struct proc *, struct kern_devconf *, void *, size_t);
|
||||
static int pci_externalize (struct kern_devconf *, struct sysctl_req *);
|
||||
|
||||
static int
|
||||
pci_internalize (struct proc *, struct kern_devconf *, void *, size_t);
|
||||
static int pci_internalize (struct kern_devconf *, struct sysctl_req *);
|
||||
|
||||
static void
|
||||
not_supported (pcici_t tag, u_long type);
|
||||
@ -1091,17 +1090,13 @@ int pci_map_mem (pcici_t tag, u_long reg, vm_offset_t* va, vm_offset_t* pa)
|
||||
*/
|
||||
|
||||
static int
|
||||
pci_externalize (struct proc *p, struct kern_devconf *kdcp, void *u, size_t l)
|
||||
pci_externalize (struct kern_devconf *kdcp, struct sysctl_req *req)
|
||||
{
|
||||
struct pci_externalize_buffer buffer;
|
||||
struct pci_info * pip = kdcp->kdc_parentdata;
|
||||
pcici_t tag;
|
||||
int i;
|
||||
|
||||
if (l < sizeof buffer) {
|
||||
return ENOMEM;
|
||||
};
|
||||
|
||||
tag = pcibus->pb_tag (pip->pi_bus, pip->pi_device, 0);
|
||||
|
||||
buffer.peb_pci_info = *pip;
|
||||
@ -1110,12 +1105,12 @@ pci_externalize (struct proc *p, struct kern_devconf *kdcp, void *u, size_t l)
|
||||
buffer.peb_config[i] = pcibus->pb_read (tag, i*4);
|
||||
};
|
||||
|
||||
return copyout(&buffer, u, sizeof buffer);
|
||||
return SYSCTL_OUT(req, &buffer, sizeof buffer);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
pci_internalize (struct proc *p, struct kern_devconf *kdcp, void *u, size_t s)
|
||||
pci_internalize (struct kern_devconf *kdcp, struct sysctl_req *re)
|
||||
{
|
||||
return EOPNOTSUPP;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
|
||||
*
|
||||
* $Id: cd.c,v 1.43 1995/11/15 03:27:14 asami Exp $
|
||||
* $Id: cd.c,v 1.44 1995/11/19 22:22:18 dyson Exp $
|
||||
*/
|
||||
|
||||
#define SPLCD splbio
|
||||
@ -128,11 +128,9 @@ static struct scsi_device cd_switch =
|
||||
#define CD_EJECT -2
|
||||
|
||||
static int
|
||||
cd_externalize(struct proc *p, struct kern_devconf *kdc, void *userp,
|
||||
size_t len)
|
||||
cd_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
|
||||
{
|
||||
return scsi_externalize(SCSI_LINK(&cd_switch, kdc->kdc_unit),
|
||||
userp, &len);
|
||||
return scsi_externalize(SCSI_LINK(&cd_switch, kdc->kdc_unit), req);
|
||||
}
|
||||
|
||||
static struct kern_devconf kdc_cd_template = {
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Written by grefen@?????
|
||||
* Based on scsi drivers by Julian Elischer (julian@tfs.com)
|
||||
*
|
||||
* $Id: ch.c,v 1.20 1995/05/11 19:26:46 rgrimes Exp $
|
||||
* $Id: ch.c,v 1.21 1995/05/30 08:13:22 rgrimes Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -95,11 +95,9 @@ struct scsi_device ch_switch =
|
||||
#define CH_OPEN 0x01
|
||||
|
||||
static int
|
||||
ch_externalize(struct proc *p, struct kern_devconf *kdc, void *userp,
|
||||
size_t len)
|
||||
ch_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
|
||||
{
|
||||
return scsi_externalize(SCSI_LINK(&ch_switch, kdc->kdc_unit),
|
||||
userp, &len);
|
||||
return scsi_externalize(SCSI_LINK(&ch_switch, kdc->kdc_unit), req);
|
||||
}
|
||||
|
||||
static struct kern_devconf kdc_ch_template = {
|
||||
|
@ -28,7 +28,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: od.c,v 1.1 1995/10/31 17:25:58 joerg Exp $
|
||||
* $Id: od.c,v 1.2 1995/11/19 22:22:21 dyson Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -136,11 +136,9 @@ struct scsi_device od_switch =
|
||||
static struct scsi_xfer sx;
|
||||
|
||||
static int
|
||||
od_externalize(struct proc *p, struct kern_devconf *kdc, void *userp,
|
||||
size_t len)
|
||||
od_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
|
||||
{
|
||||
return scsi_externalize(SCSI_LINK(&od_switch, kdc->kdc_unit),
|
||||
userp, &len);
|
||||
return scsi_externalize(SCSI_LINK(&od_switch, kdc->kdc_unit), req);
|
||||
}
|
||||
|
||||
static struct kern_devconf kdc_od_template = {
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* New configuration setup: dufault@hda.com
|
||||
*
|
||||
* $Id: scsiconf.c,v 1.35 1995/10/09 15:14:59 joerg Exp $
|
||||
* $Id: scsiconf.c,v 1.36 1995/10/31 17:21:00 joerg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -24,6 +24,7 @@
|
||||
#include <sys/systm.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/devconf.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
@ -62,7 +63,6 @@ struct extend_array
|
||||
void **ps;
|
||||
};
|
||||
|
||||
static errval scsi_attach_sctarg __P((void));
|
||||
|
||||
static void *
|
||||
extend_alloc(size_t s)
|
||||
@ -602,7 +602,8 @@ scsi_bus_conf(sc_link_proto)
|
||||
"Scbus will be assigned dynamically.\n",
|
||||
sc_link_proto->adapter->name,
|
||||
sc_link_proto->adapter_unit,
|
||||
sc_link_proto->adapter_bus);
|
||||
sc_link_proto->adapter_bus,
|
||||
sc_link_proto->adapter_bus );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -683,6 +684,10 @@ scsi_configure_start(void)
|
||||
scsi_init();
|
||||
}
|
||||
|
||||
#if NSCTARG > 0
|
||||
static errval scsi_attach_sctarg __P((void));
|
||||
#endif
|
||||
|
||||
void
|
||||
scsi_configure_finish(void)
|
||||
{
|
||||
@ -1421,12 +1426,7 @@ scsi_selectdev(qualifier, type, remov, manu, model, rev)
|
||||
}
|
||||
|
||||
int
|
||||
scsi_externalize(struct scsi_link *sl, void *userp, size_t *lenp)
|
||||
scsi_externalize(struct scsi_link *sl, struct sysctl_req *req)
|
||||
{
|
||||
if(*lenp < sizeof *sl)
|
||||
return ENOMEM;
|
||||
|
||||
*lenp -= sizeof *sl;
|
||||
|
||||
return copyout(sl, userp, sizeof *sl);
|
||||
return SYSCTL_OUT(req, sl, sizeof *sl);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
|
||||
*
|
||||
* $Id: scsiconf.h,v 1.28 1995/08/23 23:03:34 gibbs Exp $
|
||||
* $Id: scsiconf.h,v 1.29 1995/10/21 23:13:07 phk Exp $
|
||||
*/
|
||||
#ifndef SCSI_SCSICONF_H
|
||||
#define SCSI_SCSICONF_H 1
|
||||
@ -465,7 +465,7 @@ void sc_print_addr __P((struct scsi_link *));
|
||||
void sc_print_start __P((struct scsi_link *));
|
||||
void sc_print_finish __P((void));
|
||||
|
||||
extern int scsi_externalize __P((struct scsi_link *, void *, size_t *));
|
||||
extern int scsi_externalize __P((struct scsi_link *, struct sysctl_req *));
|
||||
|
||||
void scsi_device_register __P((struct scsi_device *sd));
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
* Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
|
||||
*
|
||||
* $Id: sd.c,v 1.70 1995/11/19 22:22:28 dyson Exp $
|
||||
* $Id: sd.c,v 1.71 1995/11/20 02:12:34 davidg Exp $
|
||||
*/
|
||||
|
||||
#define SPLSD splbio
|
||||
@ -113,11 +113,9 @@ static struct scsi_device sd_switch =
|
||||
static struct scsi_xfer sx;
|
||||
|
||||
static int
|
||||
sd_externalize(struct proc *p, struct kern_devconf *kdc, void *userp,
|
||||
size_t len)
|
||||
sd_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
|
||||
{
|
||||
return scsi_externalize(SCSI_LINK(&sd_switch, kdc->kdc_unit),
|
||||
userp, &len);
|
||||
return scsi_externalize(SCSI_LINK(&sd_switch, kdc->kdc_unit), req);
|
||||
}
|
||||
|
||||
static struct kern_devconf kdc_sd_template = {
|
||||
|
@ -12,7 +12,7 @@
|
||||
* on the understanding that TFS is not responsible for the correct
|
||||
* functioning of this software in any circumstances.
|
||||
*
|
||||
* $Id: st.c,v 1.42 1995/11/04 13:25:23 bde Exp $
|
||||
* $Id: st.c,v 1.43 1995/11/19 22:22:32 dyson Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -285,11 +285,9 @@ static struct scsi_device st_switch =
|
||||
ST_FM_WRITTEN | ST_2FM_AT_EOD | ST_PER_ACTION)
|
||||
|
||||
static int
|
||||
st_externalize(struct proc *p, struct kern_devconf *kdc, void *userp,
|
||||
size_t len)
|
||||
st_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
|
||||
{
|
||||
return scsi_externalize(SCSI_LINK(&st_switch, kdc->kdc_unit),
|
||||
userp, &len);
|
||||
return scsi_externalize(SCSI_LINK(&st_switch, kdc->kdc_unit), req);
|
||||
}
|
||||
|
||||
static struct kern_devconf kdc_st_template = {
|
||||
|
@ -22,7 +22,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: devconf.h,v 1.5 1995/04/12 20:47:13 wollman Exp $
|
||||
* $Id: devconf.h,v 1.6 1995/04/13 20:37:51 wollman Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -99,14 +99,13 @@ struct kern_devconf; /* forward declaration */
|
||||
* EXTERNALIZE: convert internal representation to external and copy out
|
||||
* into user space.
|
||||
*/
|
||||
typedef int (*kdc_externalize_t)(struct proc *, struct kern_devconf *, void *,
|
||||
size_t);
|
||||
struct sysctl_req;
|
||||
typedef int (*kdc_externalize_t)(struct kern_devconf *, struct sysctl_req *);
|
||||
/*
|
||||
* INTERNALIZE: copy in from user space, convert to internal representation,
|
||||
* validate, and set configuration.
|
||||
*/
|
||||
typedef int (*kdc_internalize_t)(struct proc *, struct kern_devconf *, void *,
|
||||
size_t);
|
||||
typedef int (*kdc_internalize_t)(struct kern_devconf *, struct sysctl_req *);
|
||||
/*
|
||||
* GOAWAY: shut the device down, if possible, and prepare to exit.
|
||||
*/
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)sysctl.h 8.1 (Berkeley) 6/2/93
|
||||
* $Id: sysctl.h,v 1.33 1995/11/14 09:42:10 phk Exp $
|
||||
* $Id: sysctl.h,v 1.34 1995/11/16 19:00:27 phk Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SYSCTL_H_
|
||||
@ -86,6 +86,7 @@ struct ctlname {
|
||||
*/
|
||||
struct sysctl_req {
|
||||
struct proc *p;
|
||||
int lock;
|
||||
void *oldptr;
|
||||
int oldlen;
|
||||
int oldidx;
|
||||
@ -362,33 +363,11 @@ extern char ostype[];
|
||||
|
||||
int userland_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *oldlenp, int inkernel, void *new, size_t newlen, int *retval);
|
||||
/*
|
||||
* Internal sysctl function calling convention:
|
||||
*
|
||||
* (*sysctlfn)(name, namelen, oldval, oldlenp, newval, newlen, p);
|
||||
*
|
||||
* The name parameter points at the next component of the name to be
|
||||
* interpreted. The namelen parameter is the number of integers in
|
||||
* the name.
|
||||
*/
|
||||
typedef int (sysctlfn)
|
||||
__P((int *, u_int, void *, size_t *, void *, size_t, struct proc *));
|
||||
|
||||
sysctlfn dev_sysctl;
|
||||
sysctlfn fs_sysctl;
|
||||
sysctlfn hw_sysctl;
|
||||
|
||||
int sysctl_int __P((void *, size_t *, void *, size_t, int *));
|
||||
int sysctl_rdint __P((void *, size_t *, void *, int));
|
||||
int sysctl_string __P((void *, size_t *, void *, size_t, char *, int));
|
||||
int sysctl_rdstring __P((void *, size_t *, void *, char *));
|
||||
int sysctl_rdstruct __P((void *, size_t *, void *, void *, int));
|
||||
int sysctl_struct __P((void *oldp, size_t *, void *, size_t, void *, int));
|
||||
|
||||
int sysctl_clockrate __P((char *, size_t*));
|
||||
int sysctl_vnode __P((char *, size_t*));
|
||||
int sysctl_file __P((char *, size_t*));
|
||||
int sysctl_doproc __P((int *, u_int, char *, size_t*));
|
||||
int sysctl_doprof __P((int *, u_int, void *, size_t *, void *, size_t));
|
||||
*/
|
||||
|
||||
#else /* !KERNEL */
|
||||
#include <sys/cdefs.h>
|
||||
|
Loading…
Reference in New Issue
Block a user