qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ryan Harper <ryanh@us.ibm.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3 of 3] Add -uuid command line flag
Date: Fri, 07 Dec 2007 14:45:54 -0600	[thread overview]
Message-ID: <5fe703a5a7bde701686f.1197060354@localhost.localdomain> (raw)
In-Reply-To: <patchbomb.1197060351@localhost.localdomain>

2 files changed, 29 insertions(+), 1 deletion(-)
smbios.c |   12 +++++++++++-
vl.c     |   18 ++++++++++++++++++


# HG changeset patch
# User Ryan Harper <ryanh@us.ibm.com>
# Date 1197058922 21600
# Node ID 5fe703a5a7bde701686fc333c17836b308c17b4f
# Parent  3470dd05f46cc9f14c3fc9561d06031a4bc0ce7a
Add -uuid command line flag

This patch allows users to specify a uuid.  If no uuid is specified, then one is
generated.

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>

diff -r 3470dd05f46c -r 5fe703a5a7bd smbios.c
--- a/smbios.c	Fri Dec 07 14:22:02 2007 -0600
+++ b/smbios.c	Fri Dec 07 14:22:02 2007 -0600
@@ -32,6 +32,7 @@
 
 #ifdef CONFIG_UUID
 #include <uuid/uuid.h>
+extern const char *qemu_uuid;
 #endif
 
 CPUState *first_cpu;
@@ -497,7 +498,16 @@ load_smbios_tables(uint8_t *entry, uint8
 #ifdef CONFIG_UUID
     uuid_t uuid;
 
-    uuid_generate(uuid);
+    /* parse user-specified uuid if present */
+    if (qemu_uuid != NULL) {
+        if (uuid_parse(qemu_uuid, uuid) < 0) {
+            fprintf(stderr, "SMBIOS: Could not parse user UUID"
+                            "string, check format.\n");
+            return -1;
+        }
+    } else {
+        uuid_generate(uuid);
+    }
 #else
     uint8_t uuid[16] = "QEMUQEMUQEMUQEMU";
 #endif
diff -r 3470dd05f46c -r 5fe703a5a7bd vl.c
--- a/vl.c	Fri Dec 07 14:22:02 2007 -0600
+++ b/vl.c	Fri Dec 07 14:22:02 2007 -0600
@@ -137,6 +137,9 @@ int inet_aton(const char *cp, struct in_
 #define SMBD_COMMAND "/usr/sfw/sbin/smbd"
 #else
 #define SMBD_COMMAND "/usr/sbin/smbd"
+#endif
+#ifdef CONFIG_UUID
+const char *qemu_uuid;
 #endif
 
 //#define DEBUG_UNUSED_IOPORT
@@ -7545,6 +7548,10 @@ static void help(int exitcode)
            "-no-reboot      exit instead of rebooting\n"
            "-loadvm file    start right away with a saved state (loadvm in monitor)\n"
 	   "-vnc display    start a VNC server on display\n"
+#ifdef CONFIG_UUID
+           "-uuid %%08x-%%04x-%%04x-%%04x-%%012x\n"
+           "                specify machine UUID\n"
+#endif
 #ifndef _WIN32
 	   "-daemonize      daemonize QEMU after initializing\n"
 #endif
@@ -7647,6 +7654,9 @@ enum {
     QEMU_OPTION_vnc,
     QEMU_OPTION_no_acpi,
     QEMU_OPTION_no_reboot,
+#ifdef CONFIG_UUID
+    QEMU_OPTION_uuid,
+#endif
     QEMU_OPTION_show_cursor,
     QEMU_OPTION_daemonize,
     QEMU_OPTION_option_rom,
@@ -7742,6 +7752,9 @@ const QEMUOption qemu_options[] = {
     { "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
     { "smp", HAS_ARG, QEMU_OPTION_smp },
     { "vnc", HAS_ARG, QEMU_OPTION_vnc },
+#ifdef CONFIG_UUID
+    { "uuid", HAS_ARG, QEMU_OPTION_uuid },
+#endif
 
     /* temporary options */
     { "usb", 0, QEMU_OPTION_usb },
@@ -8527,6 +8540,11 @@ int main(int argc, char **argv)
 	    case QEMU_OPTION_daemonize:
 		daemonize = 1;
 		break;
+#ifdef CONFIG_UUID
+            case QEMU_OPTION_uuid:
+                qemu_uuid = optarg;
+                break;
+#endif
 	    case QEMU_OPTION_option_rom:
 		if (nb_option_roms >= MAX_OPTION_ROMS) {
 		    fprintf(stderr, "Too many option ROMs\n");

  parent reply	other threads:[~2007-12-07 20:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-07 20:45 [Qemu-devel] [PATCH 0 of 3] Add SMBIOS/DMI table generation to PC machine Ryan Harper
2007-12-07 20:45 ` [Qemu-devel] [PATCH 1 of 3] export SMBIOS/DMI tables to PC machines Ryan Harper
2007-12-07 20:45 ` [Qemu-devel] [PATCH 2 of 3] Optionally link against libuuid if present Ryan Harper
2007-12-07 20:45 ` Ryan Harper [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-12-11 20:08 [Qemu-devel] [PATCH 0 of 3] Add SMBIOS/DMI table generation to PC machine Ryan Harper
2007-12-11 20:08 ` [Qemu-devel] [PATCH 3 of 3] Add -uuid command line flag Ryan Harper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5fe703a5a7bde701686f.1197060354@localhost.localdomain \
    --to=ryanh@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).