Re: [Qemu-block] [PATCH v8 03/12] vhdx: Use QEMU UUID API

2016-09-18 Thread Jeff Cody
On Sun, Sep 18, 2016 at 12:25:23PM +0800, Fam Zheng wrote:
> This removes our dependency to libuuid, so that the driver can always be
> built.
> 
> Similar to how we handled data plane configure options, --enable-vhdx
> and --disable-vhdx are also changed to a nop with a message saying it's
> obsolete.
> 
> Signed-off-by: Fam Zheng 
> Reviewed-by: Eric Blake 
> ---
>  block/Makefile.objs |  2 +-
>  block/vhdx-endian.c |  3 ---
>  block/vhdx.c|  9 -
>  configure   | 27 +++
>  4 files changed, 8 insertions(+), 33 deletions(-)
> 
> diff --git a/block/Makefile.objs b/block/Makefile.objs
> index 55da626..f23ee18 100644
> --- a/block/Makefile.objs
> +++ b/block/Makefile.objs
> @@ -2,7 +2,7 @@ block-obj-y += raw_bsd.o qcow.o vdi.o vmdk.o cloop.o bochs.o 
> vpc.o vvfat.o
>  block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o 
> qcow2-cache.o
>  block-obj-y += qed.o qed-gencb.o qed-l2-cache.o qed-table.o qed-cluster.o
>  block-obj-y += qed-check.o
> -block-obj-$(CONFIG_VHDX) += vhdx.o vhdx-endian.o vhdx-log.o
> +block-obj-y += vhdx.o vhdx-endian.o vhdx-log.o
>  block-obj-y += quorum.o
>  block-obj-y += parallels.o blkdebug.o blkverify.o blkreplay.o
>  block-obj-y += block-backend.o snapshot.o qapi.o
> diff --git a/block/vhdx-endian.c b/block/vhdx-endian.c
> index c306b90..429d755 100644
> --- a/block/vhdx-endian.c
> +++ b/block/vhdx-endian.c
> @@ -21,9 +21,6 @@
>  #include "qemu/bswap.h"
>  #include "block/vhdx.h"
>  
> -#include 
> -
> -
>  /*
>   * All the VHDX formats on disk are little endian - the following
>   * are helper import/export functions to correctly convert
> diff --git a/block/vhdx.c b/block/vhdx.c
> index 75ef2b1..0ba2f0a 100644
> --- a/block/vhdx.c
> +++ b/block/vhdx.c
> @@ -25,8 +25,7 @@
>  #include "qemu/bswap.h"
>  #include "block/vhdx.h"
>  #include "migration/migration.h"
> -
> -#include 
> +#include "qemu/uuid.h"
>  
>  /* Options for VHDX creation */
>  
> @@ -213,11 +212,11 @@ bool vhdx_checksum_is_valid(uint8_t *buf, size_t size, 
> int crc_offset)
>   */
>  void vhdx_guid_generate(MSGUID *guid)
>  {
> -uuid_t uuid;
> +QemuUUID uuid;
>  assert(guid != NULL);
>  
> -uuid_generate(uuid);
> -memcpy(guid, uuid, sizeof(MSGUID));
> +qemu_uuid_generate(&uuid);
> +memcpy(guid, &uuid, sizeof(MSGUID));
>  }
>  
>  /* Check for region overlaps inside the VHDX image */
> diff --git a/configure b/configure
> index 7d083bd..b71b80a 100755
> --- a/configure
> +++ b/configure
> @@ -317,7 +317,6 @@ vte=""
>  virglrenderer=""
>  tpm="yes"
>  libssh2=""
> -vhdx=""
>  numa=""
>  tcmalloc="no"
>  jemalloc="no"
> @@ -1103,6 +1102,9 @@ for opt do
>--disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
>echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
>;;
> +  --enable-vhdx|--disable-vhdx)
> +  echo "$0: $opt is obsolete, VHDX driver is always built" >&2
> +  ;;
>--disable-gtk) gtk="no"
>;;
>--enable-gtk) gtk="yes"
> @@ -1143,10 +1145,6 @@ for opt do
>;;
>--enable-libssh2) libssh2="yes"
>;;
> -  --enable-vhdx) vhdx="yes"
> -  ;;
> -  --disable-vhdx) vhdx="no"
> -  ;;
>--disable-numa) numa="no"
>;;
>--enable-numa) numa="yes"
> @@ -1389,7 +1387,6 @@ disabled with --disable-FEATURE, default is enabled if 
> available:
>archipelago Archipelago backend
>tpm TPM support
>libssh2 ssh block device support
> -  vhdxsupport for the Microsoft VHDX image format
>numalibnuma support
>tcmalloctcmalloc support
>jemallocjemalloc support
> @@ -2690,19 +2687,6 @@ EOF
>fi
>  fi
>  
> -if test "$vhdx" = "yes" ; then
> -if test "$uuid" = "no" ; then
> -error_exit "uuid required for VHDX support"
> -fi
> -elif test "$vhdx" != "no" ; then
> -if test "$uuid" = "yes" ; then
> -vhdx=yes
> -else
> -vhdx=no
> -fi
> -fi
> -
> -##
>  # xfsctl() probe, used for raw-posix
>  if test "$xfs" != "no" ; then
>cat > $TMPC << EOF
> @@ -4918,7 +4902,6 @@ echo "TPM support   $tpm"
>  echo "libssh2 support   $libssh2"
>  echo "TPM passthrough   $tpm_passthrough"
>  echo "QOM debugging $qom_cast_debug"
> -echo "vhdx  $vhdx"
>  echo "lzo support   $lzo"
>  echo "snappy support$snappy"
>  echo "bzip2 support $bzip2"
> @@ -5443,10 +5426,6 @@ if test "$libssh2" = "yes" ; then
>echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
>  fi
>  
> -if test "$vhdx" = "yes" ; then
> -  echo "CONFIG_VHDX=y" >> $config_host_mak
> -fi
> -
>  # USB host support
>  if test "$libusb" = "yes"; then
>echo "HOST_USB=libusb legacy" >> $config_host_mak
> -- 
> 2.7.4
> 

