Don't assume that bio_cmd is a bitfield.
Differential Revision: https://reviews.freebsd.org/D5591
This commit is contained in:
parent
ca19dfe480
commit
3cb6be927b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=296607
@ -215,26 +215,28 @@ static void cf_start (struct bio *bp)
|
||||
* the bio struct.
|
||||
*/
|
||||
|
||||
if(bp->bio_cmd & BIO_GETATTR) {
|
||||
switch (bp->bio_cmd) {
|
||||
case BIO_GETATTR:
|
||||
if (g_handleattr_int(bp, "GEOM::fwsectors", cf_priv->drive_param.sec_track))
|
||||
return;
|
||||
if (g_handleattr_int(bp, "GEOM::fwheads", cf_priv->drive_param.heads))
|
||||
return;
|
||||
g_io_deliver(bp, ENOIOCTL);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((bp->bio_cmd & (BIO_READ | BIO_WRITE))) {
|
||||
|
||||
if (bp->bio_cmd & BIO_READ) {
|
||||
case BIO_READ:
|
||||
error = cf_cmd_read(bp->bio_length / cf_priv->drive_param.sector_size,
|
||||
bp->bio_offset / cf_priv->drive_param.sector_size, bp->bio_data);
|
||||
} else if (bp->bio_cmd & BIO_WRITE) {
|
||||
break;
|
||||
case BIO_WRITE:
|
||||
error = cf_cmd_write(bp->bio_length / cf_priv->drive_param.sector_size,
|
||||
bp->bio_offset/cf_priv->drive_param.sector_size, bp->bio_data);
|
||||
} else {
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("%s: unrecognized bio_cmd %x.\n", __func__, bp->bio_cmd);
|
||||
error = ENOTSUP;
|
||||
break;
|
||||
}
|
||||
|
||||
if (error != 0) {
|
||||
@ -245,7 +247,6 @@ static void cf_start (struct bio *bp)
|
||||
bp->bio_resid = 0;
|
||||
bp->bio_completed = bp->bio_length;
|
||||
g_io_deliver(bp, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user