Add a prioritization field to the devstat_add_entry() call so that

peripheral drivers can determine where in the devstat(9) list they are
inserted.

This requires recompilation of libdevstat, systat, vmstat, rpc.rstatd, and
any ports that depend on the devstat code, since the size of the devstat
structure has changed.  The devstat version number has been incremented as
well to reflect the change.

This sorts devices in the devstat list in "more interesting" to "less
interesting" order.  So, for instance, da devices are now more important
than floppy drives, and so will appear before floppy drives in the default
output from systat, iostat, vmstat, etc.

The order of devices is, for now, kept in a central table in devicestat.h.
If individual drivers were able to make a meaningful decision on what
priority they should be at attach time, we could consider splitting the
priority information out into the various drivers.  For now, though, they
have no way of knowing that, so it's easier to put them in an easy to find
table.

Also, move the checkversion() call in vmstat(8) to a more logical place.

Thanks to Bruce and David O'Brien for suggestions, for reviewing this, and
for putting up with the long time it has taken me to commit it.  Bruce did
object somewhat to the central priority table (he would rather the
priorities be distributed in each driver), so his objection is duly noted
here.

Reviewed by:	bde, obrien
This commit is contained in:
Kenneth D. Merry 1999-02-10 00:04:13 +00:00
parent 9b8eb63431
commit 2a888f938e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=43819
24 changed files with 201 additions and 67 deletions

View File

