From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCQTY-0006RP-Qr for qemu-devel@nongnu.org; Mon, 13 Jun 2016 07:56:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCQTS-0007sg-SD for qemu-devel@nongnu.org; Mon, 13 Jun 2016 07:56:15 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:36380) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCQTS-0007sb-KY for qemu-devel@nongnu.org; Mon, 13 Jun 2016 07:56:10 -0400 Received: by mail-wm0-x241.google.com with SMTP id m124so14249276wme.3 for ; Mon, 13 Jun 2016 04:56:10 -0700 (PDT) Sender: Paolo Bonzini References: <1463416475-11728-1-git-send-email-rjones@redhat.com> <1463416475-11728-2-git-send-email-rjones@redhat.com> From: Paolo Bonzini Message-ID: <7313404c-cad3-6e3d-1f0e-8d92b9d38e72@redhat.com> Date: Mon, 13 Jun 2016 13:55:59 +0200 MIME-Version: 1.0 In-Reply-To: <1463416475-11728-2-git-send-email-rjones@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3] vl.c: Add '-L help' which lists data dirs. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Richard W.M. Jones" Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org On 16/05/2016 18:34, Richard W.M. Jones wrote: > QEMU compiles a list of data directories from various sources. When > consuming a QEMU binary it's useful to be able to get this list of > data directories: a primary reason is so you can list what BIOSes or > keymaps ship with this version of QEMU. However without reproducing > the method that QEMU uses internally, it's not possible to get the > list of data directories. > > This commit adds a simple '-L help' option that just lists out the > data directories as qemu calculates them: > > $ ./x86_64-softmmu/qemu-system-x86_64 -L help > /home/rjones/d/qemu/pc-bios > /usr/local/share/qemu > > $ ./x86_64-softmmu/qemu-system-x86_64 -L /tmp -L help > /tmp > /home/rjones/d/qemu/pc-bios > /usr/local/share/qemu > > Signed-off-by: Richard W.M. Jones > Reviewed-by: Eric Blake > --- > qemu-options.hx | 2 ++ > vl.c | 13 ++++++++++++- > 2 files changed, 14 insertions(+), 1 deletion(-) > > diff --git a/qemu-options.hx b/qemu-options.hx > index 6106520..bec0210 100644 > --- a/qemu-options.hx > +++ b/qemu-options.hx > @@ -3199,6 +3199,8 @@ STEXI > @item -L @var{path} > @findex -L > Set the directory for the BIOS, VGA BIOS and keymaps. > + > +To list all the data directories, use @code{-L help}. > ETEXI > > DEF("bios", HAS_ARG, QEMU_OPTION_bios, \ > diff --git a/vl.c b/vl.c > index 5fd22cb..d25f2f7 100644 > --- a/vl.c > +++ b/vl.c > @@ -2990,6 +2990,7 @@ int main(int argc, char **argv, char **envp) > FILE *vmstate_dump_file = NULL; > Error *main_loop_err = NULL; > Error *err = NULL; > + bool list_data_dirs = false; > > qemu_init_cpu_loop(); > qemu_mutex_lock_iothread(); > @@ -3371,7 +3372,9 @@ int main(int argc, char **argv, char **envp) > add_device_config(DEV_GDB, optarg); > break; > case QEMU_OPTION_L: > - if (data_dir_idx < ARRAY_SIZE(data_dir)) { > + if (is_help_option(optarg)) { > + list_data_dirs = true; > + } else if (data_dir_idx < ARRAY_SIZE(data_dir)) { > data_dir[data_dir_idx++] = optarg; > } > break; > @@ -4128,6 +4131,14 @@ int main(int argc, char **argv, char **envp) > data_dir[data_dir_idx++] = CONFIG_QEMU_DATADIR; > } > > + /* -L help lists the data directories and exits. */ > + if (list_data_dirs) { > + for (i = 0; i < data_dir_idx; i++) { > + printf("%s\n", data_dir[i]); > + } > + exit(0); > + } > + > smp_parse(qemu_opts_find(qemu_find_opts("smp-opts"), NULL)); > > machine_class->max_cpus = machine_class->max_cpus ?: 1; /* Default to UP */ > Queued, thanks.