diff options
author | Alberto Faria <afaria@redhat.com> | 2022-06-09 16:27:35 +0100 |
---|---|---|
committer | Hanna Reitz <hreitz@redhat.com> | 2022-07-12 12:14:55 +0200 |
commit | 53fb7844f03241a0e6de2c342c9e1b89df12da4d (patch) | |
tree | 917522c3ce90e4449ffa7fb2a430aa137c22391e /block/io.c | |
parent | 9548cbeffffd4253e38570d29b8cff0bf77c998f (diff) |
block: Add a 'flags' param to bdrv_{pread,pwrite,pwrite_sync}()
For consistency with other I/O functions, and in preparation to
implement them using generated_co_wrapper.
Callers were updated using this Coccinelle script:
@@ expression child, offset, buf, bytes; @@
- bdrv_pread(child, offset, buf, bytes)
+ bdrv_pread(child, offset, buf, bytes, 0)
@@ expression child, offset, buf, bytes; @@
- bdrv_pwrite(child, offset, buf, bytes)
+ bdrv_pwrite(child, offset, buf, bytes, 0)
@@ expression child, offset, buf, bytes; @@
- bdrv_pwrite_sync(child, offset, buf, bytes)
+ bdrv_pwrite_sync(child, offset, buf, bytes, 0)
Resulting overly-long lines were then fixed by hand.
Signed-off-by: Alberto Faria <afaria@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Message-Id: <20220609152744.3891847-2-afaria@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Diffstat (limited to 'block/io.c')
-rw-r--r-- | block/io.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/block/io.c b/block/io.c index 1e9bf09a49..b965efa871 100644 --- a/block/io.c +++ b/block/io.c @@ -1097,7 +1097,8 @@ int bdrv_make_zero(BdrvChild *child, BdrvRequestFlags flags) } /* See bdrv_pwrite() for the return codes */ -int bdrv_pread(BdrvChild *child, int64_t offset, void *buf, int64_t bytes) +int bdrv_pread(BdrvChild *child, int64_t offset, void *buf, int64_t bytes, + BdrvRequestFlags flags) { int ret; QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); @@ -1107,7 +1108,7 @@ int bdrv_pread(BdrvChild *child, int64_t offset, void *buf, int64_t bytes) return -EINVAL; } - ret = bdrv_preadv(child, offset, bytes, &qiov, 0); + ret = bdrv_preadv(child, offset, bytes, &qiov, flags); return ret < 0 ? ret : bytes; } @@ -1119,7 +1120,7 @@ int bdrv_pread(BdrvChild *child, int64_t offset, void *buf, int64_t bytes) -EACCES Trying to write a read-only device */ int bdrv_pwrite(BdrvChild *child, int64_t offset, const void *buf, - int64_t bytes) + int64_t bytes, BdrvRequestFlags flags) { int ret; QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, bytes); @@ -1129,7 +1130,7 @@ int bdrv_pwrite(BdrvChild *child, int64_t offset, const void *buf, return -EINVAL; } - ret = bdrv_pwritev(child, offset, bytes, &qiov, 0); + ret = bdrv_pwritev(child, offset, bytes, &qiov, flags); return ret < 0 ? ret : bytes; } @@ -1141,12 +1142,12 @@ int bdrv_pwrite(BdrvChild *child, int64_t offset, const void *buf, * Returns 0 on success, -errno in error cases. */ int bdrv_pwrite_sync(BdrvChild *child, int64_t offset, - const void *buf, int64_t count) + const void *buf, int64_t count, BdrvRequestFlags flags) { int ret; IO_CODE(); - ret = bdrv_pwrite(child, offset, buf, count); + ret = bdrv_pwrite(child, offset, buf, count, flags); if (ret < 0) { return ret; } |