@ -1,5 +1,5 @@
.\"
.\" Copyright (c) 1998 Kenneth D. Merry.
.\" Copyright (c) 1998, 1999 Kenneth D. Merry.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id$
.\" $Id: devstat.9,v 1.1 1998/09/15 06:49:18 gibbs Exp $
.\"
.Dd May 22, 1998
.Dt DEVSTAT 9
@ -43,6 +43,7 @@
.Fa "u_int32_t block_size"
.Fa "devstat_support_flags flags"
.Fa "devstat_type_flags device_type"
.Fa "devstat_priority priority"
.Fc
.Ft void
.Fn devstat_remove_entry "struct devstat *ds"
@ -56,7 +57,7 @@
.Fa "devstat_trans_flags flags"
.Fc
.Sh DESCRIPTION
The devstat subsystem is basically an interface for recording device
The devstat subsystem is an interface for recording device
statistics, as its name implies. The idea is to keep reasonably detailed
statistics while utilizing a minimum amount of CPU time to record them.
Thus, no statistical calculations are actually performed in the kernel
@ -94,6 +95,13 @@ The device type. This is broken into three sections: base device type
(e.g. direct access, CDROM, sequential access), interface type (IDE, SCSI
or other) and a passthrough flag to indicate pasthrough devices. See below
for a complete list of types.
.It priority
The device priority. The priority is used to determine how devices are
sorted within
.Nm devstat's
list of devices. Devices are sorted first by priority (highest to lowest),
and then by attach order. See below for a complete list of available
priorities.
.El
.Pp
.Fn devstat_remove_entry
@ -219,6 +227,12 @@ This is the device type. It consists of three parts: the device type
(e.g. direct access, CDROM, sequential access, etc.), the interface (IDE,
SCSI or other) and whether or not the device in question is a passthrough
driver. See below for a complete list of device types.
.It priority
This is the priority. This is the first parameter used to determine where
to insert a device in the
.Nm devstat
list. The second parameter is attach order. See below for a list of
available priorities.
.El
.Pp
Each device is given a device type. Passthrough devices have the same
@ -259,6 +273,28 @@ typedef enum {
} devstat_type_flags;
.Ed
.Pp
Devices have a priority associated with them, which controls roughly where
they are placed in the
.Nm devstat
list. The priorities are as follows:
.Bd -literal -offset indent
typedef enum {
DEVSTAT_PRIORITY_MIN = 0x000,
DEVSTAT_PRIORITY_OTHER = 0x020,
DEVSTAT_PRIORITY_PASS = 0x030,
DEVSTAT_PRIORITY_FD = 0x040,
DEVSTAT_PRIORITY_WFD = 0x050,
DEVSTAT_PRIORITY_SA = 0x060,
DEVSTAT_PRIORITY_OCD = 0x070,
DEVSTAT_PRIORITY_WCD = 0x080,
DEVSTAT_PRIORITY_CD = 0x090,
DEVSTAT_PRIORITY_WD = 0x100,
DEVSTAT_PRIORITY_DA = 0x110,
DEVSTAT_PRIORITY_CCD = 0x120,
DEVSTAT_PRIORITY_MAX = 0xfff
} devstat_priority;
.Ed
.Pp
Each device has associated with it flags to indicate what operations are
supported or not supported. The
.Va devstat_support_flags

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1997 Justin T. Gibbs.
* Copyright (c) 1997, 1998 Kenneth D. Merry.
* Copyright (c) 1997, 1998, 1999 Kenneth D. Merry.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_cd.c,v 1.13 1999/01/11 17:45:22 eivind Exp $
* $Id: scsi_cd.c,v 1.14 1999/01/12 16:26:19 eivind Exp $
*/
/*
* Portions of this driver taken from the original FreeBSD cd driver.
@ -631,7 +631,8 @@ cdregister(struct cam_periph *periph, void *arg)
devstat_add_entry(&softc->device_stats, "cd",
periph->unit_number, 0,
DEVSTAT_BS_UNAVAILABLE,
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_SCSI);
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_SCSI,
DEVSTAT_PRIORITY_CD);
/*
* Add an async callback so that we get

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1997 Justin T. Gibbs.
* Copyright (c) 1997, 1998 Kenneth D. Merry.
* Copyright (c) 1997, 1998, 1999 Kenneth D. Merry.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_ch.c,v 1.8 1998/12/12 23:52:46 gibbs Exp $
* $Id: scsi_ch.c,v 1.9 1998/12/22 20:05:23 eivind Exp $
*/
/*
* Derived from the NetBSD SCSI changer driver.
@ -414,7 +414,8 @@ chregister(struct cam_periph *periph, void *arg)
devstat_add_entry(&softc->device_stats, "ch",
periph->unit_number, 0,
DEVSTAT_NO_BLOCKSIZE | DEVSTAT_NO_ORDERED_TAGS,
cgd->pd_type | DEVSTAT_TYPE_IF_SCSI);
cgd->pd_type | DEVSTAT_TYPE_IF_SCSI,
DEVSTAT_PRIORITY_OTHER);
/*
* Add an async callback so that we get

View File

@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_da.c,v 1.18 1999/01/05 20:43:41 mjacob Exp $
* $Id: scsi_da.c,v 1.19 1999/01/07 20:19:09 mjacob Exp $
*/
#include "opt_hw_wdog.h"
@ -1030,7 +1030,8 @@ daregister(struct cam_periph *periph, void *arg)
devstat_add_entry(&softc->device_stats, "da",
periph->unit_number, 0,
DEVSTAT_BS_UNAVAILABLE,
cgd->pd_type | DEVSTAT_TYPE_IF_SCSI);
cgd->pd_type | DEVSTAT_TYPE_IF_SCSI,
DEVSTAT_PRIORITY_DA);
/*
* Add async callbacks for bus reset and

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1997, 1998 Justin T. Gibbs.
* Copyright (c) 1997, 1998 Kenneth D. Merry.
* Copyright (c) 1997, 1998, 1999 Kenneth D. Merry.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_pass.c,v 1.4 1998/10/22 22:16:56 ken Exp $
* $Id: scsi_pass.c,v 1.5 1998/11/22 23:44:47 ken Exp $
*/
#include <sys/param.h>
@ -355,7 +355,8 @@ passregister(struct cam_periph *periph, void *arg)
0, DEVSTAT_NO_BLOCKSIZE | DEVSTAT_NO_ORDERED_TAGS,
cgd->pd_type |
DEVSTAT_TYPE_IF_SCSI |
DEVSTAT_TYPE_PASS);
DEVSTAT_TYPE_PASS,
DEVSTAT_PRIORITY_PASS);
/*
* Add an async callback so that we get
* notified if this device goes away.

View File

@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_pt.c,v 1.3 1998/10/22 22:16:56 ken Exp $
* $Id: scsi_pt.c,v 1.4 1998/11/22 23:44:47 ken Exp $
*/
#include <sys/param.h>
@ -372,7 +372,8 @@ ptctor(struct cam_periph *periph, void *arg)
devstat_add_entry(&softc->device_stats, "pt",
periph->unit_number, 0,
DEVSTAT_NO_BLOCKSIZE,
cgd->pd_type | DEVSTAT_TYPE_IF_SCSI);
cgd->pd_type | DEVSTAT_TYPE_IF_SCSI,
DEVSTAT_PRIORITY_OTHER);
/*
* Add async callbacks for bus reset and

View File

@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_sa.c,v 1.17 1999/02/05 07:32:52 mjacob Exp $
* $Id: scsi_sa.c,v 1.18 1999/02/05 08:49:34 mjacob Exp $
*/
#include <sys/param.h>
@ -1242,7 +1242,8 @@ saregister(struct cam_periph *periph, void *arg)
devstat_add_entry(&softc->device_stats, "sa",
periph->unit_number, 0,
DEVSTAT_BS_UNAVAILABLE,
cgd->pd_type | DEVSTAT_TYPE_IF_SCSI);
cgd->pd_type | DEVSTAT_TYPE_IF_SCSI,
DEVSTAT_PRIORITY_SA);
/*
* Add an async callback so that we get

View File

@ -1,4 +1,4 @@
/* $Id: ccd.c,v 1.38 1999/01/22 22:38:28 peter Exp $ */
/* $Id: ccd.c,v 1.39 1999/01/27 20:09:17 dillon Exp $ */
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
@ -500,7 +500,8 @@ ccdinit(ccd, cpaths, p)
*/
devstat_add_entry(&cs->device_stats, "ccd", ccd->ccd_unit,
ccg->ccg_secsize, DEVSTAT_ALL_SUPPORTED,
DEVSTAT_TYPE_ASC0 |DEVSTAT_TYPE_IF_OTHER);
DEVSTAT_TYPE_ASC0 |DEVSTAT_TYPE_IF_OTHER,
DEVSTAT_PRIORITY_OTHER);
cs->sc_flags |= CCDF_INITED;
cs->sc_cflags = ccd->ccd_flags; /* So we can find out later... */

