diff options
author | sos <sos@FreeBSD.org> | 2000-01-28 20:18:19 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2000-01-28 20:18:19 +0000 |
commit | 23174db79ea3b2ed65ec4693ee5b07632deaa9f2 (patch) | |
tree | 089cdb1df7b4f891e2db3e454ca96070ee5ffbe1 /sys | |
parent | ba40b8cc8636906706e6072298c3b01f91561fd3 (diff) | |
download | FreeBSD-src-23174db79ea3b2ed65ec4693ee5b07632deaa9f2.zip FreeBSD-src-23174db79ea3b2ed65ec4693ee5b07632deaa9f2.tar.gz |
Fix the atapi-fd.c (afd device) so that fx MSDOS formatted ZIP
disks can be mounted. Use b_pblkno instead of b_blkno
Found by: phk
Protect (proberly) against setting modes on nonexisting devices.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ata/ata-all.c | 6 | ||||
-rw-r--r-- | sys/dev/ata/atapi-fd.c | 7 |
2 files changed, 8 insertions, 5 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index f1d534e..3ae7336 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -1250,13 +1250,15 @@ sysctl_hw_ata SYSCTL_HANDLER_ARGS i = 0; while (*ptr) { if (!strncmp(ptr, "pio", 3) || !strncmp(ptr, "PIO", 3)) { - if (atadevices[i >> 1]->dev_softc[i & 1] && + if (atadevices[i >> 1] && + atadevices[i >> 1]->dev_softc[i & 1] && atadevices[i >>1 ]->mode[i & 1] >= ATA_DMA) ata_change_mode(atadevices[i >> 1], (i & 1) ? ATA_SLAVE : ATA_MASTER, ATA_PIO); } else if (!strncmp(ptr, "dma", 3) || !strncmp(ptr, "DMA", 3)) { - if (atadevices[i >> 1]->dev_softc[i & 1] && + if (atadevices[i >> 1] && + atadevices[i >> 1]->dev_softc[i & 1] && atadevices[i >> 1]->mode[i & 1] < ATA_DMA) ata_change_mode(atadevices[i >> 1], (i & 1) ? ATA_SLAVE : ATA_MASTER, ATA_DMA); diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index 5bfa527..bb2b24e 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -108,7 +108,7 @@ afdattach(struct atapi_softc *atp) } if (!strncmp(ATA_PARAM(fdp->atp->controller, fdp->atp->unit)->model, - "IOMEGA ZIP", 11)) + "IOMEGA ZIP", 10)) fdp->transfersize = 64; devstat_add_entry(&fdp->stats, "afd", fdp->lun, DEV_BSIZE, @@ -195,10 +195,11 @@ afd_describe(struct afd_softc *fdp) printf("\n"); } else { - printf("afd%d: %luMB floppy <%.40s> at ata%d-%s using %s\n", + printf("afd%d: %luMB <%.40s> [%d/%d/%d] at ata%d-%s using %s\n", fdp->lun, (fdp->cap.cylinders*fdp->cap.heads*fdp->cap.sectors) / ((1024L * 1024L) / fdp->cap.sector_size), ATA_PARAM(fdp->atp->controller, fdp->atp->unit)->model, + fdp->cap.cylinders, fdp->cap.heads, fdp->cap.sectors, fdp->atp->controller->lun, (fdp->atp->unit == ATA_MASTER) ? "master" : "slave", ata_mode2str(fdp->atp->controller->mode[ATA_DEV(fdp->atp->unit)]) @@ -298,7 +299,7 @@ afd_start(struct afd_softc *fdp) return; } - lba = bp->b_blkno / (fdp->cap.sector_size / DEV_BSIZE); + lba = bp->b_pblkno / (fdp->cap.sector_size / DEV_BSIZE); count = (bp->b_bcount + (fdp->cap.sector_size - 1)) / fdp->cap.sector_size; data_ptr = bp->b_data; bp->b_resid = 0; |