mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
qemu-config: qemu_read_config_file() reads the normal config file
Introduce a new function qemu_read_config_file which reads the VM configuration from a config file. Unlike qemu_config_parse it doesn't take a open file but a filename and reduces code duplication as a side effect. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
6c557ab975
commit
dcfb0939bd
3 changed files with 28 additions and 24 deletions
|
@ -488,3 +488,18 @@ out:
|
|||
loc_pop(&loc);
|
||||
return res;
|
||||
}
|
||||
|
||||
int qemu_read_config_file(const char *filename)
|
||||
{
|
||||
FILE *f = fopen(filename, "r");
|
||||
if (f == NULL) {
|
||||
return -errno;
|
||||
}
|
||||
|
||||
if (qemu_config_parse(f, filename) != 0) {
|
||||
return -EINVAL;
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue