[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v23 06/32] add qemu_opt_get_*_del functions for
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v23 06/32] add qemu_opt_get_*_del functions for replace work |
Date: |
Tue, 25 Mar 2014 14:33:54 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
On 03/21/2014 04:12 AM, Chunyan Liu wrote:
> Add qemu_opt_get_del, qemu_opt_get_bool_del and qemu_opt_get_number_gel
s/gel/del/
Any reason you don't mention qemu_opt_get_size_del here?
> to replace the same handling of QEMUOptionParamter (get and delete).
s/Paramter/Parameter/
>
> get_*_del purpose:
>
> In specific driver (like "qcow2"), it only handles expected options, then
> delete them from option list. Leave the left options to be passed down
> to 2nd driver (like "raw") to do 2nd handling.
Awkward wording. I suggest replacing these two paragraphs with:
Several drivers are coded to parse a known subset of options, then
remove them for the list before handing all remaining options to a
second driver for further option processing. get_*_del makes it easier
to retrieve a known option (or its default) and remove it from the list
all in one action.
> +++ b/util/qemu-option.c
> @@ -588,6 +588,29 @@ const char *qemu_opt_get(QemuOpts *opts, const char
> *name)
> return opt ? opt->str : NULL;
> }
>
> +char *qemu_opt_get_del(QemuOpts *opts, const char *name)
It would help to add documentation to this function; particularly that
the caller must use g_free() on the result (in contrast to qemu_opt_get
where they must NOT use g_free).
> + str = g_strdup(opt->str);
We could play a game with transfer semantics for fewer mallocs, by
writing this as:
str = opt->str;
opt->str = NULL;
but not the end of the world if you keep it as-is.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v23 00/32] replace QEMUOptionParameter with QemuOpts, Chunyan Liu, 2014/03/21
- [Qemu-devel] [PATCH v23 02/32] add def_value_str to QemuOptDesc, Chunyan Liu, 2014/03/21
- [Qemu-devel] [PATCH v23 03/32] qapi: output def_value_str when query command line options, Chunyan Liu, 2014/03/21
- [Qemu-devel] [PATCH v23 01/32] move find_desc_by_name ahead for later calling, Chunyan Liu, 2014/03/21
- [Qemu-devel] [PATCH v23 06/32] add qemu_opt_get_*_del functions for replace work, Chunyan Liu, 2014/03/21
- Re: [Qemu-devel] [PATCH v23 06/32] add qemu_opt_get_*_del functions for replace work,
Eric Blake <=
- [Qemu-devel] [PATCH v23 05/32] move qemu_opt_del ahead for later calling, Chunyan Liu, 2014/03/21
- [Qemu-devel] [PATCH v23 07/32] add qemu_opts_print_help to replace print_option_help, Chunyan Liu, 2014/03/21
- [Qemu-devel] [PATCH v23 04/32] change opt->name and opt->str from (const char *) to (char *), Chunyan Liu, 2014/03/21
- [Qemu-devel] [PATCH v23 08/32] add convert functions between QEMUOptionParameter to QemuOpts, Chunyan Liu, 2014/03/21