aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/lguest/lguest.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-05-02 22:50:45 -0400
committerRusty Russell <rusty@rustcorp.com.au>2008-05-02 07:50:45 -0400
commitcb38fa23c17519faf46a76d2f71a8430705fe474 (patch)
tree8a2a4ac0c4d8091cc15216871bc74e98337bfa41 /Documentation/lguest/lguest.c
parent81473132878f8a1d0c6a78cffa0cf84c8a19c1be (diff)
virtio: de-structify virtio_block status byte
Ron Minnich points out that a struct containing a char is not always sizeof(char); simplest to remove the structure to avoid confusion. Cc: "ron minnich" <rminnich@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'Documentation/lguest/lguest.c')
-rw-r--r--Documentation/lguest/lguest.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 4c1fc65a8b3d..5cd705c3d75b 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -1398,7 +1398,7 @@ static bool service_io(struct device *dev)
1398 struct vblk_info *vblk = dev->priv; 1398 struct vblk_info *vblk = dev->priv;
1399 unsigned int head, out_num, in_num, wlen; 1399 unsigned int head, out_num, in_num, wlen;
1400 int ret; 1400 int ret;
1401 struct virtio_blk_inhdr *in; 1401 u8 *in;
1402 struct virtio_blk_outhdr *out; 1402 struct virtio_blk_outhdr *out;
1403 struct iovec iov[dev->vq->vring.num]; 1403 struct iovec iov[dev->vq->vring.num];
1404 off64_t off; 1404 off64_t off;
@@ -1416,7 +1416,7 @@ static bool service_io(struct device *dev)
1416 head, out_num, in_num); 1416 head, out_num, in_num);
1417 1417
1418 out = convert(&iov[0], struct virtio_blk_outhdr); 1418 out = convert(&iov[0], struct virtio_blk_outhdr);
1419 in = convert(&iov[out_num+in_num-1], struct virtio_blk_inhdr); 1419 in = convert(&iov[out_num+in_num-1], u8);
1420 off = out->sector * 512; 1420 off = out->sector * 512;
1421 1421
1422 /* The block device implements "barriers", where the Guest indicates 1422 /* The block device implements "barriers", where the Guest indicates
@@ -1430,7 +1430,7 @@ static bool service_io(struct device *dev)
1430 * It'd be nice if we supported eject, for example, but we don't. */ 1430 * It'd be nice if we supported eject, for example, but we don't. */
1431 if (out->type & VIRTIO_BLK_T_SCSI_CMD) { 1431 if (out->type & VIRTIO_BLK_T_SCSI_CMD) {
1432 fprintf(stderr, "Scsi commands unsupported\n"); 1432 fprintf(stderr, "Scsi commands unsupported\n");
1433 in->status = VIRTIO_BLK_S_UNSUPP; 1433 *in = VIRTIO_BLK_S_UNSUPP;
1434 wlen = sizeof(*in); 1434 wlen = sizeof(*in);
1435 } else if (out->type & VIRTIO_BLK_T_OUT) { 1435 } else if (out->type & VIRTIO_BLK_T_OUT) {
1436 /* Write */ 1436 /* Write */
@@ -1453,7 +1453,7 @@ static bool service_io(struct device *dev)
1453 errx(1, "Write past end %llu+%u", off, ret); 1453 errx(1, "Write past end %llu+%u", off, ret);
1454 } 1454 }
1455 wlen = sizeof(*in); 1455 wlen = sizeof(*in);
1456 in->status = (ret >= 0 ? VIRTIO_BLK_S_OK : VIRTIO_BLK_S_IOERR); 1456 *in = (ret >= 0 ? VIRTIO_BLK_S_OK : VIRTIO_BLK_S_IOERR);
1457 } else { 1457 } else {
1458 /* Read */ 1458 /* Read */
1459 1459
@@ -1466,10 +1466,10 @@ static bool service_io(struct device *dev)
1466 verbose("READ from sector %llu: %i\n", out->sector, ret); 1466 verbose("READ from sector %llu: %i\n", out->sector, ret);
1467 if (ret >= 0) { 1467 if (ret >= 0) {
1468 wlen = sizeof(*in) + ret; 1468 wlen = sizeof(*in) + ret;
1469 in->status = VIRTIO_BLK_S_OK; 1469 *in = VIRTIO_BLK_S_OK;
1470 } else { 1470 } else {
1471 wlen = sizeof(*in); 1471 wlen = sizeof(*in);
1472 in->status = VIRTIO_BLK_S_IOERR; 1472 *in = VIRTIO_BLK_S_IOERR;
1473 } 1473 }
1474 } 1474 }
1475 1475