1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

Use symbolic constants instead of "4".

Use arrays instead of relying on struct packing.

Identical md5(scsi_ch.o).
This commit is contained in:
Poul-Henning Kamp 2003-05-31 16:54:37 +00:00
parent 850cb24ef8
commit 56824e138d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=115464
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