From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9yms-000313-M4 for qemu-devel@nongnu.org; Wed, 13 Apr 2011 08:03:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q9ymn-0003kC-4m for qemu-devel@nongnu.org; Wed, 13 Apr 2011 08:03:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52433) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9ymm-0003jz-Sp for qemu-devel@nongnu.org; Wed, 13 Apr 2011 08:03:05 -0400 From: Kevin Wolf Date: Wed, 13 Apr 2011 14:05:16 +0200 Message-Id: <1302696316-26190-11-git-send-email-kwolf@redhat.com> In-Reply-To: <1302696316-26190-1-git-send-email-kwolf@redhat.com> References: <1302696316-26190-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 10/10] vpc.c: Use get_option_parameter() does the search List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Mitnick Lyu Use get_option_parameter() to instead of duplicating the loop, and use BDRV_SECTOR_SIZE to instead of 512 Signed-off-by: Mitnick Lyu Signed-off-by: Kevin Wolf --- block/vpc.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/block/vpc.c b/block/vpc.c index 7b025be..56865da 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -505,12 +505,8 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options) int ret = -EIO; // Read out options - while (options && options->name) { - if (!strcmp(options->name, "size")) { - total_sectors = options->value.n / 512; - } - options++; - } + total_sectors = get_option_parameter(options, BLOCK_OPT_SIZE)->value.n / + BDRV_SECTOR_SIZE; // Create the file fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); -- 1.7.2.3