Statistics
| Branch: | Revision:

root / qemu-option.c @ a22f123c

History | View | Annotate | Download (24.1 kB)

# Date Author Comment
7267c094 08/21/2011 07:01 am Anthony Liguori

Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <>

898c257b 12/14/2010 04:44 pm Stefan Hajnoczi

qemu-option: Don't reinvent append_option_parameters()

parse_option_parameters() may need to create a new option parameter list
from a template list. Use append_option_parameters() instead of
duplicating the code.

Signed-off-by: Stefan Hajnoczi <>...

0e72e753 12/14/2010 04:44 pm Stefan Hajnoczi

qemu-option: Fix parse_option_parameters() documentation typo

Yoda said, "list is the templace is". Fix this.

Signed-off-by: Stefan Hajnoczi <>
Signed-off-by: Kevin Wolf <>

94ac7268 07/06/2010 06:05 pm Markus Armbruster

error: New qemu_opts_loc_restore()

Needed for decent error locations when complaining about options
outside of qemu_opts_foreach(). That one sets the location
already.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

bb67ab02 07/02/2010 02:18 pm Markus Armbruster

qemu-option: New qemu_opts_reset()

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

b560a9ab 06/14/2010 11:46 pm Markus Armbruster

qemu-option: Reject anti-social IDs

Restrict IDs to letters, digits, '-', '.', '_', starting with a
letter.

This takes care of '/' in qdev IDs breaking qbus_find().

Signed-off-by: Markus Armbruster <>
Signed-off-by: Anthony Liguori <>

bd69fe84 06/14/2010 07:12 pm Kevin Wolf

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 a
properly terminated list after the realloc. Initialize it as an empty list.

Signed-off-by: Kevin Wolf <>...

b50cbabc 05/28/2010 02:14 pm MORITA Kazutaka

add support for protocol driver create_options

This patch enables protocol drivers to use their create options which
are not supported by the format. For example, protcol drivers can use
a backing_file option with raw format.

Signed-off-by: MORITA Kazutaka <>...

d510c5cf 05/03/2010 08:09 pm Jan Kiszka

Fix tiny leak in qemu_opts_parse

qemu_opts_create duplicates the id we pass in case it shall be stored in
the opts. So we do not need to dup it in qemu_opts_parse, leaking a few
bytes this way.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

975b63a4 04/19/2010 12:46 am Markus Armbruster

error: Convert qemu_opts_create() to QError

Fixes device_add to report duplicate ID properly in QMP, as
DuplicateId instead of UndefinedError.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Luiz Capitulino <>

c64f27d4 04/19/2010 12:46 am Markus Armbruster

error: Convert qemu_opts_set() to QError

Signed-off-by: Markus Armbruster <>
Signed-off-by: Luiz Capitulino <>

db716e9c 04/19/2010 12:46 am Markus Armbruster

error: Convert qemu_opts_validate() to QError

Signed-off-by: Markus Armbruster <>
Signed-off-by: Luiz Capitulino <>

d35215f8 03/18/2010 10:48 pm Blue Swirl

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 <>

01e7f188 03/16/2010 06:45 pm Markus Armbruster

qemu-option: Functions to convert to/from QDict

The functions are somewhat restricted. Good enough for the job at
hand. We'll extend them when we need more.

8212c64f 03/16/2010 06:45 pm Markus Armbruster

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()....

827b0813 03/16/2010 05:58 pm Markus Armbruster

error: Infrastructure to track locations for error reporting

New struct Location holds a location. So far, the only location is
LOC_NONE, so this doesn't do anything useful yet.

Passing the current location all over the place would be too
cumbersome. Hide it away in static cur_loc instead, and provide...

238431a9 02/21/2010 06:01 pm Blue Swirl

Allow const QemuOptDesc

Signed-off-by: Blue Swirl <>

4a2594dd 02/03/2010 08:39 pm Markus Armbruster

qemu-option: Make qemu_opts_foreach() accumulate return values

Return the bitwise inclusive or of all return values instead of the
last call's value. This lets you find out whether any of the calls
returned a non-zero value.

No functional change, as existing users either don't care for the...

d318ff99 12/12/2009 03:59 pm Gerd Hoffmann

QemuOpts: allow larger option values.

Use case: loooooooooooooooooong file names for -drive file=...

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

b09417b9 12/03/2009 07:45 pm Jan Kiszka

qemu-opts: Release id on deletion

