[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 36/62] block: use the standard 'ret' instead of 'resu
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 36/62] block: use the standard 'ret' instead of 'result' |
Date: |
Fri, 8 Aug 2014 19:39:37 +0200 |
From: Jeff Cody <address@hidden>
Most QEMU code uses 'ret' for function return values. The VDI driver
uses a mix of 'result' and 'ret'. This cleans that up, switching over
to the standard 'ret' usage.
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Jeff Cody <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/vdi.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/block/vdi.c b/block/vdi.c
index 070acb6..9d62a3c 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -350,23 +350,23 @@ static int vdi_make_empty(BlockDriverState *bs)
static int vdi_probe(const uint8_t *buf, int buf_size, const char *filename)
{
const VdiHeader *header = (const VdiHeader *)buf;
- int result = 0;
+ int ret = 0;
logout("\n");
if (buf_size < sizeof(*header)) {
/* Header too small, no VDI. */
} else if (le32_to_cpu(header->signature) == VDI_SIGNATURE) {
- result = 100;
+ ret = 100;
}
- if (result == 0) {
+ if (ret == 0) {
logout("no vdi image\n");
} else {
logout("%s", header->text);
}
- return result;
+ return ret;
}
static int vdi_open(BlockDriverState *bs, QDict *options, int flags,
@@ -674,7 +674,7 @@ static int vdi_co_write(BlockDriverState *bs,
static int vdi_create(const char *filename, QemuOpts *opts, Error **errp)
{
- int result = 0;
+ int ret = 0;
uint64_t bytes = 0;
uint32_t blocks;
size_t block_size = DEFAULT_CLUSTER_SIZE;
@@ -704,21 +704,21 @@ static int vdi_create(const char *filename, QemuOpts
*opts, Error **errp)
#endif
if (bytes > VDI_DISK_SIZE_MAX) {
- result = -ENOTSUP;
+ ret = -ENOTSUP;
error_setg(errp, "Unsupported VDI image size (size is 0x%" PRIx64
", max supported is 0x%" PRIx64 ")",
bytes, VDI_DISK_SIZE_MAX);
goto exit;
}
- result = bdrv_create_file(filename, opts, &local_err);
- if (result < 0) {
+ ret = bdrv_create_file(filename, opts, &local_err);
+ if (ret < 0) {
error_propagate(errp, local_err);
goto exit;
}
- result = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR |
BDRV_O_PROTOCOL,
- NULL, &local_err);
- if (result < 0) {
+ ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,
+ NULL, &local_err);
+ if (ret < 0) {
error_propagate(errp, local_err);
goto exit;
}
@@ -752,8 +752,8 @@ static int vdi_create(const char *filename, QemuOpts *opts,
Error **errp)
vdi_header_print(&header);
#endif
vdi_header_to_le(&header);
- result = bdrv_pwrite_sync(bs, offset, &header, sizeof(header));
- if (result < 0) {
+ ret = bdrv_pwrite_sync(bs, offset, &header, sizeof(header));
+ if (ret < 0) {
error_setg(errp, "Error writing header to %s", filename);
goto exit;
}
@@ -768,8 +768,8 @@ static int vdi_create(const char *filename, QemuOpts *opts,
Error **errp)
bmap[i] = VDI_UNALLOCATED;
}
}
- result = bdrv_pwrite_sync(bs, offset, bmap, bmap_size);
- if (result < 0) {
+ ret = bdrv_pwrite_sync(bs, offset, bmap, bmap_size);
+ if (ret < 0) {
error_setg(errp, "Error writing bmap to %s", filename);
goto exit;
}
@@ -777,8 +777,8 @@ static int vdi_create(const char *filename, QemuOpts *opts,
Error **errp)
}
if (image_type == VDI_TYPE_STATIC) {
- result = bdrv_truncate(bs, offset + blocks * block_size);
- if (result < 0) {
+ ret = bdrv_truncate(bs, offset + blocks * block_size);
+ if (ret < 0) {
error_setg(errp, "Failed to statically allocate %s", filename);
goto exit;
}
@@ -787,7 +787,7 @@ static int vdi_create(const char *filename, QemuOpts *opts,
Error **errp)
exit:
bdrv_unref(bs);
g_free(bmap);
- return result;
+ return ret;
}
static void vdi_close(BlockDriverState *bs)
--
1.8.3.1
- [Qemu-devel] [PULL 22/62] block: Support Archipelago as a QEMU block backend, (continued)
- [Qemu-devel] [PULL 22/62] block: Support Archipelago as a QEMU block backend, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 26/62] qemu-iotests: add support for Archipelago protocol, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 27/62] coroutine: make pool size dynamic, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 28/62] block: bump coroutine pool size for drives, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 29/62] thread-pool: avoid per-thread-pool EventNotifier, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 30/62] thread-pool: avoid deadlock in nested aio_poll() calls, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 31/62] block: vhdx - add error check, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 32/62] block: VHDX endian fixes, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 33/62] test-coroutine: add baseline test that times the cost of function calls, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 34/62] block: allow bdrv_unref() to be passed NULL pointers, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 36/62] block: use the standard 'ret' instead of 'result',
Kevin Wolf <=
- [Qemu-devel] [PULL 39/62] block: Introduce qemu_try_blockalign(), Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 37/62] block: vpc - use block layer ops in vpc_create, instead of posix calls, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 35/62] block: vdi - use block layer ops in vdi_create, instead of posix calls, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 41/62] bochs: Handle failure for potentially large allocations, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 38/62] block: iotest - update 084 to test static VDI image creation, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 40/62] block: Handle failure for potentially large allocations, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 42/62] cloop: Handle failure for potentially large allocations, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 44/62] dmg: Handle failure for potentially large allocations, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 45/62] iscsi: Handle failure for potentially large allocations, Kevin Wolf, 2014/08/08
- [Qemu-devel] [PULL 46/62] nfs: Handle failure for potentially large allocations, Kevin Wolf, 2014/08/08