[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [RFC PATCH 33/56] block: Make block_resize size unsigned in
From: |
Markus Armbruster |
Subject: |
[Qemu-block] [RFC PATCH 33/56] block: Make block_resize size unsigned in QAPI/QMP |
Date: |
Mon, 7 Aug 2017 16:45:37 +0200 |
Sizes should use QAPI type 'size' (uint64_t). block_resize parameter
@size is 'int' (int64_t). qmp_block_resize() ensures it's
non-negative before it passes it on to blk_truncate().
Change parameter @size to 'size', and update the range check
accordingly. Just cleanup; block_resize accepts the same size values
as before.
Signed-off-by: Markus Armbruster <address@hidden>
---
blockdev.c | 7 ++++---
qapi/block-core.json | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 960c5be..98dbe51 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2916,7 +2916,7 @@ void hmp_drive_del(Monitor *mon, const QDict *qdict)
void qmp_block_resize(bool has_device, const char *device,
bool has_node_name, const char *node_name,
- int64_t size, Error **errp)
+ uint64_t size, Error **errp)
{
Error *local_err = NULL;
BlockBackend *blk = NULL;
@@ -2940,8 +2940,9 @@ void qmp_block_resize(bool has_device, const char *device,
goto out;
}
- if (size < 0) {
- error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "size", "a >0 size");
+ if (size > INT64_MAX) {
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "size",
+ "a size less than 8EiB");
goto out;
}
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 1e26cb0..2e0d53c 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -1009,7 +1009,7 @@
##
{ 'command': 'block_resize', 'data': { '*device': 'str',
'*node-name': 'str',
- 'size': 'int' }}
+ 'size': 'size' }}
##
# @NewImageMode:
--
2.7.5
- [Qemu-block] [RFC PATCH 12/56] pc-dimm: Make size and address unsigned in QAPI/QMP, (continued)
[Qemu-block] [RFC PATCH 29/56] block: Make BlockDirtyInfo byte count unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
[Qemu-block] [RFC PATCH 35/56] blockjob: Lift speed sign conversion into block_job_set_speed(), Markus Armbruster, 2017/08/07
[Qemu-block] [RFC PATCH 37/56] blockjob: Make BlockJobInfo and event speed unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07
[Qemu-block] [RFC PATCH 33/56] block: Make block_resize size unsigned in QAPI/QMP,
Markus Armbruster <=
[Qemu-block] [RFC PATCH 26/56] block: Make BlockMeasureInfo sizes unsigned in QAPI, Markus Armbruster, 2017/08/07
[Qemu-block] [RFC PATCH 32/56] hmp: Make block_set_io_throttle's arguments unsigned, Markus Armbruster, 2017/08/07
[Qemu-block] [RFC PATCH 27/56] block/dirty-bitmap: Clean up signed vs. unsigned dirty counts, Markus Armbruster, 2017/08/07
[Qemu-block] [RFC PATCH 31/56] block: Make throttle byte rates and sizes unsigned in QAPI/QMP, Markus Armbruster, 2017/08/07