[07/30] storagefile: Use qcowXGetBackingStore directly

Message ID 753e01b3ed570fb49fe0d294cb34ad7bf49d9a2a.1570482718.git.crobinso@redhat.com
State Accepted
Commit 242e7ac590900d5599a255d4c895bb10be365660
Headers show
Series
  • storagefile, security: qcow2 data_file support
Related show

Commit Message

Cole Robinson Oct. 7, 2019, 9:49 p.m.
The qcow1 and qcow2 variants are identical, so remove the wrappers

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 src/util/virstoragefile.c | 27 +++------------------------
 1 file changed, 3 insertions(+), 24 deletions(-)

-- 
2.23.0

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

Comments

Daniel Henrique Barboza Oct. 9, 2019, 8:55 p.m. | #1
On 10/7/19 6:49 PM, Cole Robinson wrote:
> The qcow1 and qcow2 variants are identical, so remove the wrappers

>

> Signed-off-by: Cole Robinson <crobinso@redhat.com>

> ---



Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>


>   src/util/virstoragefile.c | 27 +++------------------------

>   1 file changed, 3 insertions(+), 24 deletions(-)

>

> diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c

> index 14551af4d2..a9a6c3e132 100644

> --- a/src/util/virstoragefile.c

> +++ b/src/util/virstoragefile.c

> @@ -180,9 +180,7 @@ struct FileTypeInfo {

>   

>   static int cowGetBackingStore(char **, int *,

>                                 const char *, size_t);

> -static int qcow1GetBackingStore(char **, int *,

> -                                const char *, size_t);

> -static int qcow2GetBackingStore(char **, int *,

> +static int qcowXGetBackingStore(char **, int *,

>                                   const char *, size_t);

>   static int qcow2GetFeatures(virBitmapPtr *features, int format,

>                               char *buf, ssize_t len);

> @@ -366,14 +364,14 @@ static struct FileTypeInfo const fileTypeInfo[] = {

>           LV_BIG_ENDIAN, 4, 4, {1},

>           QCOWX_HDR_IMAGE_SIZE, 8, 1,

>           qcow1EncryptionInfo,

> -        qcow1GetBackingStore, NULL

> +        qcowXGetBackingStore, NULL

>       },

>       [VIR_STORAGE_FILE_QCOW2] = {

>           0, "QFI", NULL,

>           LV_BIG_ENDIAN, 4, 4, {2, 3},

>           QCOWX_HDR_IMAGE_SIZE, 8, 1,

>           qcow2EncryptionInfo,

> -        qcow2GetBackingStore,

> +        qcowXGetBackingStore,

>           qcow2GetFeatures

>       },

>       [VIR_STORAGE_FILE_QED] = {

> @@ -565,25 +563,6 @@ qcowXGetBackingStore(char **res,

>   }

>   

>   

> -static int

> -qcow1GetBackingStore(char **res,

> -                     int *format,

> -                     const char *buf,

> -                     size_t buf_size)

> -{

> -    return qcowXGetBackingStore(res, format, buf, buf_size);

> -}

> -

> -static int

> -qcow2GetBackingStore(char **res,

> -                     int *format,

> -                     const char *buf,

> -                     size_t buf_size)

> -{

> -    return qcowXGetBackingStore(res, format, buf, buf_size);

> -}

> -

> -

>   static int

>   vmdk4GetBackingStore(char **res,

>                        int *format,


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

Patch

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 14551af4d2..a9a6c3e132 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -180,9 +180,7 @@  struct FileTypeInfo {
 
 static int cowGetBackingStore(char **, int *,
                               const char *, size_t);
-static int qcow1GetBackingStore(char **, int *,
-                                const char *, size_t);
-static int qcow2GetBackingStore(char **, int *,
+static int qcowXGetBackingStore(char **, int *,
                                 const char *, size_t);
 static int qcow2GetFeatures(virBitmapPtr *features, int format,
                             char *buf, ssize_t len);
@@ -366,14 +364,14 @@  static struct FileTypeInfo const fileTypeInfo[] = {
         LV_BIG_ENDIAN, 4, 4, {1},
         QCOWX_HDR_IMAGE_SIZE, 8, 1,
         qcow1EncryptionInfo,
-        qcow1GetBackingStore, NULL
+        qcowXGetBackingStore, NULL
     },
     [VIR_STORAGE_FILE_QCOW2] = {
         0, "QFI", NULL,
         LV_BIG_ENDIAN, 4, 4, {2, 3},
         QCOWX_HDR_IMAGE_SIZE, 8, 1,
         qcow2EncryptionInfo,
-        qcow2GetBackingStore,
+        qcowXGetBackingStore,
         qcow2GetFeatures
     },
     [VIR_STORAGE_FILE_QED] = {
@@ -565,25 +563,6 @@  qcowXGetBackingStore(char **res,
 }
 
 
-static int
-qcow1GetBackingStore(char **res,
-                     int *format,
-                     const char *buf,
-                     size_t buf_size)
-{
-    return qcowXGetBackingStore(res, format, buf, buf_size);
-}
-
-static int
-qcow2GetBackingStore(char **res,
-                     int *format,
-                     const char *buf,
-                     size_t buf_size)
-{
-    return qcowXGetBackingStore(res, format, buf, buf_size);
-}
-
-
 static int
 vmdk4GetBackingStore(char **res,
                      int *format,