diff mbox

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

Message ID f561b5401e2a122f6090c2f9c01484b5cccfdac5.1256236480.git.quintela@redhat.com
State New
Headers show

Commit Message

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

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