]> git.proxmox.com Git - qemu.git/commitdiff
vpc.c: Use get_option_parameter() does the search
authorMitnick Lyu <mitnick.lyu@gmail.com>
Wed, 13 Apr 2011 09:30:54 +0000 (17:30 +0800)
committerKevin Wolf <kwolf@redhat.com>
Wed, 13 Apr 2011 10:31:41 +0000 (12:31 +0200)
Use get_option_parameter() to instead of duplicating the loop, and
use BDRV_SECTOR_SIZE to instead of 512

Signed-off-by: Mitnick Lyu <mitnick.lyu@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/vpc.c

index 7b025be01d967fc4b8a3bfe99140542118e52aa5..56865da5bc414cd168fac1ae2f0dc96563e961b9 100644 (file)
@@ -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);