diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2010-09-11 22:40:11 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2010-09-11 22:40:11 +0000 |
commit | e9df121462d3dbfcc814f90634c3fbeb01a2c80b (patch) | |
tree | 1bc68684e630215c5c8cbc5d4fb3d35249624f3e /sys/scsi/cd.c | |
parent | 88af6dbda79ed0be3dc0574c57f5527746a4acb5 (diff) |
Be more ruthlessly consistent in variable names for blk/block ==
512 == DEV_BSIZE units and variable-sized physical device 'sectors'.
I hope this reduces confusion a bit more. No change to .o files.
ok for intent miod@, with tweak.
Diffstat (limited to 'sys/scsi/cd.c')
-rw-r--r-- | sys/scsi/cd.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 94d249fcb91..ea5259c7841 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd.c,v 1.189 2010/09/08 15:16:22 jsing Exp $ */ +/* $OpenBSD: cd.c,v 1.190 2010/09/11 22:40:10 krw Exp $ */ /* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */ /* @@ -108,7 +108,7 @@ struct cd_softc { #define CDF_WAITING 0x100 struct scsi_link *sc_link; /* contains our targ, lun, etc. */ struct cd_parms { - u_int32_t blksize; + u_int32_t secsize; daddr64_t disksize; /* total number sectors */ } sc_params; struct bufq sc_bufq; @@ -573,7 +573,7 @@ cdstart(struct scsi_xfer *xs) struct buf *bp; struct scsi_rw_big *cmd_big; struct scsi_rw *cmd_small; - int blkno, nblks; + int secno, nsecs; struct partition *p; int read; @@ -607,11 +607,11 @@ cdstart(struct scsi_xfer *xs) * First, translate the block to absolute and put it in terms * of the logical blocksize of the device. */ - blkno = + secno = bp->b_blkno / (sc->sc_dk.dk_label->d_secsize / DEV_BSIZE); p = &sc->sc_dk.dk_label->d_partitions[DISKPART(bp->b_dev)]; - blkno += DL_GETPOFFSET(p); - nblks = howmany(bp->b_bcount, sc->sc_dk.dk_label->d_secsize); + secno += DL_GETPOFFSET(p); + nsecs = howmany(bp->b_bcount, sc->sc_dk.dk_label->d_secsize); read = (bp->b_flags & B_READ); @@ -621,16 +621,16 @@ cdstart(struct scsi_xfer *xs) */ if (!(sc_link->flags & SDEV_ATAPI) && !(sc_link->quirks & SDEV_ONLYBIG) && - ((blkno & 0x1fffff) == blkno) && - ((nblks & 0xff) == nblks)) { + ((secno & 0x1fffff) == secno) && + ((nsecs & 0xff) == nsecs)) { /* * We can fit in a small cdb. */ cmd_small = (struct scsi_rw *)xs->cmd; cmd_small->opcode = read ? READ_COMMAND : WRITE_COMMAND; - _lto3b(blkno, cmd_small->addr); - cmd_small->length = nblks & 0xff; + _lto3b(secno, cmd_small->addr); + cmd_small->length = nsecs & 0xff; xs->cmdlen = sizeof(*cmd_small); } else { /* @@ -639,8 +639,8 @@ cdstart(struct scsi_xfer *xs) cmd_big = (struct scsi_rw_big *)xs->cmd; cmd_big->opcode = read ? READ_BIG : WRITE_BIG; - _lto4b(blkno, cmd_big->addr); - _lto2b(nblks, cmd_big->length); + _lto4b(secno, cmd_big->addr); + _lto2b(nsecs, cmd_big->length); xs->cmdlen = sizeof(*cmd_big); } @@ -1179,7 +1179,7 @@ cdgetdisklabel(dev_t dev, struct cd_softc *sc, struct disklabel *lp, toc = malloc(sizeof(*toc), M_TEMP, M_WAITOK | M_ZERO); - lp->d_secsize = sc->sc_params.blksize; + lp->d_secsize = sc->sc_params.secsize; lp->d_ntracks = 1; lp->d_nsectors = 100; lp->d_secpercyl = 100; @@ -1403,7 +1403,7 @@ cd_set_pa_immed(struct cd_softc *sc, int flags) * Get scsi driver to send a "start playing" command */ int -cd_play(struct cd_softc *sc, int blkno, int nblks) +cd_play(struct cd_softc *sc, int secno, int nsecs) { struct scsi_play *cmd; struct scsi_xfer *xs; @@ -1417,8 +1417,8 @@ cd_play(struct cd_softc *sc, int blkno, int nblks) cmd = (struct scsi_play *)xs->cmd; cmd->opcode = PLAY; - _lto4b(blkno, cmd->blk_addr); - _lto2b(nblks, cmd->xfer_len); + _lto4b(secno, cmd->blk_addr); + _lto2b(nsecs, cmd->xfer_len); error = scsi_xs_sync(xs); scsi_xs_put(xs); @@ -1663,18 +1663,18 @@ int cd_get_parms(struct cd_softc *sc, int flags) { /* Reasonable defaults for drives that don't support READ_CAPACITY */ - sc->sc_params.blksize = 2048; + sc->sc_params.secsize = 2048; sc->sc_params.disksize = 400000; if (sc->sc_link->quirks & ADEV_NOCAPACITY) return (0); sc->sc_params.disksize = scsi_size(sc->sc_link, flags, - &sc->sc_params.blksize); + &sc->sc_params.secsize); - if ((sc->sc_params.blksize < 512) || - ((sc->sc_params.blksize & 511) != 0)) - sc->sc_params.blksize = 2048; /* some drives lie ! */ + if ((sc->sc_params.secsize < 512) || + ((sc->sc_params.secsize & 511) != 0)) + sc->sc_params.secsize = 2048; /* some drives lie ! */ if (sc->sc_params.disksize < 100) sc->sc_params.disksize = 400000; @@ -1691,7 +1691,7 @@ cdsize(dev_t dev) } int -cddump(dev_t dev, daddr64_t blkno, caddr_t va, size_t size) +cddump(dev_t dev, daddr64_t secno, caddr_t va, size_t size) { /* Not implemented. */ return ENXIO; |