summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorken <ken@FreeBSD.org>1999-02-10 00:04:13 +0000
committerken <ken@FreeBSD.org>1999-02-10 00:04:13 +0000
commit542b263658139322bf3d5bd62bad9800e74aad45 (patch)
treeb4c5c45958dd1ae9b164c02cc708e4fa28bf4bd4 /sys
parent4eda991f81cae280580852f81db79122e1013f3c (diff)
downloadFreeBSD-src-542b263658139322bf3d5bd62bad9800e74aad45.zip
FreeBSD-src-542b263658139322bf3d5bd62bad9800e74aad45.tar.gz
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
Diffstat (limited to 'sys')
-rw-r--r--sys/cam/scsi/scsi_cd.c7
-rw-r--r--sys/cam/scsi/scsi_ch.c7
-rw-r--r--sys/cam/scsi/scsi_da.c5
-rw-r--r--sys/cam/scsi/scsi_pass.c7
-rw-r--r--sys/cam/scsi/scsi_pt.c5
-rw-r--r--sys/cam/scsi/scsi_sa.c5
-rw-r--r--sys/dev/ccd/ccd.c5
-rw-r--r--sys/dev/fdc/fdc.c5
-rw-r--r--sys/geom/geom_ccd.c5
-rw-r--r--sys/i386/isa/atapi-cd.c8
-rw-r--r--sys/i386/isa/fd.c5
-rw-r--r--sys/i386/isa/wd.c6
-rw-r--r--sys/i386/isa/wd_cd.c8
-rw-r--r--sys/i386/isa/wfd.c5
-rw-r--r--sys/isa/fd.c5
-rw-r--r--sys/kern/subr_devstat.c64
-rw-r--r--sys/pc98/cbus/fdc.c5
-rw-r--r--sys/pc98/pc98/fd.c5
-rw-r--r--sys/pc98/pc98/wd.c6
-rw-r--r--sys/pc98/pc98/wd_cd.c8
-rw-r--r--sys/pc98/pc98/wfd.c5
-rw-r--r--sys/sys/devicestat.h26
22 files changed, 152 insertions, 55 deletions
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c
index 0ebc685..209f937 100644
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -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
diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c
index 17f6fb9..384e9b4 100644
--- a/sys/cam/scsi/scsi_ch.c
+++ b/sys/cam/scsi/scsi_ch.c
@@ -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
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 3463bbf..253fce3 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -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
diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c
index 40e6376..927b1b8 100644
--- a/sys/cam/scsi/scsi_pass.c
+++ b/sys/cam/scsi/scsi_pass.c
@@ -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.
diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c
index b937ad4..4893284 100644
--- a/sys/cam/scsi/scsi_pt.c
+++ b/sys/cam/scsi/scsi_pt.c
@@ -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
diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c
index 7b2ca1c..3772e47 100644
--- a/sys/cam/scsi/scsi_sa.c
+++ b/sys/cam/scsi/scsi_sa.c
@@ -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
diff --git a/sys/dev/ccd/ccd.c b/sys/dev/ccd/ccd.c
index d516873..68885e9 100644
--- a/sys/dev/ccd/ccd.c
+++ b/sys/dev/ccd/ccd.c
@@ -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... */
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index 9972a38..d0dd782 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -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);
}
diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c
index d516873..68885e9 100644
--- a/sys/geom/geom_ccd.c
+++ b/sys/geom/geom_ccd.c
@@ -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... */
diff --git a/sys/i386/isa/atapi-cd.c b/sys/i386/isa/atapi-cd.c
index be09c36..b716e69 100644
--- a/sys/i386/isa/atapi-cd.c
+++ b/sys/i386/isa/atapi-cd.c
@@ -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;
}
diff --git a/sys/i386/isa/fd.c b/sys/i386/isa/fd.c
index 9972a38..d0dd782 100644
--- a/sys/i386/isa/fd.c
+++ b/sys/i386/isa/fd.c
@@ -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);
}
diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c
index 44a2861..fcfb002 100644
--- a/sys/i386/isa/wd.c
+++ b/sys/i386/isa/wd.c
@@ -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);
diff --git a/sys/i386/isa/wd_cd.c b/sys/i386/isa/wd_cd.c
index be09c36..b716e69 100644
--- a/sys/i386/isa/wd_cd.c
+++ b/sys/i386/isa/wd_cd.c
@@ -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;
}
diff --git a/sys/i386/isa/wfd.c b/sys/i386/isa/wfd.c
index b47b1e5..17b434c 100644
--- a/sys/i386/isa/wfd.c
+++ b/sys/i386/isa/wfd.c
@@ -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);
}
diff --git a/sys/isa/fd.c b/sys/isa/fd.c
index 9972a38..d0dd782 100644
--- a/sys/isa/fd.c
+++ b/sys/isa/fd.c
@@ -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);
}
diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c
index 5fcf88e..d08c0c9 100644
--- a/sys/kern/subr_devstat.c
+++ b/sys/kern/subr_devstat.c
@@ -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);
diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c
index 4b2b6dc..55ee953 100644
--- a/sys/pc98/cbus/fdc.c
+++ b/sys/pc98/cbus/fdc.c
@@ -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);
}
diff --git a/sys/pc98/pc98/fd.c b/sys/pc98/pc98/fd.c
index 4b2b6dc..55ee953 100644
--- a/sys/pc98/pc98/fd.c
+++ b/sys/pc98/pc98/fd.c
@@ -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);
}
diff --git a/sys/pc98/pc98/wd.c b/sys/pc98/pc98/wd.c
index 77cee7b..1cc2d87 100644
--- a/sys/pc98/pc98/wd.c
+++ b/sys/pc98/pc98/wd.c
@@ -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);
diff --git a/sys/pc98/pc98/wd_cd.c b/sys/pc98/pc98/wd_cd.c
index be09c36..b716e69 100644
--- a/sys/pc98/pc98/wd_cd.c
+++ b/sys/pc98/pc98/wd_cd.c
@@ -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;
}
diff --git a/sys/pc98/pc98/wfd.c b/sys/pc98/pc98/wfd.c
index b47b1e5..17b434c 100644
--- a/sys/pc98/pc98/wfd.c
+++ b/sys/pc98/pc98/wfd.c
@@ -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);
}
diff --git a/sys/sys/devicestat.h b/sys/sys/devicestat.h
index 8ffd049..c94b8ce 100644
--- a/sys/sys/devicestat.h
+++ b/sys/sys/devicestat.h
@@ -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,
OpenPOWER on IntegriCloud