qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 2/3]: Add -uuid option to Qemu
@ 2008-07-28 13:25 Chris Lalancette
  2008-08-05 13:43 ` Gerd Hoffmann
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Lalancette @ 2008-07-28 13:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: gleb

[-- Attachment #1: Type: text/plain, Size: 353 bytes --]

As suggested by Anthony, this patch and the next one were split apart.  This
patch just adds the basic plumbing to qemu to be able to set the uuid on the
command-line, and retrieve the information via "info uuid".

Signed-off-by: Chris Lalancette <clalance@redhat.com>
Cc: Gleb Natapov <gleb@qumranet.com>
Cc: Anthony Liguori <anthony@codemonkey.ws>




[-- Attachment #2: qemu-dmi-uuid-2.patch --]
[-- Type: text/x-patch, Size: 5263 bytes --]

diff -urp qemu.patch1/configure qemu.patch2/configure
--- qemu.patch1/configure	2008-07-28 14:14:32.000000000 +0200
+++ qemu.patch2/configure	2008-07-28 14:18:47.000000000 +0200
@@ -108,6 +108,7 @@ uname_release=""
 curses="yes"
 nptl="yes"
 mixemu="no"
+uuid="yes"
 
 # OS specific
 targetos=`uname -s`
@@ -271,6 +272,8 @@ for opt do
   ;;
   --fmod-inc=*) fmod_inc="$optarg"
   ;;
+  --disable-uuid) uuid="no"
+  ;;
   --audio-card-list=*) audio_card_list="$optarg"
   ;;
   --audio-drv-list=*) audio_drv_list="$optarg"
@@ -433,6 +436,7 @@ echo "  --enable-darwin-user     enable 
 echo "  --disable-darwin-user    disable all darwin usermode emulation targets"
 echo "  --fmod-lib               path to FMOD library"
 echo "  --fmod-inc               path to FMOD includes"
+echo "  --disable-uuid           disable UUID support"
 echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
 echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
 echo "  --disable-vde            disable support for vde network"
@@ -851,6 +855,19 @@ EOF
   fi
 fi # test "$curses"
 
+##########################################
+# uuid library
+if test "$uuid" = "yes" ; then
+  uuid=no
+  cat > $TMPC << EOF
+#include <uuid/uuid.h>
+int main(void) { uuid_t u; return 0; }
+EOF
+  if $cc $ARCH_CFLAGS -o $TMPE $TMPC -luuid 2> /dev/null ; then
+      uuid=yes
+  fi
+fi # test "$uuid"
+
 # Check if tools are available to build documentation.
 if [ -x "`which texi2html 2>/dev/null`" ] && \
    [ -x "`which pod2man 2>/dev/null`" ]; then
@@ -922,6 +939,7 @@ echo "Documentation     $build_docs"
 echo "uname -r          $uname_release"
 echo "NPTL support      $nptl"
 echo "vde support       $vde"
+echo "UUID Support      $uuid"
 
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -1122,6 +1140,10 @@ if test "$vnc_tls" = "yes" ; then
   echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
   echo "#define CONFIG_VNC_TLS 1" >> $config_h
 fi
+if test "$uuid" = "yes" ; then
+  echo "CONFIG_UUID=yes" >> $config_mak
+  echo "#define CONFIG_UUID 1" >> $config_h
+fi
 qemu_version=`head $source_path/VERSION`
 echo "VERSION=$qemu_version" >>$config_mak
 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
diff -urp qemu.patch1/Makefile.target qemu.patch2/Makefile.target
--- qemu.patch1/Makefile.target	2008-07-28 14:14:32.000000000 +0200
+++ qemu.patch2/Makefile.target	2008-07-28 14:18:47.000000000 +0200
@@ -515,6 +515,10 @@ CPPFLAGS += $(CONFIG_VNC_TLS_CFLAGS)
 LIBS += $(CONFIG_VNC_TLS_LIBS)
 endif
 
+ifdef CONFIG_UUID
+LIBS += -luuid
+endif
+
 # SCSI layer
 OBJS+= lsi53c895a.o esp.o
 
diff -urp qemu.patch1/monitor.c qemu.patch2/monitor.c
--- qemu.patch1/monitor.c	2008-07-28 12:11:23.000000000 +0200
+++ qemu.patch2/monitor.c	2008-07-28 15:08:56.000000000 +0200
@@ -1363,6 +1363,20 @@ static void do_inject_nmi(int cpu_index)
 }
 #endif
 
+static void do_info_uuid(void)
+{
+    extern char *qemu_uuid;
+#ifdef CONFIG_UUID
+    term_printf("uuid: ");
+    if (qemu_uuid == NULL)
+        term_printf("Not set\n");
+    else
+        term_printf("%s\n", qemu_uuid);
+#else
+    term_printf("uuid support: not compiled\n");
+#endif
+}
+
 static term_cmd_t term_cmds[] = {
     { "help|?", "s?", do_help,
       "[cmd]", "show the help" },
@@ -1502,6 +1516,7 @@ static term_cmd_t info_cmds[] = {
     { "slirp", "", do_info_slirp,
       "", "show SLIRP statistics", },
 #endif
+    { "uuid", "", do_info_uuid, "", "show UUID information" },
     { NULL, NULL, },
 };
 
diff -urp qemu.patch1/vl.c qemu.patch2/vl.c
--- qemu.patch1/vl.c	2008-07-28 14:14:32.000000000 +0200
+++ qemu.patch2/vl.c	2008-07-28 14:18:47.000000000 +0200
@@ -252,6 +252,8 @@ static int64_t qemu_icount_bias;
 QEMUTimer *icount_rt_timer;
 QEMUTimer *icount_vm_timer;
 
+const char *qemu_uuid;
+
 #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
 
 /***********************************************************/
@@ -7574,6 +7576,10 @@ static void help(int exitcode)
            "-no-shutdown    stop before shutdown\n"
            "-loadvm [tag|id]  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-%%012x\n"
+	   "                specify machine UUID\n"
+#endif
 #ifndef _WIN32
 	   "-daemonize      daemonize QEMU after initializing\n"
 #endif
@@ -7690,6 +7696,7 @@ enum {
     QEMU_OPTION_clock,
     QEMU_OPTION_startdate,
     QEMU_OPTION_tb_size,
+    QEMU_OPTION_uuid,
     QEMU_OPTION_icount,
 };
 
@@ -7779,6 +7786,9 @@ const QEMUOption qemu_options[] = {
 #ifdef CONFIG_CURSES
     { "curses", 0, QEMU_OPTION_curses },
 #endif
+#ifdef CONFIG_UUID
+    { "uuid", HAS_ARG, QEMU_OPTION_uuid },
+#endif
 
     /* temporary options */
     { "usb", 0, QEMU_OPTION_usb },
@@ -8553,6 +8563,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");


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-08-05 14:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-28 13:25 [Qemu-devel] [PATCH 2/3]: Add -uuid option to Qemu Chris Lalancette
2008-08-05 13:43 ` Gerd Hoffmann
2008-08-05 13:53   ` Gleb Natapov
2008-08-05 14:36     ` Andreas Färber
2008-08-05 13:53   ` Chris Lalancette
2008-08-05 14:32     ` Gerd Hoffmann

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).