Patchwork [V5,22/29] vmstate: add VMSTATE_ARRAY_POINTER for pointer to array.

login
register
mail settings
Submitter Isaku Yamahata
Date Oct. 9, 2009, 6:28 a.m.
Message ID <1255069742-15724-23-git-send-email-yamahata@valinux.co.jp>
Download mbox | patch
Permalink /patch/35596/
State Under Review
Headers show

Comments

Isaku Yamahata - Oct. 9, 2009, 6:28 a.m.
add VMSTATE_ARRAY_POINTER for pointer to array.
This will be used later.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/hw.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
Michael S. Tsirkin - Oct. 11, 2009, 10:37 a.m.
On Fri, Oct 09, 2009 at 03:28:55PM +0900, Isaku Yamahata wrote:
> add VMSTATE_ARRAY_POINTER for pointer to array.
> This will be used later.
> 
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
> ---
>  hw/hw.h |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/hw.h b/hw/hw.h
> index 8c223f8..e867af4 100644
> --- a/hw/hw.h
> +++ b/hw/hw.h
> @@ -389,6 +389,16 @@ extern const VMStateInfo vmstate_info_buffer;
>          + type_check_array(_type,typeof_field(_state, _field),_num)  \
>  }
>  
> +#define VMSTATE_ARRAY_POINTER(_field, _state, _version, _info, _type, _size) { \
> +    .name       = (stringify(_field)),                               \
> +    .version_id = (_version),                                        \
> +    .size       = (_size),                                           \
> +    .info       = &(_info),                                          \
> +    .flags      = VMS_SINGLE | VMS_POINTER,                          \
> +    .offset     = offsetof(_state, _field)                           \
> +            + type_check(_type,typeof_field(_state, _field))         \
> +}
> +

This is really just VMSTATE_POINTER, array pointer implies char** IMO.
Also please use a wrapper so that users don't
have to repeat typeof_field(_state, _field).


>  #define VMSTATE_VARRAY(_field, _state, _field_num, _version, _info, _type) {\
>      .name       = (stringify(_field)),                               \
>      .version_id = (_version),                                        \
> -- 
> 1.6.0.2

Patch

diff --git a/hw/hw.h b/hw/hw.h
index 8c223f8..e867af4 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -389,6 +389,16 @@  extern const VMStateInfo vmstate_info_buffer;
         + type_check_array(_type,typeof_field(_state, _field),_num)  \
 }
 
+#define VMSTATE_ARRAY_POINTER(_field, _state, _version, _info, _type, _size) { \
+    .name       = (stringify(_field)),                               \
+    .version_id = (_version),                                        \
+    .size       = (_size),                                           \
+    .info       = &(_info),                                          \
+    .flags      = VMS_SINGLE | VMS_POINTER,                          \
+    .offset     = offsetof(_state, _field)                           \
+            + type_check(_type,typeof_field(_state, _field))         \
+}
+
 #define VMSTATE_VARRAY(_field, _state, _field_num, _version, _info, _type) {\
     .name       = (stringify(_field)),                               \
     .version_id = (_version),                                        \