aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2003-05-31 16:54:37 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2003-05-31 16:54:37 +0000
commit56824e138dccf6971f541da155b8a9ae2d2724cb (patch)
tree83537ab4363d70623187efb43975bd5c4309cff5
parent850cb24ef8316ed5d989f581bccb427f4ff50fe2 (diff)
downloadsrc-56824e138dccf6971f541da155b8a9ae2d2724cb.tar.gz
src-56824e138dccf6971f541da155b8a9ae2d2724cb.zip
Use symbolic constants instead of "4".
Use arrays instead of relying on struct packing. Identical md5(scsi_ch.o).
Notes
Notes: svn path=/head/; revision=115464
-rw-r--r--sys/cam/scsi/scsi_ch.c14
-rw-r--r--sys/cam/scsi/scsi_ch.h10
-rw-r--r--sys/sys/chio.h1
3 files changed, 10 insertions, 15 deletions
diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c
index 520976e45aa5..3cb5a1010abc 100644
--- a/sys/cam/scsi/scsi_ch.c
+++ b/sys/cam/scsi/scsi_ch.c
@@ -151,19 +151,19 @@ struct ch_softc {
* The following information is obtained from the
* element address assignment page.
*/
- int sc_firsts[4]; /* firsts, indexed by CHET_* */
- int sc_counts[4]; /* counts, indexed by CHET_* */
+ int sc_firsts[CHET_MAX + 1]; /* firsts */
+ int sc_counts[CHET_MAX + 1]; /* counts */
/*
* The following mask defines the legal combinations
* of elements for the MOVE MEDIUM command.
*/
- u_int8_t sc_movemask[4];
+ u_int8_t sc_movemask[CHET_MAX + 1];
/*
* As above, but for EXCHANGE MEDIUM.
*/
- u_int8_t sc_exchangemask[4];
+ u_int8_t sc_exchangemask[CHET_MAX + 1];
/*
* Quirks; see below. XXX KDM not implemented yet
@@ -1478,9 +1478,9 @@ chgetparams(struct cam_periph *periph)
bzero(softc->sc_movemask, sizeof(softc->sc_movemask));
bzero(softc->sc_exchangemask, sizeof(softc->sc_exchangemask));
- moves = &cap->move_from_mt;
- exchanges = &cap->exchange_with_mt;
- for (from = CHET_MT; from <= CHET_DT; ++from) {
+ moves = cap->move_from;
+ exchanges = cap->exchange_with;
+ for (from = CHET_MT; from <= CHET_MAX; ++from) {
softc->sc_movemask[from] = moves[from];
softc->sc_exchangemask[from] = exchanges[from];
}
diff --git a/sys/cam/scsi/scsi_ch.h b/sys/cam/scsi/scsi_ch.h
index 5239243aefda..754777918453 100644
--- a/sys/cam/scsi/scsi_ch.h
+++ b/sys/cam/scsi/scsi_ch.h
@@ -339,10 +339,7 @@ struct page_device_capabilities {
* MOVE MEDIUM command is legal. The top four bits of each
* of these values are reserved.
*/
- u_int8_t move_from_mt;
- u_int8_t move_from_st;
- u_int8_t move_from_ie;
- u_int8_t move_from_dt;
+ u_int8_t move_from[CHET_MAX + 1];
#define MOVE_TO_MT 0x01
#define MOVE_TO_ST 0x02
#define MOVE_TO_IE 0x04
@@ -353,10 +350,7 @@ struct page_device_capabilities {
/*
* Similar to above, but for EXCHANGE MEDIUM.
*/
- u_int8_t exchange_with_mt;
- u_int8_t exchange_with_st;
- u_int8_t exchange_with_ie;
- u_int8_t exchange_with_dt;
+ u_int8_t exchange_with[CHET_MAX + 1];
#define EXCHANGE_WITH_MT 0x01
#define EXCHANGE_WITH_ST 0x02
#define EXCHANGE_WITH_IE 0x04
diff --git a/sys/sys/chio.h b/sys/sys/chio.h
index 78e2248e995f..e1ae110aee26 100644
--- a/sys/sys/chio.h
+++ b/sys/sys/chio.h
@@ -52,6 +52,7 @@
#define CHET_ST 1 /* storage transport (slot) */
#define CHET_IE 2 /* import/export (portal) */
#define CHET_DT 3 /* data transfer (drive) */
+#define CHET_MAX CHET_DT
/*
* Maximum length of a volume identification string