|
|
9ae3a8 |
From 826ac25b8740b86a5c6081ae35eed45d6cbb5f2b Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Jeffrey Cody <jcody@redhat.com>
|
|
|
9ae3a8 |
Date: Tue, 16 Sep 2014 20:11:52 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 14/20] block: use the standard 'ret' instead of 'result'
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Message-id: <48fc259f545a424dff6e0308e0f7a12ec425d0dc.1410897407.git.jcody@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 61218
|
|
|
9ae3a8 |
O-Subject: [PATCH qemu-kvm-rhel RHEL7.1 13/15] block: use the standard 'ret' instead of 'result'
|
|
|
9ae3a8 |
Bugzilla: 1098086
|
|
|
9ae3a8 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Most QEMU code uses 'ret' for function return values. The VDI driver
|
|
|
9ae3a8 |
uses a mix of 'result' and 'ret'. This cleans that up, switching over
|
|
|
9ae3a8 |
to the standard 'ret' usage.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Jeff Cody <jcody@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit dddc7750d68c3ea86d88b060a77acb60d2eeb4a7)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RHEL7 Notes: Difference from upstream is due to conflict resolution from
|
|
|
9ae3a8 |
previous patch.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Jeff Cody <jcody@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block/vdi.c | 34 +++++++++++++++++-----------------
|
|
|
9ae3a8 |
1 files changed, 17 insertions(+), 17 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/block/vdi.c b/block/vdi.c
|
|
|
9ae3a8 |
index 1f4491f..298ee12 100644
|
|
|
9ae3a8 |
--- a/block/vdi.c
|
|
|
9ae3a8 |
+++ b/block/vdi.c
|
|
|
9ae3a8 |
@@ -350,23 +350,23 @@ static int vdi_make_empty(BlockDriverState *bs)
|
|
|
9ae3a8 |
static int vdi_probe(const uint8_t *buf, int buf_size, const char *filename)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
const VdiHeader *header = (const VdiHeader *)buf;
|
|
|
9ae3a8 |
- int result = 0;
|
|
|
9ae3a8 |
+ int ret = 0;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
logout("\n");
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (buf_size < sizeof(*header)) {
|
|
|
9ae3a8 |
/* Header too small, no VDI. */
|
|
|
9ae3a8 |
} else if (le32_to_cpu(header->signature) == VDI_SIGNATURE) {
|
|
|
9ae3a8 |
- result = 100;
|
|
|
9ae3a8 |
+ ret = 100;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- if (result == 0) {
|
|
|
9ae3a8 |
+ if (ret == 0) {
|
|
|
9ae3a8 |
logout("no vdi image\n");
|
|
|
9ae3a8 |
} else {
|
|
|
9ae3a8 |
logout("%s", header->text);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- return result;
|
|
|
9ae3a8 |
+ return ret;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static int vdi_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
@@ -673,7 +673,7 @@ static int vdi_co_write(BlockDriverState *bs,
|
|
|
9ae3a8 |
static int vdi_create(const char *filename, QEMUOptionParameter *options,
|
|
|
9ae3a8 |
Error **errp)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- int result = 0;
|
|
|
9ae3a8 |
+ int ret = 0;
|
|
|
9ae3a8 |
uint64_t bytes = 0;
|
|
|
9ae3a8 |
uint32_t blocks;
|
|
|
9ae3a8 |
size_t block_size = DEFAULT_CLUSTER_SIZE;
|
|
|
9ae3a8 |
@@ -710,20 +710,20 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options,
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (bytes > VDI_DISK_SIZE_MAX) {
|
|
|
9ae3a8 |
- result = -ENOTSUP;
|
|
|
9ae3a8 |
+ ret = -ENOTSUP;
|
|
|
9ae3a8 |
error_setg(errp, "Unsupported VDI image size (size is 0x%" PRIx64
|
|
|
9ae3a8 |
", max supported is 0x%" PRIx64 ")",
|
|
|
9ae3a8 |
bytes, VDI_DISK_SIZE_MAX);
|
|
|
9ae3a8 |
goto exit;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- result = bdrv_create_file(filename, options, &local_err);
|
|
|
9ae3a8 |
- if (result < 0) {
|
|
|
9ae3a8 |
+ ret = bdrv_create_file(filename, options, &local_err);
|
|
|
9ae3a8 |
+ if (ret < 0) {
|
|
|
9ae3a8 |
error_propagate(errp, local_err);
|
|
|
9ae3a8 |
goto exit;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
- result = bdrv_file_open(&bs, filename, NULL, BDRV_O_RDWR, &local_err);
|
|
|
9ae3a8 |
- if (result < 0) {
|
|
|
9ae3a8 |
+ ret = bdrv_file_open(&bs, filename, NULL, BDRV_O_RDWR, &local_err);
|
|
|
9ae3a8 |
+ if (ret < 0) {
|
|
|
9ae3a8 |
error_propagate(errp, local_err);
|
|
|
9ae3a8 |
goto exit;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -757,8 +757,8 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options,
|
|
|
9ae3a8 |
vdi_header_print(&header);
|
|
|
9ae3a8 |
#endif
|
|
|
9ae3a8 |
vdi_header_to_le(&header);
|
|
|
9ae3a8 |
- result = bdrv_pwrite_sync(bs, offset, &header, sizeof(header));
|
|
|
9ae3a8 |
- if (result < 0) {
|
|
|
9ae3a8 |
+ ret = bdrv_pwrite_sync(bs, offset, &header, sizeof(header));
|
|
|
9ae3a8 |
+ if (ret < 0) {
|
|
|
9ae3a8 |
error_setg(errp, "Error writing header to %s", filename);
|
|
|
9ae3a8 |
goto exit;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -773,8 +773,8 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options,
|
|
|
9ae3a8 |
bmap[i] = VDI_UNALLOCATED;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
- result = bdrv_pwrite_sync(bs, offset, bmap, bmap_size);
|
|
|
9ae3a8 |
- if (result < 0) {
|
|
|
9ae3a8 |
+ ret = bdrv_pwrite_sync(bs, offset, bmap, bmap_size);
|
|
|
9ae3a8 |
+ if (ret < 0) {
|
|
|
9ae3a8 |
error_setg(errp, "Error writing bmap to %s", filename);
|
|
|
9ae3a8 |
goto exit;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -782,8 +782,8 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options,
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (image_type == VDI_TYPE_STATIC) {
|
|
|
9ae3a8 |
- result = bdrv_truncate(bs, offset + blocks * block_size);
|
|
|
9ae3a8 |
- if (result < 0) {
|
|
|
9ae3a8 |
+ ret = bdrv_truncate(bs, offset + blocks * block_size);
|
|
|
9ae3a8 |
+ if (ret < 0) {
|
|
|
9ae3a8 |
error_setg(errp, "Failed to statically allocate %s", filename);
|
|
|
9ae3a8 |
goto exit;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -792,7 +792,7 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options,
|
|
|
9ae3a8 |
exit:
|
|
|
9ae3a8 |
bdrv_unref(bs);
|
|
|
9ae3a8 |
g_free(bmap);
|
|
|
9ae3a8 |
- return result;
|
|
|
9ae3a8 |
+ return ret;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static void vdi_close(BlockDriverState *bs)
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|