Skip to contentSkip to conversation

vpc.c: Use get_option_parameter() does the search

PATCH Applied Mitnick Lyu 2 participants 2 messages Apr 13, 2011 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vpc.c: Use get_option_parameter() does the search

Use get_option_parameter() to instead of duplicating the loop, and use BDRV_SECTOR_SIZE to instead of 512

---
 block/vpc.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
block/vpc.c +2 -6
index 7b025be..56865da 100644
@@ -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);
Signature · 1 line
1.7.0.4
Applied
#1 lore raw

Am 13.04.2011 11:30, schrieb Mitnick Lyu:

Quoted 3 lines

Use get_option_parameter() to instead of duplicating the loop, and use BDRV_SECTOR_SIZE to instead of 512

Thanks, applied to the block branch.

Kevin