[PATCH RFC v2 05/11] vmstate: Rename VMS_NULLPTR_MARKER to VMS_MARKER_PTR_NULL

Peter Xu posted 11 patches 6 days, 21 hours ago
[PATCH RFC v2 05/11] vmstate: Rename VMS_NULLPTR_MARKER to VMS_MARKER_PTR_NULL
Posted by Peter Xu 6 days, 21 hours ago
Prepare for a new MARKER for non-NULL pointer.

Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io>
---
 include/migration/vmstate.h | 2 +-
 migration/vmstate-types.c   | 4 ++--
 tests/unit/test-vmstate.c   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index b4bc69486d..092e8f7e9a 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -283,7 +283,7 @@ extern const VMStateInfo vmstate_info_uint64;
 extern const VMStateInfo vmstate_info_fd;
 
 /** Put this in the stream when migrating a null pointer.*/
-#define VMS_NULLPTR_MARKER (0x30U) /* '0' */
+#define VMS_MARKER_PTR_NULL          (0x30U)   /* '0' */
 extern const VMStateInfo vmstate_info_nullptr;
 
 extern const VMStateInfo vmstate_info_cpudouble;
diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c
index 23f3433696..7622cf8f01 100644
--- a/migration/vmstate-types.c
+++ b/migration/vmstate-types.c
@@ -363,7 +363,7 @@ static bool load_nullptr(QEMUFile *f, void *pv, size_t size,
                          const VMStateField *field, Error **errp)
 
 {
-    if (qemu_get_byte(f) == VMS_NULLPTR_MARKER) {
+    if (qemu_get_byte(f) == VMS_MARKER_PTR_NULL) {
         return true;
     }
 
@@ -377,7 +377,7 @@ static bool save_nullptr(QEMUFile *f, void *pv, size_t size,
 
 {
     if (pv == NULL) {
-        qemu_put_byte(f, VMS_NULLPTR_MARKER);
+        qemu_put_byte(f, VMS_MARKER_PTR_NULL);
         return true;
     }
 
diff --git a/tests/unit/test-vmstate.c b/tests/unit/test-vmstate.c
index 6a42cc1a4e..dae15786aa 100644
--- a/tests/unit/test-vmstate.c
+++ b/tests/unit/test-vmstate.c
@@ -620,7 +620,7 @@ static void test_arr_ptr_str_no0_load(void)
 
 static uint8_t wire_arr_ptr_0[] = {
     0x00, 0x00, 0x00, 0x00,
-    VMS_NULLPTR_MARKER,
+    VMS_MARKER_PTR_NULL,
     0x00, 0x00, 0x00, 0x02,
     0x00, 0x00, 0x00, 0x03,
     QEMU_VM_EOF
-- 
2.50.1
Re: [PATCH RFC v2 05/11] vmstate: Rename VMS_NULLPTR_MARKER to VMS_MARKER_PTR_NULL
Posted by Philippe Mathieu-Daudé 1 day, 5 hours ago
On 26/3/26 22:05, Peter Xu wrote:
> Prepare for a new MARKER for non-NULL pointer.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io>
> ---
>   include/migration/vmstate.h | 2 +-
>   migration/vmstate-types.c   | 4 ++--
>   tests/unit/test-vmstate.c   | 2 +-
>   3 files changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Re: [PATCH RFC v2 05/11] vmstate: Rename VMS_NULLPTR_MARKER to VMS_MARKER_PTR_NULL
Posted by Fabiano Rosas 6 days, 6 hours ago
Peter Xu <peterx@redhat.com> writes:

> Prepare for a new MARKER for non-NULL pointer.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io>
> ---
>  include/migration/vmstate.h | 2 +-
>  migration/vmstate-types.c   | 4 ++--
>  tests/unit/test-vmstate.c   | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
> index b4bc69486d..092e8f7e9a 100644
> --- a/include/migration/vmstate.h
> +++ b/include/migration/vmstate.h
> @@ -283,7 +283,7 @@ extern const VMStateInfo vmstate_info_uint64;
>  extern const VMStateInfo vmstate_info_fd;
>  
>  /** Put this in the stream when migrating a null pointer.*/
> -#define VMS_NULLPTR_MARKER (0x30U) /* '0' */
> +#define VMS_MARKER_PTR_NULL          (0x30U)   /* '0' */
>  extern const VMStateInfo vmstate_info_nullptr;
>  
>  extern const VMStateInfo vmstate_info_cpudouble;
> diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c
> index 23f3433696..7622cf8f01 100644
> --- a/migration/vmstate-types.c
> +++ b/migration/vmstate-types.c
> @@ -363,7 +363,7 @@ static bool load_nullptr(QEMUFile *f, void *pv, size_t size,
>                           const VMStateField *field, Error **errp)
>  
>  {
> -    if (qemu_get_byte(f) == VMS_NULLPTR_MARKER) {
> +    if (qemu_get_byte(f) == VMS_MARKER_PTR_NULL) {
>          return true;
>      }
>  
> @@ -377,7 +377,7 @@ static bool save_nullptr(QEMUFile *f, void *pv, size_t size,
>  
>  {
>      if (pv == NULL) {
> -        qemu_put_byte(f, VMS_NULLPTR_MARKER);
> +        qemu_put_byte(f, VMS_MARKER_PTR_NULL);
>          return true;
>      }
>  
> diff --git a/tests/unit/test-vmstate.c b/tests/unit/test-vmstate.c
> index 6a42cc1a4e..dae15786aa 100644
> --- a/tests/unit/test-vmstate.c
> +++ b/tests/unit/test-vmstate.c
> @@ -620,7 +620,7 @@ static void test_arr_ptr_str_no0_load(void)
>  
>  static uint8_t wire_arr_ptr_0[] = {
>      0x00, 0x00, 0x00, 0x00,
> -    VMS_NULLPTR_MARKER,
> +    VMS_MARKER_PTR_NULL,
>      0x00, 0x00, 0x00, 0x02,
>      0x00, 0x00, 0x00, 0x03,
>      QEMU_VM_EOF

Reviewed-by: Fabiano Rosas <farosas@suse.de>