From patchwork Fri Jul 18 20:54:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 371715 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 29E5B140143 for ; Sat, 19 Jul 2014 06:55:10 +1000 (EST) Received: from localhost ([::1]:51706 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X8FBL-0006l1-Vp for incoming@patchwork.ozlabs.org; Fri, 18 Jul 2014 16:55:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X8FAd-0005Pz-5D for qemu-devel@nongnu.org; Fri, 18 Jul 2014 16:54:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X8FAV-0002KA-LH for qemu-devel@nongnu.org; Fri, 18 Jul 2014 16:54:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4304) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X8FAV-0002K0-EI for qemu-devel@nongnu.org; Fri, 18 Jul 2014 16:54:15 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6IKsEeA017952 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 18 Jul 2014 16:54:14 -0400 Received: from localhost (ovpn-112-26.phx2.redhat.com [10.3.112.26]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6IKsBla017070 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Fri, 18 Jul 2014 16:54:13 -0400 From: Jeff Cody To: qemu-devel@nongnu.org Date: Fri, 18 Jul 2014 16:54:00 -0400 Message-Id: <3ed71014d6c4ea5e11ee62c0f205dd996c3ad8d5.1405715876.git.jcody@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, sw@weilnetz.de, stefanha@redhat.com Subject: [Qemu-devel] [PATCH 3/4] block: use the standard 'ret' instead of 'result' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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. Signed-off-by: Jeff Cody Reviewed-by: Max Reitz --- block/vdi.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/block/vdi.c b/block/vdi.c index a74ba85..880aeea 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -357,23 +357,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, @@ -681,7 +681,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; @@ -711,21 +711,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; } @@ -759,8 +759,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; } @@ -775,8 +775,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; } @@ -784,8 +784,8 @@ static int vdi_create(const char *filename, QemuOpts *opts, Error **errp) } if (image_type == VDI_TYPE_STATIC) { - result = bdrv_truncate(bs->file, offset + blocks * block_size); - if (result < 0) { + ret = bdrv_truncate(bs->file, offset + blocks * block_size); + if (ret < 0) { error_setg(errp, "Failed to statically allocate %s", filename); goto exit; } @@ -794,7 +794,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)