Patchwork [1/3] vmstate: Add VMSTATE_MACADDR for the new type

login
register
mail settings
Submitter Juan Quintela
Date Oct. 22, 2009, 6:50 p.m.
Message ID <f561b5401e2a122f6090c2f9c01484b5cccfdac5.1256236480.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/36738/
State New
Headers show

Comments

Juan Quintela - Oct. 22, 2009, 6:50 p.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/hw.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/hw.h b/hw/hw.h
index 428a52d..eb5c639 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -522,6 +522,18 @@  extern const VMStateDescription vmstate_i2c_slave;
     .offset     = vmstate_offset_value(_state, _field, i2c_slave),   \
 }

+#define vmstate_offset_macaddr(_state, _field)                       \
+    vmstate_offset_array(_state, _field.a, uint8_t,                \
+                         sizeof(typeof_field(_state, _field)))
+
+#define VMSTATE_MACADDR(_field, _state) {                            \
+    .name       = (stringify(_field)),                               \
+    .size       = sizeof(MACAddr),                                   \
+    .info       = &vmstate_info_uint8,                               \
+    .flags      = VMS_BUFFER,                                        \
+    .offset     = vmstate_offset_macaddr(_state, _field),            \
+}
+
 /* _f : field name
    _f_n : num of elements field_name
    _n : num of elements