View File

@ -47,7 +47,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.131 1999/01/15 09:15:27 bde Exp $
* $Id: fd.c,v 1.132 1999/01/19 00:21:36 peter Exp $
*
*/
@ -869,7 +869,8 @@ fdattach(struct isa_device *dev)
devstat_add_entry(&fd->device_stats, "fd",
fdu, 512,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER);
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER,
DEVSTAT_PRIORITY_FD);
}

View File

@ -1,4 +1,4 @@
/* $Id: ccd.c,v 1.38 1999/01/22 22:38:28 peter Exp $ */
/* $Id: ccd.c,v 1.39 1999/01/27 20:09:17 dillon Exp $ */
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
@ -500,7 +500,8 @@ ccdinit(ccd, cpaths, p)
*/
devstat_add_entry(&cs->device_stats, "ccd", ccd->ccd_unit,
ccg->ccg_secsize, DEVSTAT_ALL_SUPPORTED,
DEVSTAT_TYPE_ASC0 |DEVSTAT_TYPE_IF_OTHER);
DEVSTAT_TYPE_ASC0 |DEVSTAT_TYPE_IF_OTHER,
DEVSTAT_PRIORITY_OTHER);
cs->sc_flags |= CCDF_INITED;
cs->sc_cflags = ccd->ccd_flags; /* So we can find out later... */

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: atapi-cd.c,v 1.9 1999/01/31 21:51:03 sos Exp $
* $Id: atapi-cd.c,v 1.10 1999/01/31 23:08:47 sos Exp $
*/
#include "wdc.h"
@ -265,13 +265,15 @@ acdattach(struct atapi *ata, int unit, struct atapi_params *ap, int debug)
sprintf(string, "acd%d-", cdp->lun);
devstat_add_entry(cdp->device_stats, string, tmpcdp->lun, DEV_BSIZE,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE);
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_WCD);
}
else {
acdnlun++;
devstat_add_entry(cdp->device_stats, "acd", cdp->lun, DEV_BSIZE,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE);
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_WCD);
}
return 1;
}

