[libvirt] [PATCH 2/4] QED: Basic support for QED images

2010-11-22 Thread Adam Litke
Add an entry in fileTypeInfo for QED image files.

Signed-off-by: Adam Litke a...@us.ibm.com
Acked-by: Eric Blake ebl...@redhat.com
Cc: Stefan Hajnoczi stefan.hajno...@uk.ibm.com
Cc: Anthony Liguori aligu...@linux.vnet.ibm.com
---
 src/util/storage_file.c |   10 +-
 src/util/storage_file.h |1 +
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/util/storage_file.c b/src/util/storage_file.c
index f8ab168..89c2cbe 100644
--- a/src/util/storage_file.c
+++ b/src/util/storage_file.c
@@ -43,7 +43,7 @@ VIR_ENUM_IMPL(virStorageFileFormat,
   VIR_STORAGE_FILE_LAST,
   raw, dir, bochs,
   cloop, cow, dmg, iso,
-  qcow, qcow2, vmdk, vpc)
+  qcow, qcow2, qed, vmdk, vpc)
 
 enum lv_endian {
 LV_LITTLE_ENDIAN = 1, /* 1234 */
@@ -104,6 +104,8 @@ static int vmdk4GetBackingStore(char **, int *,
 #define QCOW2_HDR_EXTENSION_END 0
 #define QCOW2_HDR_EXTENSION_BACKING_FORMAT 0xE2792ACA
 
+#define QED_HDR_IMAGE_SIZE (4+4+4+4+8+8+8)
+
 /* VMDK needs at least this to find backing store,
  * other formats need less */
 #define STORAGE_MAX_HEAD (20*512)
@@ -151,6 +153,12 @@ static struct FileTypeInfo const fileTypeInfo[] = {
 LV_BIG_ENDIAN, 4, 2,
 QCOWX_HDR_IMAGE_SIZE, 8, 1, QCOW2_HDR_CRYPT, qcow2GetBackingStore,
 },
+[VIR_STORAGE_FILE_QED] = {
+/* http://wiki.qemu.org/Features/QED */
+QED\0, NULL,
+LV_LITTLE_ENDIAN, -1, -1,
+QED_HDR_IMAGE_SIZE, 8, 1, -1, NULL,
+},
 [VIR_STORAGE_FILE_VMDK] = {
 KDMV, NULL,
 LV_LITTLE_ENDIAN, 4, 1,
diff --git a/src/util/storage_file.h b/src/util/storage_file.h
index a3703f5..c4d4650 100644
--- a/src/util/storage_file.h
+++ b/src/util/storage_file.h
@@ -38,6 +38,7 @@ enum virStorageFileFormat {
 VIR_STORAGE_FILE_ISO,
 VIR_STORAGE_FILE_QCOW,
 VIR_STORAGE_FILE_QCOW2,
+VIR_STORAGE_FILE_QED,
 VIR_STORAGE_FILE_VMDK,
 VIR_STORAGE_FILE_VPC,
 VIR_STORAGE_FILE_LAST,
-- 
1.7.3.2.164.g6f10c

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 2/4] QED: Basic support for QED images

2010-11-19 Thread Adam Litke
Add an entry in fileTypeInfo for QED image files.

Signed-off-by: Adam Litke a...@us.ibm.com
Cc: Stefan Hajnoczi stefan.hajno...@uk.ibm.com
Cc: Anthony Liguori aligu...@linux.vnet.ibm.com
---
 src/util/storage_file.c |9 -
 src/util/storage_file.h |1 +
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/util/storage_file.c b/src/util/storage_file.c
index f8ab168..27aad26 100644
--- a/src/util/storage_file.c
+++ b/src/util/storage_file.c
@@ -43,7 +43,7 @@ VIR_ENUM_IMPL(virStorageFileFormat,
   VIR_STORAGE_FILE_LAST,
   raw, dir, bochs,
   cloop, cow, dmg, iso,
-  qcow, qcow2, vmdk, vpc)
+  qcow, qcow2, qed, vmdk, vpc)
 
 enum lv_endian {
 LV_LITTLE_ENDIAN = 1, /* 1234 */
@@ -104,6 +104,8 @@ static int vmdk4GetBackingStore(char **, int *,
 #define QCOW2_HDR_EXTENSION_END 0
 #define QCOW2_HDR_EXTENSION_BACKING_FORMAT 0xE2792ACA
 
+#define QED_HDR_IMAGE_SIZE 40
+
 /* VMDK needs at least this to find backing store,
  * other formats need less */
 #define STORAGE_MAX_HEAD (20*512)
@@ -151,6 +153,11 @@ static struct FileTypeInfo const fileTypeInfo[] = {
 LV_BIG_ENDIAN, 4, 2,
 QCOWX_HDR_IMAGE_SIZE, 8, 1, QCOW2_HDR_CRYPT, qcow2GetBackingStore,
 },
+[VIR_STORAGE_FILE_QED] = {
+QED\0, NULL,
+LV_LITTLE_ENDIAN, -1, -1,
+QED_HDR_IMAGE_SIZE, 8, 1, -1, NULL,
+},
 [VIR_STORAGE_FILE_VMDK] = {
 KDMV, NULL,
 LV_LITTLE_ENDIAN, 4, 1,
diff --git a/src/util/storage_file.h b/src/util/storage_file.h
index a3703f5..c4d4650 100644
--- a/src/util/storage_file.h
+++ b/src/util/storage_file.h
@@ -38,6 +38,7 @@ enum virStorageFileFormat {
 VIR_STORAGE_FILE_ISO,
 VIR_STORAGE_FILE_QCOW,
 VIR_STORAGE_FILE_QCOW2,
+VIR_STORAGE_FILE_QED,
 VIR_STORAGE_FILE_VMDK,
 VIR_STORAGE_FILE_VPC,
 VIR_STORAGE_FILE_LAST,
-- 
1.7.3.2.164.g6f10c

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 2/4] QED: Basic support for QED images

2010-11-19 Thread Eric Blake
On 11/19/2010 09:18 AM, Adam Litke wrote:
 Add an entry in fileTypeInfo for QED image files.
 
 Signed-off-by: Adam Litke a...@us.ibm.com
 Cc: Stefan Hajnoczi stefan.hajno...@uk.ibm.com
 Cc: Anthony Liguori aligu...@linux.vnet.ibm.com
 ---
  src/util/storage_file.c |9 -
  src/util/storage_file.h |1 +
  2 files changed, 9 insertions(+), 1 deletions(-)
 

  
 +#define QED_HDR_IMAGE_SIZE 40

Given that other formats broke it out by fields, I did likewise for this
one.

 +
  /* VMDK needs at least this to find backing store,
   * other formats need less */
  #define STORAGE_MAX_HEAD (20*512)
 @@ -151,6 +153,11 @@ static struct FileTypeInfo const fileTypeInfo[] = {
  LV_BIG_ENDIAN, 4, 2,
  QCOWX_HDR_IMAGE_SIZE, 8, 1, QCOW2_HDR_CRYPT, qcow2GetBackingStore,
  },
 +[VIR_STORAGE_FILE_QED] = {

I'm amending this patch to add a comment to a decent reference URL
(other file types should probably likewise add a reference URL, but that
can come later).

 +QED\0, NULL,
 +LV_LITTLE_ENDIAN, -1, -1,
 +QED_HDR_IMAGE_SIZE, 8, 1, -1, NULL,

Why no backing store extraction function?  Not a show-stopper to this
patch, but something to consider adding.

ACK as amended:

diff --git i/src/util/storage_file.c w/src/util/storage_file.c
index 5fe11a3..c011544 100644
--- i/src/util/storage_file.c
+++ w/src/util/storage_file.c
@@ -105,7 +105,7 @@ static int vmdk4GetBackingStore(char **, int *,
 #define QCOW2_HDR_EXTENSION_END 0
 #define QCOW2_HDR_EXTENSION_BACKING_FORMAT 0xE2792ACA

-#define QED_HDR_IMAGE_SIZE 40
+#define QED_HDR_IMAGE_SIZE (4+4+4+4+8+8+8)

 /* VMDK needs at least this to find backing store,
  * other formats need less */
@@ -155,6 +155,7 @@ static struct FileTypeInfo const fileTypeInfo[] = {
 QCOWX_HDR_IMAGE_SIZE, 8, 1, QCOW2_HDR_CRYPT, qcow2GetBackingStore,
 },
 [VIR_STORAGE_FILE_QED] = {
+/* http://wiki.qemu.org/Features/QED */
 QED\0, NULL,
 LV_LITTLE_ENDIAN, -1, -1,
 QED_HDR_IMAGE_SIZE, 8, 1, -1, NULL,


-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 2/4] QED: Basic support for QED images

2010-11-19 Thread Adam Litke
On Fri, 2010-11-19 at 16:05 -0700, Eric Blake wrote:
 Why no backing store extraction function?  Not a show-stopper to this
 patch, but something to consider adding.

Thanks for the review Eric.  Please see patch 4 where I have implemented
qedGetBackingStore().

-- 
Thanks,
Adam

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list