Reviewed-by: Jeff Cody 



[Qemu-block] [PATCH v8 03/12] vhdx: Use QEMU UUID API

2016-09-17 Thread Fam Zheng
This removes our dependency to libuuid, so that the driver can always be
built.

Similar to how we handled data plane configure options, --enable-vhdx
and --disable-vhdx are also changed to a nop with a message saying it's
obsolete.

Signed-off-by: Fam Zheng 
Reviewed-by: Eric Blake 
---
 block/Makefile.objs |  2 +-
 block/vhdx-endian.c |  3 ---
 block/vhdx.c|  9 -
 configure   | 27 +++
 4 files changed, 8 insertions(+), 33 deletions(-)

diff --git a/block/Makefile.objs b/block/Makefile.objs
index 55da626..f23ee18 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -2,7 +2,7 @@ block-obj-y += raw_bsd.o qcow.o vdi.o vmdk.o cloop.o bochs.o 
vpc.o vvfat.o
 block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o 
qcow2-cache.o
 block-obj-y += qed.o qed-gencb.o qed-l2-cache.o qed-table.o qed-cluster.o
 block-obj-y += qed-check.o
-block-obj-$(CONFIG_VHDX) += vhdx.o vhdx-endian.o vhdx-log.o
+block-obj-y += vhdx.o vhdx-endian.o vhdx-log.o
 block-obj-y += quorum.o
 block-obj-y += parallels.o blkdebug.o blkverify.o blkreplay.o
 block-obj-y += block-backend.o snapshot.o qapi.o
