From e1544e53c01f61392e4afb2e05354e429fc8c32b Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Jeffrey Cody Date: Wed, 28 Aug 2013 13:14:47 +0200 Subject: [PATCH 05/13] vpc.c: Use get_option_parameter() does the search RH-Author: Jeffrey Cody Message-id: Patchwork-id: 53840 O-Subject: [RHEL6.5 qemu-kvm PATCH 05/13] vpc.c: Use get_option_parameter() does the search Bugzilla: 999779 RH-Acked-by: Stefan Hajnoczi RH-Acked-by: Kevin Wolf RH-Acked-by: Fam Zheng 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 (cherry picked from commit 2d56a546a73ca3f588196f4065621ff5f11f50e4) Signed-off-by: Jeff Cody --- block/vpc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) Signed-off-by: Michal Novotny --- block/vpc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/block/vpc.c b/block/vpc.c index 5203039..a1e6142 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -538,12 +538,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.11.7