[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 16/30] vl.c: Add '-L help' which lists data dirs.
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 16/30] vl.c: Add '-L help' which lists data dirs. |
Date: |
Thu, 16 Jun 2016 16:16:11 +0200 |
From: "Richard W.M. Jones" <address@hidden>
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 <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
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 0e42ba5..17f15ad 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -3214,6 +3214,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 b0bcc25..99c3030 100644
--- a/vl.c
+++ b/vl.c
@@ -2973,6 +2973,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();
@@ -3359,7 +3360,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;
@@ -4091,6 +4094,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 */
--
2.5.5
- [Qemu-devel] [PULL 05/30] Makefile: Fix tag file generation targets, (continued)
- [Qemu-devel] [PULL 05/30] Makefile: Fix tag file generation targets, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 08/30] configure: Remove unused CONFIG_SIGEV_THREAD_ID switch, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 09/30] nbd: Don't use *_to_cpup() functions, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 03/30] clean-includes: run it once more, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 10/30] nbd: Don't use cpu_to_*w() functions, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 06/30] Make avx2 configure test work with -O2, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 12/30] target-i386: kvm: cache KVM_GET_SUPPORTED_CPUID data, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 14/30] linux-headers: update to Linux 4.6, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 13/30] scsi-disk: Use (unsigned long) typecasts when using "%lu" format string, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 11/30] nbd: simplify the nbd_request and nbd_reply structs, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 16/30] vl.c: Add '-L help' which lists data dirs.,
Paolo Bonzini <=
- [Qemu-devel] [PULL 15/30] KVM: use KVM_CAP_MAX_VCPU_ID, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 17/30] nbd: Use BDRV_REQ_FUA for better FUA where supported, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 21/30] nbd: Reject unknown request flags, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 20/30] nbd: Improve server handling of bogus commands, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 18/30] nbd: More debug typo fixes, use correct formats, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 19/30] nbd: Quit server after any write error, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 23/30] nbd: Clean up ioctl handling of qemu-nbd -c, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 22/30] nbd: Group all Linux-specific ioctl code in one place, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 26/30] scsi: esp: check buffer length before reading scsi command, Paolo Bonzini, 2016/06/16
- [Qemu-devel] [PULL 25/30] nbd: Avoid magic number for NBD max name size, Paolo Bonzini, 2016/06/16