diff --git a/block/vhdx-endian.c b/block/vhdx-endian.c
index c306b90..429d755 100644
--- a/block/vhdx-endian.c
+++ b/block/vhdx-endian.c
@@ -21,9 +21,6 @@
 #include "qemu/bswap.h"
 #include "block/vhdx.h"
 
-#include 
-
-
 /*
  * All the VHDX formats on disk are little endian - the following
  * are helper import/export functions to correctly convert
diff --git a/block/vhdx.c b/block/vhdx.c
index 75ef2b1..0ba2f0a 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -25,8 +25,7 @@
 #include "qemu/bswap.h"
 #include "block/vhdx.h"
 #include "migration/migration.h"
-
-#include 
+#include "qemu/uuid.h"
 
 /* Options for VHDX creation */
 
@@ -213,11 +212,11 @@ bool vhdx_checksum_is_valid(uint8_t *buf, size_t size, 
int crc_offset)
  */
 void vhdx_guid_generate(MSGUID *guid)
 {
-uuid_t uuid;
+QemuUUID uuid;
 assert(guid != NULL);
 
-uuid_generate(uuid);
-memcpy(guid, uuid, sizeof(MSGUID));
+qemu_uuid_generate(&uuid);
+memcpy(guid, &uuid, sizeof(MSGUID));
 }
 
 /* Check for region overlaps inside the VHDX image */
diff --git a/configure b/configure
index 7d083bd..b71b80a 100755
--- a/configure
+++ b/configure
@@ -317,7 +317,6 @@ vte=""
 virglrenderer=""
 tpm="yes"
 libssh2=""
-vhdx=""
 numa=""
 tcmalloc="no"
 jemalloc="no"
@@ -1103,6 +1102,9 @@ for opt do
   --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
   echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
   ;;
+  --enable-vhdx|--disable-vhdx)
+  echo "$0: $opt is obsolete, VHDX driver is always built" >&2
+  ;;
   --disable-gtk) gtk="no"
   ;;
   --enable-gtk) gtk="yes"
@@ -1143,10 +1145,6 @@ for opt do
   ;;
   --enable-libssh2) libssh2="yes"
   ;;
-  --enable-vhdx) vhdx="yes"
-  ;;
-  --disable-vhdx) vhdx="no"
-  ;;
   --disable-numa) numa="no"
   ;;
   --enable-numa) numa="yes"
@@ -1389,7 +1387,6 @@ disabled with --disable-FEATURE, default is enabled if 
available:
   archipelago Archipelago backend
   tpm TPM support
   libssh2 ssh block device support
-  vhdxsupport for the Microsoft VHDX image format
   numalibnuma support
   tcmalloctcmalloc support
   jemallocjemalloc support
@@ -2690,19 +2687,6 @@ EOF
   fi
 fi
 
-if test "$vhdx" = "yes" ; then
-if test "$uuid" = "no" ; then
-error_exit "uuid required for VHDX support"
-fi
-elif test "$vhdx" != "no" ; then
-if test "$uuid" = "yes" ; then
-vhdx=yes
-else
-vhdx=no
-fi
-fi
-
-##
 # xfsctl() probe, used for raw-posix
 if test "$xfs" != "no" ; then
   cat > $TMPC << EOF
@@ -4918,7 +4902,6 @@ echo "TPM support   $tpm"
 echo "libssh2 support   $libssh2"
 echo "TPM passthrough   $tpm_passthrough"
 echo "QOM debugging $qom_cast_debug"
-echo "vhdx  $vhdx"
 echo "lzo support   $lzo"
 echo "snappy support$snappy"
 echo "bzip2 support $bzip2"
@@ -5443,10 +5426,6 @@ if test "$libssh2" = "yes" ; then
   echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
 fi
 
-if test "$vhdx" = "yes" ; then
-  echo "CONFIG_VHDX=y" >> $config_host_mak
-fi
-
 # USB host support
 if test "$libusb" = "yes"; then
   echo "HOST_USB=libusb legacy" >> $config_host_mak
-- 
2.7.4