[PATCH 1/3] qemu: Move declaration of virQEMUSaveFormat to header file

Jim Fehlig via Devel posted 3 patches 10 months, 1 week ago
[PATCH 1/3] qemu: Move declaration of virQEMUSaveFormat to header file
Posted by Jim Fehlig via Devel 10 months, 1 week ago
Allow use of the enum outside of qemu_saveimage.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---
 src/qemu/qemu_saveimage.c | 19 -------------------
 src/qemu/qemu_saveimage.h | 19 +++++++++++++++++++
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c
index 5c889fee11..403e4c9679 100644
--- a/src/qemu/qemu_saveimage.c
+++ b/src/qemu/qemu_saveimage.c
@@ -37,25 +37,6 @@
 
 VIR_LOG_INIT("qemu.qemu_saveimage");
 
-typedef enum {
-    QEMU_SAVE_FORMAT_RAW = 0,
-    QEMU_SAVE_FORMAT_GZIP = 1,
-    QEMU_SAVE_FORMAT_BZIP2 = 2,
-    /*
-     * Deprecated by xz and never used as part of a release
-     * QEMU_SAVE_FORMAT_LZMA
-     */
-    QEMU_SAVE_FORMAT_XZ = 3,
-    QEMU_SAVE_FORMAT_LZOP = 4,
-    QEMU_SAVE_FORMAT_ZSTD = 5,
-    /* Note: add new members only at the end.
-       These values are used in the on-disk format.
-       Do not change or re-use numbers. */
-
-    QEMU_SAVE_FORMAT_LAST
-} virQEMUSaveFormat;
-
-VIR_ENUM_DECL(qemuSaveFormat);
 VIR_ENUM_IMPL(qemuSaveFormat,
               QEMU_SAVE_FORMAT_LAST,
               "raw",
diff --git a/src/qemu/qemu_saveimage.h b/src/qemu/qemu_saveimage.h
index 53ae222467..8e755e1eb5 100644
--- a/src/qemu/qemu_saveimage.h
+++ b/src/qemu/qemu_saveimage.h
@@ -32,6 +32,25 @@
 
 G_STATIC_ASSERT(sizeof(QEMU_SAVE_MAGIC) == sizeof(QEMU_SAVE_PARTIAL));
 
+typedef enum {
+    QEMU_SAVE_FORMAT_RAW = 0,
+    QEMU_SAVE_FORMAT_GZIP = 1,
+    QEMU_SAVE_FORMAT_BZIP2 = 2,
+    /*
+     * Deprecated by xz and never used as part of a release
+     * QEMU_SAVE_FORMAT_LZMA
+     */
+    QEMU_SAVE_FORMAT_XZ = 3,
+    QEMU_SAVE_FORMAT_LZOP = 4,
+    QEMU_SAVE_FORMAT_ZSTD = 5,
+    /* Note: add new members only at the end.
+       These values are used in the on-disk format.
+       Do not change or re-use numbers. */
+
+    QEMU_SAVE_FORMAT_LAST
+} virQEMUSaveFormat;
+VIR_ENUM_DECL(qemuSaveFormat);
+
 typedef struct _virQEMUSaveHeader virQEMUSaveHeader;
 struct _virQEMUSaveHeader {
     char magic[sizeof(QEMU_SAVE_MAGIC)-1];
-- 
2.43.0
Re: [PATCH 1/3] qemu: Move declaration of virQEMUSaveFormat to header file
Posted by Daniel P. Berrangé 10 months ago
On Fri, Feb 14, 2025 at 03:48:16PM -0700, Jim Fehlig via Devel wrote:
> Allow use of the enum outside of qemu_saveimage.
> 
> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
> ---
>  src/qemu/qemu_saveimage.c | 19 -------------------
>  src/qemu/qemu_saveimage.h | 19 +++++++++++++++++++
>  2 files changed, 19 insertions(+), 19 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

> diff --git a/src/qemu/qemu_saveimage.h b/src/qemu/qemu_saveimage.h
> index 53ae222467..8e755e1eb5 100644
> --- a/src/qemu/qemu_saveimage.h
> +++ b/src/qemu/qemu_saveimage.h
> @@ -32,6 +32,25 @@
>  
>  G_STATIC_ASSERT(sizeof(QEMU_SAVE_MAGIC) == sizeof(QEMU_SAVE_PARTIAL));
>  
> +typedef enum {
> +    QEMU_SAVE_FORMAT_RAW = 0,
> +    QEMU_SAVE_FORMAT_GZIP = 1,
> +    QEMU_SAVE_FORMAT_BZIP2 = 2,
> +    /*
> +     * Deprecated by xz and never used as part of a release
> +     * QEMU_SAVE_FORMAT_LZMA
> +     */

As a separate commit we can cull that comment. We don't need to record
the fact we deleted that years ago before it ever it was ever visible
to users.

> +    QEMU_SAVE_FORMAT_XZ = 3,
> +    QEMU_SAVE_FORMAT_LZOP = 4,
> +    QEMU_SAVE_FORMAT_ZSTD = 5,
> +    /* Note: add new members only at the end.
> +       These values are used in the on-disk format.
> +       Do not change or re-use numbers. */
> +
> +    QEMU_SAVE_FORMAT_LAST
> +} virQEMUSaveFormat;
> +VIR_ENUM_DECL(qemuSaveFormat);
> +

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|