History | View | Annotate | Download (24.4 kB)
error: New qemu_opts_loc_restore()
Needed for decent error locations when complaining about optionsoutside of qemu_opts_foreach(). That one sets the locationalready.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
qemu-option: New qemu_opts_reset()
qemu-option: Reject anti-social IDs
Restrict IDs to letters, digits, '-', '.', '_', starting with aletter.
This takes care of '/' in qdev IDs breaking qbus_find().
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-option: Fix uninitialized value in append_option_parameter
When dest is NULL, i.e. a new copy of the list is created, we don't get aproperly terminated list after the realloc. Initialize it as an empty list.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>...
add support for protocol driver create_options
This patch enables protocol drivers to use their create options whichare not supported by the format. For example, protcol drivers can usea backing_file option with raw format.
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>...
Fix tiny leak in qemu_opts_parse
qemu_opts_create duplicates the id we pass in case it shall be stored inthe opts. So we do not need to dup it in qemu_opts_parse, leaking a fewbytes this way.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
error: Convert qemu_opts_create() to QError
Fixes device_add to report duplicate ID properly in QMP, asDuplicateId instead of UndefinedError.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
error: Convert qemu_opts_set() to QError
error: Convert qemu_opts_validate() to QError
Fix OpenBSD linker warning
qemu-option.o(.text+0x20f8): In function `qemu_opts_from_qdict_1':/src/qemu/qemu-option.c:813: warning: strcpy() is almost always misused, please use strlcpy()
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
qemu-option: Functions to convert to/from QDict
The functions are somewhat restricted. Good enough for the job athand. We'll extend them when we need more.
qemu-option: Move the implied first name into QemuOptsList
We sometimes permit omitting the first option name, for example-device foo is short for -device driver=foo. The name to use("driver" in the example) is passed as argument to qemu_opts_parse()....
error: Infrastructure to track locations for error reporting
New struct Location holds a location. So far, the only location isLOC_NONE, so this doesn't do anything useful yet.
Passing the current location all over the place would be toocumbersome. Hide it away in static cur_loc instead, and provide...
Allow const QemuOptDesc
qemu-option: Make qemu_opts_foreach() accumulate return values
Return the bitwise inclusive or of all return values instead of thelast call's value. This lets you find out whether any of the callsreturned a non-zero value.
No functional change, as existing users either don't care for the...
QemuOpts: allow larger option values.
Use case: loooooooooooooooooong file names for -drive file=...
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-opts: Release id on deletion
The opts id is always allocated via qemu_strdup, so it need not beconst, but it has to be released on opts deletion.
Remove bogus error message from qemu_opts_set()
The only way qemu_opts_create() can fail is if a QemuOpts with that idalready exists and fail_if_exists=1. In that case, we already printan error which makes more sense than the one in qemu_opts_set().
Signed-off-by: Mark McLoughlin <markmc@redhat.com>...
Make qemu_opts_parse() handle empty strings
Rather than making callers explicitly handle empty strings by usingqemu_opts_create(), we can easily have qemu_opts_parse() handleempty parameter strings.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Add qemu_opts_validate() for post parsing validation
Several qemu command line options have a parameter whose value affectswhat other parameters are accepted for the option.
In these cases, we can have an empty description table in theQemuOptsList and once the option has been parsed we can use a suitable...
Never overwrite a QemuOpt
Rather than overwriting a QemuOpt, just add a new one to the tail andalways do a reverse search for parameters to preserve the samebehaviour. We use this order so that foreach() iterates over the optsin their original order....
qemu-option: rename bool -> boolean
We need this to allow the use of <stdbool.h>
Signed-off-by: Juan Quintela <quintela@redhat.com>Acked-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Fix coding style issue
Replace:
if (-1 foo())
with:
if (foo() -1)
While this coding style is not in direct contravention of our currentlyratified CODING_STYLE treaty, it could be argued that the Article 3 ofthe European Convention on Human Rights (prohibiting torture and "inhuman...
Fix sys-queue.h conflict for good
Problem: Our file sys-queue.h is a copy of the BSD file, but there aresome additions and it's not entirely compatible. Because of that, there havebeen conflicts with system headers on BSD systems. Some hacks have beenintroduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,...
QemuOpts: split option parser into two functions.
looking for id= and creating a new QemuOpts instance is splitted fromthe actual option parser code now, so the parser can be called fromother contexts too.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>...
mv from strdup to qemu_strdup in qemu-option.c
one place is using strdup() instead of qemu_strdup
Fix it
Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
QemuOpts: qemu_opts_parse: fix id= parsing
We can't use get_param_value(), it can't handle parameters without'=' in there. Examples not working because of that:
-device foo,id=bar -device file=/path/image,format=qcow2,snapshot,id=disk0
QemuOpts: add some functions
qemu_opt_foreach: loop over all QemuOpts entries.qemu_opts_id: return QemuOpts id.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Message-Id:
qemu-option: fix parse_option_number().
It works much better when parse_option_number actuallyreturns the number parsed ...
Common breakage resulting from this bug is that'qemu -hda foo.img -cdrom bar.iso' stops working(cdrom isn't there).
Cc: Avi Kivity <avi@redhat.com>...
move parser functions from vl.c to qemu-option.c
qemu-option: factor out parse_option_bool
qemu-option: factor out parse_option_size
QemuOpts: framework for storing and parsing options.
This stores device parameters in a better way than unparsed strings.
New types: QemuOpt - one key-value pair. QemuOpts - group of key-value pairs, belonging to one device, i.e. one drive....
qemu-img: Print available options with -o ?
This patch adds a small help text to each of the options in the block driverswhich can be displayed by using qemu-img create -f fmt -o ?
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Create qemu-option.h
This patch creates a new header file and the corresponding implementation filefor parsing of parameter strings for options (like used in -drive). Part ofthis is code moved from vl.c (so qemu-img can use it later).
The idea is to have a data structure describing all accepted parameters. When...