cryptospore / rpms / qemu-kvm

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