View File

@ -47,7 +47,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.131 1999/01/15 09:15:27 bde Exp $
* $Id: fd.c,v 1.132 1999/01/19 00:21:36 peter Exp $
*
*/
@ -869,7 +869,8 @@ fdattach(struct isa_device *dev)
devstat_add_entry(&fd->device_stats, "fd",
fdu, 512,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER);
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER,
DEVSTAT_PRIORITY_FD);
}

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
* $Id: wd.c,v 1.186 1999/01/17 05:46:24 bde Exp $
* $Id: wd.c,v 1.187 1999/01/27 19:32:34 julian Exp $
*/
/* TODO:
@ -549,7 +549,9 @@ wdattach(struct isa_device *dvp)
devstat_add_entry(&du->dk_stats, "wd",
lunit, du->dk_dd.d_secsize,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_IDE);
DEVSTAT_TYPE_DIRECT |
DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_WD);
} else {
free(du, M_TEMP);

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: atapi-cd.c,v 1.9 1999/01/31 21:51:03 sos Exp $
* $Id: atapi-cd.c,v 1.10 1999/01/31 23:08:47 sos Exp $
*/
#include "wdc.h"
@ -265,13 +265,15 @@ acdattach(struct atapi *ata, int unit, struct atapi_params *ap, int debug)
sprintf(string, "acd%d-", cdp->lun);
devstat_add_entry(cdp->device_stats, string, tmpcdp->lun, DEV_BSIZE,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE);
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_WCD);
}
else {
acdnlun++;
devstat_add_entry(cdp->device_stats, "acd", cdp->lun, DEV_BSIZE,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE);
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_WCD);
}
return 1;
}

View File

