diff options
author | sos <sos@FreeBSD.org> | 2005-10-10 19:13:27 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2005-10-10 19:13:27 +0000 |
commit | ca38720bedcaaac1fda7e3939c8854a71d672cf1 (patch) | |
tree | 0cb1c15eb2129741e19128b2381d464c7d9f470e | |
parent | 2907b6fd67f942e457672855d0b9960e805b72b8 (diff) | |
download | FreeBSD-src-ca38720bedcaaac1fda7e3939c8854a71d672cf1.zip FreeBSD-src-ca38720bedcaaac1fda7e3939c8854a71d672cf1.tar.gz |
Correct the former patch to the way it would have looked after review.
-rw-r--r-- | sys/dev/ata/atapi-cd.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index f737fe3..417a4dc 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -760,26 +760,26 @@ acd_geom_start(struct bio *bp) } else { u_int pos, size = cdp->iomax - cdp->iomax % bp->bio_to->sectorsize; - struct bio *bp2, *first, **next = &first; + struct bio *bp2, *bp3; - for (pos = 0; pos < bp->bio_length; pos += size) { - if (!(bp2 = g_clone_bio(bp))) { - bp->bio_error = ENOMEM; - break; - } + if (!(bp2 = g_clone_bio(bp))) + g_io_deliver(bp, EIO); + + for (pos = 0; bp2; pos += size) { + bp3 = NULL; bp2->bio_done = g_std_done; bp2->bio_to = bp->bio_to; bp2->bio_offset += pos; bp2->bio_data += pos; - bp2->bio_length = MIN(size, bp->bio_length - pos); + bp2->bio_length = bp->bio_length - pos; + if (bp2->bio_length > size) { + bp2->bio_length = size; + if (!(bp3 = g_clone_bio(bp))) + bp->bio_error = ENOMEM; + } bp2->bio_pblkno = bp2->bio_offset / bp2->bio_to->sectorsize; - *next = bp2; - next = (struct bio **)&bp2->bio_driver1; - } - *next = NULL; - while ((bp2 = first) != NULL) { - first = (struct bio *)bp2->bio_driver1; acd_strategy(bp2); + bp2 = bp3; } } } |