diff options
author | Mitnick Lyu <mitnick.lyu@gmail.com> | 2011-04-13 17:30:54 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2011-04-13 12:31:41 +0200 |
commit | 2d56a546a73ca3f588196f4065621ff5f11f50e4 (patch) | |
tree | 29c0210611d239caa20f2841f8656bb7ddbf8b03 /block/vpc.c | |
parent | 996faf1ad4a93342e381766d95686b16624f0dbd (diff) | |
download | qemu-2d56a546a73ca3f588196f4065621ff5f11f50e4.zip qemu-2d56a546a73ca3f588196f4065621ff5f11f50e4.tar.gz qemu-2d56a546a73ca3f588196f4065621ff5f11f50e4.tar.bz2 |
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
Signed-off-by: Mitnick Lyu <mitnick.lyu@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/vpc.c')
-rw-r--r-- | 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); |