* [Qemu-devel] [PULL v3 00/41] Block layer patches
@ 2015-11-11 16:08 Kevin Wolf
2015-11-11 16:08 ` [Qemu-devel] [PULL v3 14/41] blockdev: read-only-mode for blockdev-change-medium Kevin Wolf
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Kevin Wolf @ 2015-11-11 16:08 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, qemu-devel
The following changes since commit 3c07587d49458341510360557c849e93e9afaf59:
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-next-20151111' into staging (2015-11-11 09:34:18 +0000)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to 4d07c720f44beafd10907cecfd5b8a57622243c1:
Merge remote-tracking branch 'mreitz/tags/pull-block-for-kevin-2015-11-11' into queue-block (2015-11-11 17:02:02 +0100)
----------------------------------------------------------------
Block layer patches
----------------------------------------------------------------
Alberto Garcia (18):
block: Don't call blk_bs() twice in bdrv_lookup_bs()
block: check for existing device IDs in external_snapshot_prepare()
block: rename BlockdevSnapshot to BlockdevSnapshotSync
block: support passing 'backing': '' to 'blockdev-add'
block: add a 'blockdev-snapshot' QMP command
block: add tests for the 'blockdev-snapshot' command
commit: reopen overlay_bs before base
qemu-iotests: Test the reopening of overlay_bs in 'block-commit'
throttle: Check for pending requests in throttle_group_unregister_bs()
throttle: Use bs->throttle_state instead of bs->io_limits_enabled
block: Disallow snapshots if the overlay doesn't support backing files
block: Remove inner quotation marks in iotest 085
block: test 'blockdev-snapshot' using a file BDS as the overlay
mirror: block all operations on the target image during the job
block: Add blk_get_refcnt()
block: Add 'x-blockdev-del' QMP command
iotests: Add tests for the x-blockdev-del command
iotests: Check for quorum support in test 139
Jeff Cody (2):
qemu-iotests: fix cleanup of background processes
qemu-iotests: fix -valgrind option for check
John Snow (5):
qcow2: avoid misaligned 64bit bswap
qemu-img: add check for zero-length job len
qemu-io: fix cvtnum lval types
qemu-io: Check for trailing chars
qemu-io: Correct error messages
Kevin Wolf (2):
qcow2: Fix qcow2_get_cluster_offset() for zero clusters
Merge remote-tracking branch 'mreitz/tags/pull-block-for-kevin-2015-11-11' into queue-block
Max Reitz (15):
block: Add blk_remove_bs()
block: Make bdrv_states public
block: Add functions for inheriting a BBRS
blockdev: Add blockdev-open-tray
blockdev: Add blockdev-close-tray
blockdev: Add blockdev-remove-medium
blockdev: Add blockdev-insert-medium
blockdev: Implement eject with basic operations
blockdev: Implement change with basic operations
block: Inquire tray state before tray-moved events
qmp: Introduce blockdev-change-medium
hmp: Use blockdev-change-medium for change command
blockdev: read-only-mode for blockdev-change-medium
hmp: Add read-only-mode option to change command
iotests: Add test for change-related QMP commands
block.c | 22 +-
block/block-backend.c | 61 +++-
block/commit.c | 8 +-
block/mirror.c | 4 +
block/qapi.c | 2 +-
block/qcow2-cluster.c | 15 +-
block/qcow2-refcount.c | 11 +-
block/throttle-groups.c | 7 +
blockdev.c | 527 ++++++++++++++++++++--------
hmp-commands.hx | 20 +-
hmp.c | 47 ++-
include/block/block_int.h | 7 +-
include/sysemu/block-backend.h | 4 +
include/sysemu/blockdev.h | 2 -
qapi-schema.json | 10 +-
qapi/block-core.json | 192 ++++++++++-
qemu-img.c | 3 +-
qemu-io-cmds.c | 187 +++++++---
qmp-commands.hx | 317 ++++++++++++++++-
qmp.c | 3 +-
tests/qemu-iotests/039.out | 30 +-
tests/qemu-iotests/040 | 30 ++
tests/qemu-iotests/040.out | 4 +-
tests/qemu-iotests/058 | 12 +-
tests/qemu-iotests/061.out | 12 +-
tests/qemu-iotests/085 | 120 ++++++-
tests/qemu-iotests/085.out | 38 ++-
tests/qemu-iotests/118 | 720 +++++++++++++++++++++++++++++++++++++++
tests/qemu-iotests/118.out | 5 +
tests/qemu-iotests/137.out | 6 +-
tests/qemu-iotests/139 | 416 ++++++++++++++++++++++
tests/qemu-iotests/139.out | 5 +
tests/qemu-iotests/common | 9 +-
tests/qemu-iotests/common.config | 32 +-
tests/qemu-iotests/common.qemu | 18 +-
tests/qemu-iotests/common.rc | 18 +-
tests/qemu-iotests/group | 2 +
ui/cocoa.m | 11 +-
38 files changed, 2626 insertions(+), 311 deletions(-)
create mode 100755 tests/qemu-iotests/118
create mode 100644 tests/qemu-iotests/118.out
create mode 100644 tests/qemu-iotests/139
create mode 100644 tests/qemu-iotests/139.out
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PULL v3 14/41] blockdev: read-only-mode for blockdev-change-medium
2015-11-11 16:08 [Qemu-devel] [PULL v3 00/41] Block layer patches Kevin Wolf
@ 2015-11-11 16:08 ` Kevin Wolf
2015-11-11 16:08 ` [Qemu-devel] [PULL v3 31/41] qemu-io: fix cvtnum lval types Kevin Wolf
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2015-11-11 16:08 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, qemu-devel
From: Max Reitz <mreitz@redhat.com>
Add an option to qmp_blockdev_change_medium() which allows changing the
read-only status of the block device whose medium is changed.
Some drives do not have a inherently fixed read-only status; for
instance, floppy disks can be set read-only or writable independently of
the drive. Some users may find it useful to be able to therefore change
the read-only status of a block device when changing the medium.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
blockdev.c | 22 ++++++++++++++++++++++
hmp.c | 2 +-
qapi/block-core.json | 24 +++++++++++++++++++++++-
qmp-commands.hx | 24 +++++++++++++++++++++++-
qmp.c | 3 ++-
ui/cocoa.m | 1 +
6 files changed, 72 insertions(+), 4 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index b3a958c..34f6e5b 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2145,6 +2145,8 @@ void qmp_blockdev_insert_medium(const char *device, const char *node_name,
void qmp_blockdev_change_medium(const char *device, const char *filename,
bool has_format, const char *format,
+ bool has_read_only,
+ BlockdevChangeReadOnlyMode read_only,
Error **errp)
{
BlockBackend *blk;
@@ -2166,6 +2168,26 @@ void qmp_blockdev_change_medium(const char *device, const char *filename,
bdrv_flags = blk_get_open_flags_from_root_state(blk);
+ if (!has_read_only) {
+ read_only = BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN;
+ }
+
+ switch (read_only) {
+ case BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN:
+ break;
+
+ case BLOCKDEV_CHANGE_READ_ONLY_MODE_READ_ONLY:
+ bdrv_flags &= ~BDRV_O_RDWR;
+ break;
+
+ case BLOCKDEV_CHANGE_READ_ONLY_MODE_READ_WRITE:
+ bdrv_flags |= BDRV_O_RDWR;
+ break;
+
+ default:
+ abort();
+ }
+
if (has_format) {
options = qdict_new();
qdict_put(options, "driver", qstring_from_str(format));
diff --git a/hmp.c b/hmp.c
index e5ad944..16006aa 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1355,7 +1355,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
}
qmp_change("vnc", target, !!arg, arg, &err);
} else {
- qmp_blockdev_change_medium(device, target, !!arg, arg, &err);
+ qmp_blockdev_change_medium(device, target, !!arg, arg, false, 0, &err);
if (err &&
error_get_class(err) == ERROR_CLASS_DEVICE_ENCRYPTED) {
error_free(err);
diff --git a/qapi/block-core.json b/qapi/block-core.json
index e9fa649..fa08ba9 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -1959,6 +1959,24 @@
##
+# @BlockdevChangeReadOnlyMode:
+#
+# Specifies the new read-only mode of a block device subject to the
+# @blockdev-change-medium command.
+#
+# @retain: Retains the current read-only mode
+#
+# @read-only: Makes the device read-only
+#
+# @read-write: Makes the device writable
+#
+# Since: 2.3
+##
+{ 'enum': 'BlockdevChangeReadOnlyMode',
+ 'data': ['retain', 'read-only', 'read-write'] }
+
+
+##
# @blockdev-change-medium:
#
# Changes the medium inserted into a block device by ejecting the current medium
@@ -1973,12 +1991,16 @@
# @format: #optional, format to open the new image with (defaults to
# the probed format)
#
+# @read-only-mode: #optional, change the read-only mode of the device; defaults
+# to 'retain'
+#
# Since: 2.5
##
{ 'command': 'blockdev-change-medium',
'data': { 'device': 'str',
'filename': 'str',
- '*format': 'str' } }
+ '*format': 'str',
+ '*read-only-mode': 'BlockdevChangeReadOnlyMode' } }
##
diff --git a/qmp-commands.hx b/qmp-commands.hx
index f6d9c25..39d6e25 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -4183,7 +4183,7 @@ EQMP
{
.name = "blockdev-change-medium",
- .args_type = "device:B,filename:F,format:s?",
+ .args_type = "device:B,filename:F,format:s?,read-only-mode:s?",
.mhandler.cmd_new = qmp_marshal_blockdev_change_medium,
},
@@ -4199,6 +4199,8 @@ Arguments:
- "device": device name (json-string)
- "filename": filename of the new image (json-string)
- "format": format of the new image (json-string, optional)
+- "read-only-mode": new read-only mode (json-string, optional)
+ - Possible values: "retain" (default), "read-only", "read-write"
Examples:
@@ -4210,6 +4212,26 @@ Examples:
"format": "raw" } }
<- { "return": {} }
+2. Load a read-only medium into a writable drive
+
+-> { "execute": "blockdev-change-medium",
+ "arguments": { "device": "isa-fd0",
+ "filename": "/srv/images/ro.img",
+ "format": "raw",
+ "read-only-mode": "retain" } }
+
+<- { "error":
+ { "class": "GenericError",
+ "desc": "Could not open '/srv/images/ro.img': Permission denied" } }
+
+-> { "execute": "blockdev-change-medium",
+ "arguments": { "device": "isa-fd0",
+ "filename": "/srv/images/ro.img",
+ "format": "raw",
+ "read-only-mode": "read-only" } }
+
+<- { "return": {} }
+
EQMP
{
diff --git a/qmp.c b/qmp.c
index 4e44f98..ddc63ea 100644
--- a/qmp.c
+++ b/qmp.c
@@ -414,7 +414,8 @@ void qmp_change(const char *device, const char *target,
if (strcmp(device, "vnc") == 0) {
qmp_change_vnc(target, has_arg, arg, errp);
} else {
- qmp_blockdev_change_medium(device, target, has_arg, arg, errp);
+ qmp_blockdev_change_medium(device, target, has_arg, arg, false, 0,
+ errp);
}
}
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 2d8e4e2..1554331 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -1118,6 +1118,7 @@ QemuCocoaView *cocoaView;
[file cStringUsingEncoding:
NSASCIIStringEncoding],
true, "raw",
+ false, 0,
&err);
handleAnyDeviceErrors(err);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PULL v3 31/41] qemu-io: fix cvtnum lval types
2015-11-11 16:08 [Qemu-devel] [PULL v3 00/41] Block layer patches Kevin Wolf
2015-11-11 16:08 ` [Qemu-devel] [PULL v3 14/41] blockdev: read-only-mode for blockdev-change-medium Kevin Wolf
@ 2015-11-11 16:08 ` Kevin Wolf
2015-11-11 16:08 ` [Qemu-devel] [PULL v3 41/41] iotests: Check for quorum support in test 139 Kevin Wolf
2015-11-11 18:22 ` [Qemu-devel] [PULL v3 00/41] Block layer patches Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2015-11-11 16:08 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, qemu-devel
From: John Snow <jsnow@redhat.com>
cvtnum() returns int64_t: we should not be storing this
result inside of an int.
In a few cases, we need an extra sprinkling of error handling
where we expect to pass this number on towards a function that
expects something smaller than int64_t.
Reported-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
qemu-io-cmds.c | 125 ++++++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 89 insertions(+), 36 deletions(-)
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index 6e5d1e4..1e97f69 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -294,9 +294,10 @@ static void qemu_io_free(void *p)
qemu_vfree(p);
}
-static void dump_buffer(const void *buffer, int64_t offset, int len)
+static void dump_buffer(const void *buffer, int64_t offset, int64_t len)
{
- int i, j;
+ uint64_t i;
+ int j;
const uint8_t *p;
for (i = 0, p = buffer; i < len; i += 16) {
@@ -319,7 +320,7 @@ static void dump_buffer(const void *buffer, int64_t offset, int len)
}
static void print_report(const char *op, struct timeval *t, int64_t offset,
- int count, int total, int cnt, int Cflag)
+ int64_t count, int64_t total, int cnt, int Cflag)
{
char s1[64], s2[64], ts[64];
@@ -327,12 +328,12 @@ static void print_report(const char *op, struct timeval *t, int64_t offset,
if (!Cflag) {
cvtstr((double)total, s1, sizeof(s1));
cvtstr(tdiv((double)total, *t), s2, sizeof(s2));
- printf("%s %d/%d bytes at offset %" PRId64 "\n",
+ printf("%s %"PRId64"/%"PRId64" bytes at offset %" PRId64 "\n",
op, total, count, offset);
printf("%s, %d ops; %s (%s/sec and %.4f ops/sec)\n",
s1, cnt, ts, s2, tdiv((double)cnt, *t));
} else {/* bytes,ops,time,bytes/sec,ops/sec */
- printf("%d,%d,%s,%.3f,%.3f\n",
+ printf("%"PRId64",%d,%s,%.3f,%.3f\n",
total, cnt, ts,
tdiv((double)total, *t),
tdiv((double)cnt, *t));
@@ -393,11 +394,15 @@ fail:
return buf;
}
-static int do_read(BlockBackend *blk, char *buf, int64_t offset, int count,
- int *total)
+static int do_read(BlockBackend *blk, char *buf, int64_t offset, int64_t count,
+ int64_t *total)
{
int ret;
+ if (count >> 9 > INT_MAX) {
+ return -ERANGE;
+ }
+
ret = blk_read(blk, offset >> 9, (uint8_t *)buf, count >> 9);
if (ret < 0) {
return ret;
@@ -406,11 +411,15 @@ static int do_read(BlockBackend *blk, char *buf, int64_t offset, int count,
return 1;
}
-static int do_write(BlockBackend *blk, char *buf, int64_t offset, int count,
- int *total)
+static int do_write(BlockBackend *blk, char *buf, int64_t offset, int64_t count,
+ int64_t *total)
{
int ret;
+ if (count >> 9 > INT_MAX) {
+ return -ERANGE;
+ }
+
ret = blk_write(blk, offset >> 9, (uint8_t *)buf, count >> 9);
if (ret < 0) {
return ret;
@@ -419,9 +428,13 @@ static int do_write(BlockBackend *blk, char *buf, int64_t offset, int count,
return 1;
}
-static int do_pread(BlockBackend *blk, char *buf, int64_t offset, int count,
- int *total)
+static int do_pread(BlockBackend *blk, char *buf, int64_t offset,
+ int64_t count, int64_t *total)
{
+ if (count > INT_MAX) {
+ return -ERANGE;
+ }
+
*total = blk_pread(blk, offset, (uint8_t *)buf, count);
if (*total < 0) {
return *total;
@@ -429,9 +442,13 @@ static int do_pread(BlockBackend *blk, char *buf, int64_t offset, int count,
return 1;
}
-static int do_pwrite(BlockBackend *blk, char *buf, int64_t offset, int count,
- int *total)
+static int do_pwrite(BlockBackend *blk, char *buf, int64_t offset,
+ int64_t count, int64_t *total)
{
+ if (count > INT_MAX) {
+ return -ERANGE;
+ }
+
*total = blk_pwrite(blk, offset, (uint8_t *)buf, count);
if (*total < 0) {
return *total;
@@ -442,8 +459,8 @@ static int do_pwrite(BlockBackend *blk, char *buf, int64_t offset, int count,
typedef struct {
BlockBackend *blk;
int64_t offset;
- int count;
- int *total;
+ int64_t count;
+ int64_t *total;
int ret;
bool done;
} CoWriteZeroes;
@@ -463,8 +480,8 @@ static void coroutine_fn co_write_zeroes_entry(void *opaque)
*data->total = data->count;
}
-static int do_co_write_zeroes(BlockBackend *blk, int64_t offset, int count,
- int *total)
+static int do_co_write_zeroes(BlockBackend *blk, int64_t offset, int64_t count,
+ int64_t *total)
{
Coroutine *co;
CoWriteZeroes data = {
@@ -475,6 +492,10 @@ static int do_co_write_zeroes(BlockBackend *blk, int64_t offset, int count,
.done = false,
};
+ if (count >> BDRV_SECTOR_BITS > INT_MAX) {
+ return -ERANGE;
+ }
+
co = qemu_coroutine_create(co_write_zeroes_entry);
qemu_coroutine_enter(co, &data);
while (!data.done) {
@@ -488,10 +509,14 @@ static int do_co_write_zeroes(BlockBackend *blk, int64_t offset, int count,
}
static int do_write_compressed(BlockBackend *blk, char *buf, int64_t offset,
- int count, int *total)
+ int64_t count, int64_t *total)
{
int ret;
+ if (count >> 9 > INT_MAX) {
+ return -ERANGE;
+ }
+
ret = blk_write_compressed(blk, offset >> 9, (uint8_t *)buf, count >> 9);
if (ret < 0) {
return ret;
@@ -501,8 +526,12 @@ static int do_write_compressed(BlockBackend *blk, char *buf, int64_t offset,
}
static int do_load_vmstate(BlockBackend *blk, char *buf, int64_t offset,
- int count, int *total)
+ int64_t count, int64_t *total)
{
+ if (count > INT_MAX) {
+ return -ERANGE;
+ }
+
*total = blk_load_vmstate(blk, (uint8_t *)buf, offset, count);
if (*total < 0) {
return *total;
@@ -511,8 +540,12 @@ static int do_load_vmstate(BlockBackend *blk, char *buf, int64_t offset,
}
static int do_save_vmstate(BlockBackend *blk, char *buf, int64_t offset,
- int count, int *total)
+ int64_t count, int64_t *total)
{
+ if (count > INT_MAX) {
+ return -ERANGE;
+ }
+
*total = blk_save_vmstate(blk, (uint8_t *)buf, offset, count);
if (*total < 0) {
return *total;
@@ -642,10 +675,11 @@ static int read_f(BlockBackend *blk, int argc, char **argv)
int c, cnt;
char *buf;
int64_t offset;
- int count;
+ int64_t count;
/* Some compilers get confused and warn if this is not initialized. */
- int total = 0;
- int pattern = 0, pattern_offset = 0, pattern_count = 0;
+ int64_t total = 0;
+ int pattern = 0;
+ int64_t pattern_offset = 0, pattern_count = 0;
while ((c = getopt(argc, argv, "bCl:pP:qs:v")) != -1) {
switch (c) {
@@ -712,6 +746,10 @@ static int read_f(BlockBackend *blk, int argc, char **argv)
if (count < 0) {
printf("non-numeric length argument -- %s\n", argv[optind]);
return 0;
+ } else if (count > SIZE_MAX) {
+ printf("length cannot exceed %" PRIu64 ", given %s\n",
+ (uint64_t) SIZE_MAX, argv[optind]);
+ return 0;
}
if (!Pflag && (lflag || sflag)) {
@@ -734,7 +772,7 @@ static int read_f(BlockBackend *blk, int argc, char **argv)
return 0;
}
if (count & 0x1ff) {
- printf("count %d is not sector aligned\n",
+ printf("count %"PRId64" is not sector aligned\n",
count);
return 0;
}
@@ -762,7 +800,7 @@ static int read_f(BlockBackend *blk, int argc, char **argv)
memset(cmp_buf, pattern, pattern_count);
if (memcmp(buf + pattern_offset, cmp_buf, pattern_count)) {
printf("Pattern verification failed at offset %"
- PRId64 ", %d bytes\n",
+ PRId64 ", %"PRId64" bytes\n",
offset + pattern_offset, pattern_count);
}
g_free(cmp_buf);
@@ -957,9 +995,9 @@ static int write_f(BlockBackend *blk, int argc, char **argv)
int c, cnt;
char *buf = NULL;
int64_t offset;
- int count;
+ int64_t count;
/* Some compilers get confused and warn if this is not initialized. */
- int total = 0;
+ int64_t total = 0;
int pattern = 0xcd;
while ((c = getopt(argc, argv, "bcCpP:qz")) != -1) {
@@ -1019,6 +1057,10 @@ static int write_f(BlockBackend *blk, int argc, char **argv)
if (count < 0) {
printf("non-numeric length argument -- %s\n", argv[optind]);
return 0;
+ } else if (count > SIZE_MAX) {
+ printf("length cannot exceed %" PRIu64 ", given %s\n",
+ (uint64_t) SIZE_MAX, argv[optind]);
+ return 0;
}
if (!pflag) {
@@ -1029,7 +1071,7 @@ static int write_f(BlockBackend *blk, int argc, char **argv)
}
if (count & 0x1ff) {
- printf("count %d is not sector aligned\n",
+ printf("count %"PRId64" is not sector aligned\n",
count);
return 0;
}
@@ -1777,8 +1819,7 @@ static int discard_f(BlockBackend *blk, int argc, char **argv)
struct timeval t1, t2;
int Cflag = 0, qflag = 0;
int c, ret;
- int64_t offset;
- int count;
+ int64_t offset, count;
while ((c = getopt(argc, argv, "Cq")) != -1) {
switch (c) {
@@ -1808,6 +1849,11 @@ static int discard_f(BlockBackend *blk, int argc, char **argv)
if (count < 0) {
printf("non-numeric length argument -- %s\n", argv[optind]);
return 0;
+ } else if (count >> BDRV_SECTOR_BITS > INT_MAX) {
+ printf("length cannot exceed %"PRIu64", given %s\n",
+ (uint64_t)INT_MAX << BDRV_SECTOR_BITS,
+ argv[optind]);
+ return 0;
}
gettimeofday(&t1, NULL);
@@ -1833,11 +1879,10 @@ out:
static int alloc_f(BlockBackend *blk, int argc, char **argv)
{
BlockDriverState *bs = blk_bs(blk);
- int64_t offset, sector_num;
- int nb_sectors, remaining;
+ int64_t offset, sector_num, nb_sectors, remaining;
char s1[64];
- int num, sum_alloc;
- int ret;
+ int num, ret;
+ int64_t sum_alloc;
offset = cvtnum(argv[1]);
if (offset < 0) {
@@ -1854,6 +1899,10 @@ static int alloc_f(BlockBackend *blk, int argc, char **argv)
if (nb_sectors < 0) {
printf("non-numeric length argument -- %s\n", argv[2]);
return 0;
+ } else if (nb_sectors > INT_MAX) {
+ printf("length argument cannot exceed %d, given %s\n",
+ INT_MAX, argv[2]);
+ return 0;
}
} else {
nb_sectors = 1;
@@ -1881,7 +1930,7 @@ static int alloc_f(BlockBackend *blk, int argc, char **argv)
cvtstr(offset, s1, sizeof(s1));
- printf("%d/%d sectors allocated at offset %s\n",
+ printf("%"PRId64"/%"PRId64" sectors allocated at offset %s\n",
sum_alloc, nb_sectors, s1);
return 0;
}
@@ -2191,10 +2240,14 @@ static const cmdinfo_t sigraise_cmd = {
static int sigraise_f(BlockBackend *blk, int argc, char **argv)
{
- int sig = cvtnum(argv[1]);
+ int64_t sig = cvtnum(argv[1]);
if (sig < 0) {
printf("non-numeric signal number argument -- %s\n", argv[1]);
return 0;
+ } else if (sig > NSIG) {
+ printf("signal argument '%s' is too large to be a valid signal\n",
+ argv[1]);
+ return 0;
}
/* Using raise() to kill this process does not necessarily flush all open
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PULL v3 41/41] iotests: Check for quorum support in test 139
2015-11-11 16:08 [Qemu-devel] [PULL v3 00/41] Block layer patches Kevin Wolf
2015-11-11 16:08 ` [Qemu-devel] [PULL v3 14/41] blockdev: read-only-mode for blockdev-change-medium Kevin Wolf
2015-11-11 16:08 ` [Qemu-devel] [PULL v3 31/41] qemu-io: fix cvtnum lval types Kevin Wolf
@ 2015-11-11 16:08 ` Kevin Wolf
2015-11-11 18:22 ` [Qemu-devel] [PULL v3 00/41] Block layer patches Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2015-11-11 16:08 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, qemu-devel
From: Alberto Garcia <berto@igalia.com>
The quorum driver is always built in, but it is disabled during
run-time if there's no SHA256 support available (see commit e94867e).
This patch skips the quorum test in iotest 139 in that case.
Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: 1447172891-20410-1-git-send-email-berto@igalia.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
tests/qemu-iotests/139 | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/qemu-iotests/139 b/tests/qemu-iotests/139
index b5470f7..42f78c7 100644
--- a/tests/qemu-iotests/139
+++ b/tests/qemu-iotests/139
@@ -400,6 +400,8 @@ class TestBlockdevDel(iotests.QMPTestCase):
self.checkBlockDriverState('node1', False)
def testQuorum(self):
+ if not 'quorum' in iotests.qemu_img_pipe('--help'):
+ return
self.addQuorum('quorum0', 'node0', 'node1')
# We cannot remove the children of a Quorum device
self.delBlockDriverState('node0', expect_error = True)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PULL v3 00/41] Block layer patches
2015-11-11 16:08 [Qemu-devel] [PULL v3 00/41] Block layer patches Kevin Wolf
` (2 preceding siblings ...)
2015-11-11 16:08 ` [Qemu-devel] [PULL v3 41/41] iotests: Check for quorum support in test 139 Kevin Wolf
@ 2015-11-11 18:22 ` Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2015-11-11 18:22 UTC (permalink / raw)
To: Kevin Wolf; +Cc: QEMU Developers, Qemu-block
On 11 November 2015 at 16:08, Kevin Wolf <kwolf@redhat.com> wrote:
> The following changes since commit 3c07587d49458341510360557c849e93e9afaf59:
>
> Merge remote-tracking branch 'remotes/dgibson/tags/ppc-next-20151111' into staging (2015-11-11 09:34:18 +0000)
>
> are available in the git repository at:
>
>
> git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to 4d07c720f44beafd10907cecfd5b8a57622243c1:
>
> Merge remote-tracking branch 'mreitz/tags/pull-block-for-kevin-2015-11-11' into queue-block (2015-11-11 17:02:02 +0100)
>
> ----------------------------------------------------------------
>
> Block layer patches
>
> ----------------------------------------------------------------
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-11-11 18:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-11 16:08 [Qemu-devel] [PULL v3 00/41] Block layer patches Kevin Wolf
2015-11-11 16:08 ` [Qemu-devel] [PULL v3 14/41] blockdev: read-only-mode for blockdev-change-medium Kevin Wolf
2015-11-11 16:08 ` [Qemu-devel] [PULL v3 31/41] qemu-io: fix cvtnum lval types Kevin Wolf
2015-11-11 16:08 ` [Qemu-devel] [PULL v3 41/41] iotests: Check for quorum support in test 139 Kevin Wolf
2015-11-11 18:22 ` [Qemu-devel] [PULL v3 00/41] Block layer patches Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).