The opts id is always allocated via qemu_strdup, so it need not be
const, but it has to be released on opts deletion.

Signed-off-by: Jan Kiszka <>
Signed-off-by: Anthony Liguori <>

a676968b 10/06/2009 10:36 pm Mark McLoughlin

Remove bogus error message from qemu_opts_set()

The only way qemu_opts_create() can fail is if a QemuOpts with that id
already exists and fail_if_exists=1. In that case, we already print
an error which makes more sense than the one in qemu_opts_set().

Signed-off-by: Mark McLoughlin <>...

2cfa571f 10/06/2009 10:36 pm Mark McLoughlin

Make qemu_opts_parse() handle empty strings

Rather than making callers explicitly handle empty strings by using
qemu_opts_create(), we can easily have qemu_opts_parse() handle
empty parameter strings.

Signed-off-by: Mark McLoughlin <>
Signed-off-by: Anthony Liguori <>

5dc519ef 10/06/2009 10:36 pm Mark McLoughlin

Add qemu_opts_validate() for post parsing validation

Several qemu command line options have a parameter whose value affects
what other parameters are accepted for the option.

In these cases, we can have an empty description table in the
QemuOptsList and once the option has been parsed we can use a suitable...

dc9ca4ba 10/06/2009 10:36 pm Mark McLoughlin

Never overwrite a QemuOpt

Rather than overwriting a QemuOpt, just add a new one to the tail and
always do a reverse search for parameters to preserve the same
behaviour. We use this order so that foreach() iterates over the opts
in their original order.
...

1f5c1775 09/26/2009 10:34 pm Juan Quintela

qemu-option: rename bool -> boolean

We need this to allow the use of <stdbool.h>

Signed-off-by: Juan Quintela <>
Acked-by: Gerd Hoffmann <>
Signed-off-by: Aurelien Jarno <>

3df04ac3 09/25/2009 10:57 pm Mark McLoughlin

Fix coding style issue

Replace:

if (-1  foo())

with:

if (foo()  -1)

While this coding style is not in direct contravention of our currently
ratified CODING_STYLE treaty, it could be argued that the Article 3 of
the European Convention on Human Rights (prohibiting torture and "inhuman...

72cf2d4f 09/12/2009 10:36 am Blue Swirl

Fix sys-queue.h conflict for good

Problem: Our file sys-queue.h is a copy of the BSD file, but there are
some additions and it's not entirely compatible. Because of that, there have
been conflicts with system headers on BSD systems. Some hacks have been
introduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,...

96729cbd 09/11/2009 06:19 pm Gerd Hoffmann

QemuOpts: split option parser into two functions.

looking for id= and creating a new QemuOpts instance is splitted from
the actual option parser code now, so the parser can be called from
other contexts too.

Signed-off-by: Gerd Hoffmann <>...

d4c3fddd 09/09/2009 10:57 pm Jean-Christophe DUBOIS

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 <>
Signed-off-by: Anthony Liguori <>

6d378185 08/10/2009 09:05 pm Gerd Hoffmann

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

Signed-off-by: Gerd Hoffmann <>...

48026075 08/10/2009 09:05 pm Gerd Hoffmann

QemuOpts: add some functions

qemu_opt_foreach: loop over all QemuOpts entries.
qemu_opts_id: return QemuOpts id.

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>
Message-Id:

21c9f4cd 07/30/2009 05:50 pm Gerd Hoffmann

qemu-option: fix parse_option_number().

It works much better when parse_option_number actually
returns 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 <>...

62c5802e 07/27/2009 10:08 pm Gerd Hoffmann

move parser functions from vl.c to qemu-option.c

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

67b1355b 07/27/2009 10:08 pm Gerd Hoffmann

qemu-option: factor out parse_option_bool

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

7695019b 07/27/2009 10:08 pm Gerd Hoffmann

qemu-option: factor out parse_option_size

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

e27c88fe 07/27/2009 10:08 pm Gerd Hoffmann

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....

db08adf5 06/06/2009 06:38 pm Kevin Wolf

qemu-img: Print available options with -o ?

This patch adds a small help text to each of the options in the block drivers
which can be displayed by using qemu-img create -f fmt -o ?

Signed-off-by: Kevin Wolf <>

d3f24367 05/22/2009 06:50 pm Kevin Wolf

Create qemu-option.h

This patch creates a new header file and the corresponding implementation file
for parsing of parameter strings for options (like used in -drive). Part of
this 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...