diff options
author | Vladimir Sementsov-Ogievskiy | 2019-02-18 15:09:24 +0100 |
---|---|---|
committer | Stefan Hajnoczi | 2019-02-22 10:42:13 +0100 |
commit | e5863d49e41b1b4b695f854c711a55d2584ee367 (patch) | |
tree | c6c6e416ca0a052494793bf93fc60c9e1b8d19e2 /hw/ide | |
parent | tests/test-bdrv-drain: use QEMU_IOVEC_INIT_BUF (diff) | |
download | qemu-e5863d49e41b1b4b695f854c711a55d2584ee367.tar.gz qemu-e5863d49e41b1b4b695f854c711a55d2584ee367.tar.xz qemu-e5863d49e41b1b4b695f854c711a55d2584ee367.zip |
hw/ide: drop iov field from IDEState
@iov is used only to initialize @qiov. Let's use new
qemu_iovec_init_buf() instead, which simplifies the code.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20190218140926.333779-16-vsementsov@virtuozzo.com
Message-Id: <20190218140926.333779-16-vsementsov@virtuozzo.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw/ide')
-rw-r--r-- | hw/ide/atapi.c | 9 | ||||
-rw-r--r-- | hw/ide/core.c | 8 |
2 files changed, 6 insertions, 11 deletions
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c index 39e473f9c2..4de86555d9 100644 --- a/hw/ide/atapi.c +++ b/hw/ide/atapi.c @@ -174,16 +174,15 @@ static void cd_read_sector_cb(void *opaque, int ret) static int cd_read_sector(IDEState *s) { + void *buf; + if (s->cd_sector_size != 2048 && s->cd_sector_size != 2352) { block_acct_invalid(blk_get_stats(s->blk), BLOCK_ACCT_READ); return -EINVAL; } - s->iov.iov_base = (s->cd_sector_size == 2352) ? - s->io_buffer + 16 : s->io_buffer; - - s->iov.iov_len = ATAPI_SECTOR_SIZE; - qemu_iovec_init_external(&s->qiov, &s->iov, 1); + buf = (s->cd_sector_size == 2352) ? s->io_buffer + 16 : s->io_buffer; + qemu_iovec_init_buf(&s->qiov, buf, ATAPI_SECTOR_SIZE); trace_cd_read_sector(s->lba); diff --git a/hw/ide/core.c b/hw/ide/core.c index 84832008b8..13f8f78ca6 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -774,9 +774,7 @@ static void ide_sector_read(IDEState *s) return; } - s->iov.iov_base = s->io_buffer; - s->iov.iov_len = n * BDRV_SECTOR_SIZE; - qemu_iovec_init_external(&s->qiov, &s->iov, 1); + qemu_iovec_init_buf(&s->qiov, s->io_buffer, n * BDRV_SECTOR_SIZE); block_acct_start(blk_get_stats(s->blk), &s->acct, n * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ); @@ -1045,9 +1043,7 @@ static void ide_sector_write(IDEState *s) return; } - s->iov.iov_base = s->io_buffer; - s->iov.iov_len = n * BDRV_SECTOR_SIZE; - qemu_iovec_init_external(&s->qiov, &s->iov, 1); + qemu_iovec_init_buf(&s->qiov, s->io_buffer, n * BDRV_SECTOR_SIZE); block_acct_start(blk_get_stats(s->blk), &s->acct, n * BDRV_SECTOR_SIZE, BLOCK_ACCT_WRITE); |