diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2005-11-12 23:10:05 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2005-11-12 23:10:05 +0000 |
commit | 1d584905429073c43bc41b1fea7238d32be18f45 (patch) | |
tree | b77565cd510ccc47f8266436b7c3c34923064168 /sys/arch | |
parent | be82434ad2f3814780c6e93ae74ecd93233ccc44 (diff) |
Constify, and simplify hdgetinfo() which only gets called for known disks.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/hp300/dev/hd.c | 20 | ||||
-rw-r--r-- | sys/arch/hp300/dev/hdvar.h | 4 |
2 files changed, 9 insertions, 15 deletions
diff --git a/sys/arch/hp300/dev/hd.c b/sys/arch/hp300/dev/hd.c index 5c3c3912c54..206dd92f570 100644 --- a/sys/arch/hp300/dev/hd.c +++ b/sys/arch/hp300/dev/hd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hd.c,v 1.27 2005/11/12 23:08:41 miod Exp $ */ +/* $OpenBSD: hd.c,v 1.28 2005/11/12 23:10:04 miod Exp $ */ /* $NetBSD: rd.c,v 1.33 1997/07/10 18:14:08 kleink Exp $ */ /* @@ -150,7 +150,7 @@ int hddebug = 0x80; * Misc. HW description, indexed by sc_type. * Nothing really critical here, could do without it. */ -struct hdidentinfo hdidentinfo[] = { +const struct hdidentinfo hdidentinfo[] = { { HD7946AID, 0, "7945A", NHD7945ABPT, NHD7945ATRK, 968, 108416 }, @@ -208,7 +208,7 @@ struct hdidentinfo hdidentinfo[] = { { HD2203AID, 0, "2203A", NHD2203ABPT, NHD2203ATRK, 1449, 1309896 } }; -int numhdidentinfo = sizeof(hdidentinfo) / sizeof(hdidentinfo[0]); +const int numhdidentinfo = sizeof(hdidentinfo) / sizeof(hdidentinfo[0]); bdev_decl(hd); cdev_decl(hd); @@ -491,16 +491,10 @@ hdgetinfo(dev, rs, lp, spoofonly) lp->d_rpm = 3600; lp->d_interleave = 1; - if (rs->sc_type > -1) { - lp->d_nsectors = hdidentinfo[rs->sc_type].ri_nbpt; - lp->d_ntracks = hdidentinfo[rs->sc_type].ri_ntpc; - lp->d_ncylinders = hdidentinfo[rs->sc_type].ri_ncyl; - lp->d_secperunit = hdidentinfo[rs->sc_type].ri_nblocks; - } else { - lp->d_nsectors = 32; - lp->d_ntracks = 20; - lp->d_ncylinders = 1; - } + lp->d_nsectors = hdidentinfo[rs->sc_type].ri_nbpt; + lp->d_ntracks = hdidentinfo[rs->sc_type].ri_ntpc; + lp->d_ncylinders = hdidentinfo[rs->sc_type].ri_ncyl; + lp->d_secperunit = hdidentinfo[rs->sc_type].ri_nblocks; lp->d_secpercyl = lp->d_nsectors * lp->d_ntracks; /* XXX - these values for BBSIZE and SBSIZE assume ffs */ diff --git a/sys/arch/hp300/dev/hdvar.h b/sys/arch/hp300/dev/hdvar.h index a0548f910eb..19403bcd3c7 100644 --- a/sys/arch/hp300/dev/hdvar.h +++ b/sys/arch/hp300/dev/hdvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hdvar.h,v 1.5 2003/06/02 23:27:44 millert Exp $ */ +/* $OpenBSD: hdvar.h,v 1.6 2005/11/12 23:10:04 miod Exp $ */ /* $NetBSD: rdvar.h,v 1.6 1997/01/30 09:14:19 thorpej Exp $ */ /* @@ -98,5 +98,5 @@ struct hd_softc { #define HDWAITC 1 /* min time for timeout in seconds */ #ifdef _KERNEL -extern struct hdidentinfo hdidentinfo[]; +extern const struct hdidentinfo hdidentinfo[]; #endif |