Use symbolic constants instead of "4".

Use arrays instead of relying on struct packing.

Identical md5(scsi_ch.o).
This commit is contained in:
phk 2003-05-31 16:54:37 +00:00
parent 3953441927
commit aa09487f98
3 changed files with 10 additions and 15 deletions

View File

@ -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];
}

View File

@ -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

View File

@ -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