mirror of https://github.com/xqemu/xqemu.git
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>
This commit is contained in:
parent
996faf1ad4
commit
2d56a546a7
|
@ -505,12 +505,8 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options)
|
||||||
int ret = -EIO;
|
int ret = -EIO;
|
||||||
|
|
||||||
// Read out options
|
// Read out options
|
||||||
while (options && options->name) {
|
total_sectors = get_option_parameter(options, BLOCK_OPT_SIZE)->value.n /
|
||||||
if (!strcmp(options->name, "size")) {
|
BDRV_SECTOR_SIZE;
|
||||||
total_sectors = options->value.n / 512;
|
|
||||||
}
|
|
||||||
options++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the file
|
// Create the file
|
||||||
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
|
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
|
||||||
|
|
Loading…
Reference in New Issue