@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: wfd.c,v 1.17 1998/12/07 21:58:24 archie Exp $
* $Id: wfd.c,v 1.18 1999/01/30 12:21:44 phk Exp $
*/
/*
@ -273,7 +273,8 @@ wfdattach (struct atapi *ata, int unit, struct atapi_params *ap, int debug)
devstat_add_entry(&t->device_stats, "wfd",
wfdnlun, t->cap.sector_size,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_IDE);
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_WFD);
return (1);
}

View File

@ -47,7 +47,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.131 1999/01/15 09:15:27 bde Exp $
* $Id: fd.c,v 1.132 1999/01/19 00:21:36 peter Exp $
*
*/
@ -869,7 +869,8 @@ fdattach(struct isa_device *dev)
devstat_add_entry(&fd->device_stats, "fd",
fdu, 512,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER);
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER,
DEVSTAT_PRIORITY_FD);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1998 Kenneth D. Merry.
* Copyright (c) 1997, 1998, 1999 Kenneth D. Merry.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: subr_devstat.c,v 1.7 1998/12/04 22:54:51 archie Exp $
* $Id: subr_devstat.c,v 1.8 1998/12/27 18:03:29 dfr Exp $
*/
#include <sys/param.h>
@ -52,10 +52,12 @@ void
devstat_add_entry(struct devstat *ds, const char *dev_name,
int unit_number, u_int32_t block_size,
devstat_support_flags flags,
devstat_type_flags device_type)
devstat_type_flags device_type,
devstat_priority priority)
{
int s;
struct devstatlist *devstat_head;
struct devstat *ds_tmp;
if (ds == NULL)
return;
@ -68,15 +70,67 @@ devstat_add_entry(struct devstat *ds, const char *dev_name,
devstat_head = &device_statq;
STAILQ_INSERT_TAIL(devstat_head, ds, dev_links);
/*
* Priority sort. Each driver passes in its priority when it adds
* its devstat entry. Drivers are sorted first by priority, and
* then by probe order.
*
* For the first device, we just insert it, since the priority
* doesn't really matter yet. Subsequent devices are inserted into
* the list using the order outlined above.
*/
if (devstat_num_devs == 1)
STAILQ_INSERT_TAIL(devstat_head, ds, dev_links);
else {
for (ds_tmp = STAILQ_FIRST(devstat_head); ds_tmp != NULL;
ds_tmp = STAILQ_NEXT(ds_tmp, dev_links)) {
struct devstat *ds_next;
ds_next = STAILQ_NEXT(ds_tmp, dev_links);
/*
* If we find a break between higher and lower
* priority items, and if this item fits in the
* break, insert it. This also applies if the
* "lower priority item" is the end of the list.
*/
if ((priority <= ds_tmp->priority)
&& ((ds_next == NULL)
|| (priority > ds_next->priority))) {
STAILQ_INSERT_AFTER(devstat_head, ds_tmp, ds,
dev_links);
break;
} else if (priority > ds_tmp->priority) {
/*
* If this is the case, we should be able
* to insert ourselves at the head of the
* list. If we can't, something is wrong.
*/
if (ds_tmp == STAILQ_FIRST(devstat_head)) {
STAILQ_INSERT_HEAD(devstat_head,
ds, dev_links);
break;
} else {
STAILQ_INSERT_TAIL(devstat_head,
ds, dev_links);
printf("devstat_add_entry: HELP! "
"sorting problem detected "
"for %s%d\n", dev_name,
unit_number);
break;
}
}
}
}
ds->device_number = devstat_current_devnumber++;
ds->unit_number = unit_number;
strncpy(ds->device_name, dev_name, DEVSTAT_NAME_LEN);
ds->device_name[DEVSTAT_NAME_LEN - 1] = 0;
ds->device_name[DEVSTAT_NAME_LEN - 1] = '\0';
ds->block_size = block_size;
ds->flags = flags;
ds->device_type = device_type;
ds->priority = priority;
s = splclock();
getmicrotime(&ds->dev_creation_time);

View File

@ -47,7 +47,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.50 1999/01/19 00:21:50 peter Exp $
* $Id: fd.c,v 1.51 1999/01/28 11:24:36 kato Exp $
*
*/
@ -1160,7 +1160,8 @@ fdattach(struct isa_device *dev)
devstat_add_entry(&fd->device_stats, "fd",
fdu, 512,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER);
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER,
DEVSTAT_PRIORITY_FD);
}

View File

@ -47,7 +47,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.50 1999/01/19 00:21:50 peter Exp $
* $Id: fd.c,v 1.51 1999/01/28 11:24:36 kato Exp $
*
*/
@ -1160,7 +1160,8 @@ fdattach(struct isa_device *dev)
devstat_add_entry(&fd->device_stats, "fd",
fdu, 512,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER);
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER,
DEVSTAT_PRIORITY_FD);
}

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
* $Id: wd.c,v 1.71 1999/01/17 12:24:48 kato Exp $
* $Id: wd.c,v 1.73 1999/01/28 13:32:07 kato Exp $
*/
/* TODO:
@ -644,7 +644,9 @@ wdattach(struct isa_device *dvp)
devstat_add_entry(&du->dk_stats, "wd",
lunit, du->dk_dd.d_secsize,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_IDE);
DEVSTAT_TYPE_DIRECT |
DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_WD);
} else {
free(du, M_TEMP);

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: atapi-cd.c,v 1.9 1999/01/31 21:51:03 sos Exp $
* $Id: atapi-cd.c,v 1.10 1999/01/31 23:08:47 sos Exp $
*/
#include "wdc.h"
@ -265,13 +265,15 @@ acdattach(struct atapi *ata, int unit, struct atapi_params *ap, int debug)
sprintf(string, "acd%d-", cdp->lun);
devstat_add_entry(cdp->device_stats, string, tmpcdp->lun, DEV_BSIZE,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE);
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_WCD);
}
else {
acdnlun++;
devstat_add_entry(cdp->device_stats, "acd", cdp->lun, DEV_BSIZE,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE);
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_WCD);
}
return 1;
}

