[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/12] Rework --name to use QemuOpts
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 06/12] Rework --name to use QemuOpts |
Date: |
Tue, 4 Mar 2014 15:03:17 +0200 |
From: "Dr. David Alan Gilbert" <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Acked-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Laszlo Ersek <address@hidden>
---
vl.c | 52 +++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 39 insertions(+), 13 deletions(-)
diff --git a/vl.c b/vl.c
index a7b00cd..5026e7a 100644
--- a/vl.c
+++ b/vl.c
@@ -532,6 +532,27 @@ static QemuOptsList qemu_msg_opts = {
},
};
+static QemuOptsList qemu_name_opts = {
+ .name = "name",
+ .implied_opt_name = "guest",
+ .merge_lists = true,
+ .head = QTAILQ_HEAD_INITIALIZER(qemu_name_opts.head),
+ .desc = {
+ {
+ .name = "guest",
+ .type = QEMU_OPT_STRING,
+ .help = "Sets the name of the guest.\n"
+ "This name will be displayed in the SDL window caption.\n"
+ "The name will also be used for the VNC server",
+ }, {
+ .name = "process",
+ .type = QEMU_OPT_STRING,
+ .help = "Sets the name of the QEMU process, as shown in top etc",
+ },
+ { /* End of list */ }
+ },
+};
+
/**
* Get machine options
*
@@ -982,6 +1003,18 @@ static int parse_sandbox(QemuOpts *opts, void *opaque)
return 0;
}
+static void parse_name(QemuOpts *opts)
+{
+ const char *proc_name;
+
+ qemu_name = qemu_opt_get(opts, "guest");
+
+ proc_name = qemu_opt_get(opts, "process");
+ if (proc_name) {
+ os_set_proc_name(proc_name);
+ }
+}
+
bool usb_enabled(bool default_usb)
{
return qemu_opt_get_bool(qemu_get_machine_opts(), "usb", default_usb);
@@ -2915,6 +2948,7 @@ int main(int argc, char **argv, char **envp)
qemu_add_opts(&qemu_tpmdev_opts);
qemu_add_opts(&qemu_realtime_opts);
qemu_add_opts(&qemu_msg_opts);
+ qemu_add_opts(&qemu_name_opts);
runstate_init();
@@ -3650,19 +3684,11 @@ int main(int argc, char **argv, char **envp)
"is no longer supported.\n");
break;
case QEMU_OPTION_name:
- qemu_name = g_strdup(optarg);
- {
- char *p = strchr(qemu_name, ',');
- if (p != NULL) {
- *p++ = 0;
- if (strncmp(p, "process=", 8)) {
- fprintf(stderr, "Unknown subargument %s to
-name\n", p);
- exit(1);
- }
- p += 8;
- os_set_proc_name(p);
- }
- }
+ opts = qemu_opts_parse(qemu_find_opts("name"), optarg, 1);
+ if (!opts) {
+ exit(1);
+ }
+ parse_name(opts);
break;
case QEMU_OPTION_prom_env:
if (nb_prom_envs >= MAX_PROM_ENVS) {
--
MST
- [Qemu-devel] [PULL 04/12] memory_region_present: return false if address is not found in child MemoryRegion, (continued)
- [Qemu-devel] [PULL 04/12] memory_region_present: return false if address is not found in child MemoryRegion, Michael S. Tsirkin, 2014/03/04
- [Qemu-devel] [PULL 03/12] virtio-net: remove function calls from assert, Michael S. Tsirkin, 2014/03/04
- [Qemu-devel] [PULL 07/12] Add 'debug-threads' suboption to --name, Michael S. Tsirkin, 2014/03/04
- [Qemu-devel] [PULL 08/12] Add a 'name' parameter to qemu_thread_create, Michael S. Tsirkin, 2014/03/04
- [Qemu-devel] [PULL 09/12] MAINTAINERS: drop an out of date address, Michael S. Tsirkin, 2014/03/04
- [Qemu-devel] [PULL 05/12] PCIE: fix regression with coldplugged multifunction device, Michael S. Tsirkin, 2014/03/04
- [Qemu-devel] [PULL 10/12] acpi-build: partially revert dac1e93093f9306c114f410785c99aa5261539b4, Michael S. Tsirkin, 2014/03/04
- [Qemu-devel] [PULL 11/12] acpi-test: retain both asl and aml files on failure, Michael S. Tsirkin, 2014/03/04
- [Qemu-devel] [PULL 06/12] Rework --name to use QemuOpts,
Michael S. Tsirkin <=
- Re: [Qemu-devel] [PULL 00/12] acpi,pc,pci,virtio,memory bug fixes, Peter Maydell, 2014/03/04
- [Qemu-devel] [PULL 12/12] acpi-test: issue errors instead of warnings when possible, Michael S. Tsirkin, 2014/03/04
- Re: [Qemu-devel] [PULL 00/12] acpi,pc,pci,virtio,memory bug fixes, Michael S. Tsirkin, 2014/03/06