提交 2d56a546 编写于 作者: M Mitnick Lyu 提交者: Kevin Wolf

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: NMitnick Lyu <mitnick.lyu@gmail.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 996faf1a
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册