View File

@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: wfd.c,v 1.17 1998/12/07 21:58:24 archie Exp $
* $Id: wfd.c,v 1.18 1999/01/30 12:21:44 phk Exp $
*/
/*
@ -273,7 +273,8 @@ wfdattach (struct atapi *ata, int unit, struct atapi_params *ap, int debug)
devstat_add_entry(&t->device_stats, "wfd",
wfdnlun, t->cap.sector_size,
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_IDE);
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_WFD);
return (1);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 1998 Kenneth D. Merry.
* Copyright (c) 1997, 1998, 1999 Kenneth D. Merry.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: devicestat.h,v 1.2 1998/09/20 00:10:58 ken Exp $
* $Id: devicestat.h,v 1.3 1998/11/14 21:58:41 wollman Exp $
*/
#ifndef _DEVICESTAT_H
@ -45,7 +45,7 @@
* userland utilities to determine whether or not they are in sync with the
* kernel.
*/
#define DEVSTAT_VERSION 2
#define DEVSTAT_VERSION 3
/*
* These flags specify which statistics features are supported or not
@ -72,6 +72,22 @@ typedef enum {
DEVSTAT_TAG_NONE = 0x03
} devstat_tag_type;
typedef enum {
DEVSTAT_PRIORITY_MIN = 0x000,
DEVSTAT_PRIORITY_OTHER = 0x020,
DEVSTAT_PRIORITY_PASS = 0x030,
DEVSTAT_PRIORITY_FD = 0x040,
DEVSTAT_PRIORITY_WFD = 0x050,
DEVSTAT_PRIORITY_SA = 0x060,
DEVSTAT_PRIORITY_OCD = 0x070,
DEVSTAT_PRIORITY_WCD = 0x080,
DEVSTAT_PRIORITY_CD = 0x090,
DEVSTAT_PRIORITY_WD = 0x100,
DEVSTAT_PRIORITY_DA = 0x110,
DEVSTAT_PRIORITY_CCD = 0x120,
DEVSTAT_PRIORITY_MAX = 0xfff
} devstat_priority;
/*
* These types are intended to aid statistics gathering/display programs.
* The first 13 types (up to the 'target' flag) are identical numerically
@ -179,13 +195,15 @@ struct devstat {
* given device.
*/
devstat_type_flags device_type; /* Device type */
devstat_priority priority; /* Controls list pos. */
};
#ifdef KERNEL
void devstat_add_entry(struct devstat *ds, const char *dev_name,
int unit_number, u_int32_t block_size,
devstat_support_flags flags,
devstat_type_flags device_type);
devstat_type_flags device_type,
devstat_priority priority);
void devstat_remove_entry(struct devstat *ds);
void devstat_start_transaction(struct devstat *ds);
void devstat_end_transaction(struct devstat *ds, u_int32_t bytes,

View File

@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)vmstat.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id: vmstat.c,v 1.27 1998/09/20 00:11:17 ken Exp $";
"$Id: vmstat.c,v 1.29 1998/10/28 06:41:24 jdp Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -278,6 +278,15 @@ main(argc, argv)
char **getdrivedata();
struct winsize winsize;
/*
* Make sure that the userland devstat version matches the
* kernel devstat version. If not, exit and print a
* message informing the user of his mistake.
*/
if (checkversion() < 0)
errx(1, "%s", devstat_errbuf);
argv = getdrivedata(argv);
winsize.ws_row = 0;
(void) ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&winsize);
@ -426,14 +435,6 @@ dovmstat(interval, reps)
if (!hz)
kread(X_HZ, &hz, sizeof(hz));
/*
* Make sure that the userland devstat version matches the kernel
* devstat version. If not, exit and print a message informing
* the user of his mistake.
*/
if (checkversion() < 0)
errx(1, "%s", devstat_errbuf);
for (hdrcnt = 1;;) {
if (!--hdrcnt)
printhdr();