Skip to contentSkip to conversation

VMSTate & MACADDR

PATCH New Juan Quintela 1 participant 4 messages Oct 22, 2009

lore
Share & tools
lore
#0 lore raw

cover VMSTate & MACADDR

Now that there is a MACAddr type, add a
VMSTATE_MACADDR() helper.

As my patches are applied after Gerd one, this three patches should be put (in current staging code) as:

VMSTATE_MACADDR
After this one
commit 3ce425f6678881df86fe581318ca37bce50ec924

Author: Juan Quintela <[email protected]>
Date:   Mon Oct 19 15:46:28 2009 +0200

vmstate: Add VMSTATE_BUFFER_UNUSED

rtl8139: squash into:

commit c85c705373bd8247da98d20ec9e8625517853e77

Author: Juan Quintela <[email protected]>
Date:   Thu Oct 15 15:51:26 2009 +0200

rtl8139: port to vmstate

eepro100 one: squash into:
commit 28b015e9ba36710141e6e8dc255c23f33ac19f7c

Author: Juan Quintela <[email protected]>
Date:   Mon Oct 19 15:37:57 2009 +0200

eepro100: port to vmstate

Later, Juan.

Juan Quintela (3):
vmstate: Add VMSTATE_MACADDR for the new type
rtl8139: Use VMSTATE_MACADDR
eepro100: Use VMSTATE_MACADDR

 hw/eepro100.c |    2 +-
 hw/hw.h       |   12 ++++++++++++
 hw/rtl8139.c  |    2 +-
 3 files changed, 14 insertions(+), 2 deletions(-)
#1 lore raw

PATCH 1/3 vmstate: Add VMSTATE_MACADDR for the new type

---
 hw/hw.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
hw/hw.h +12 -0
index 428a52d..eb5c639 100644
@@ -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
Signature · 1 line
1.6.2.5
#2 lore raw

PATCH 2/3 rtl8139: Use VMSTATE_MACADDR

In reply to Juan Quintela
---
 hw/rtl8139.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/rtl8139.c +1 -1
index d11ae3b..62fa3ca 100644
@@ -3155,7 +3155,7 @@ static const VMStateDescription vmstate_rtl8139 = {
         VMSTATE_UINT8(TxThresh, RTL8139State),
 
         VMSTATE_UNUSED(4),
-        VMSTATE_BUFFER(conf.macaddr, RTL8139State),
+        VMSTATE_MACADDR(conf.macaddr, RTL8139State),
         VMSTATE_INT32(rtl8139_mmio_io_addr, RTL8139State),
 
         VMSTATE_UINT32(currTxDesc, RTL8139State),
Signature · 1 line
1.6.2.5
#3 lore raw

PATCH 3/3 eepro100: Use VMSTATE_MACADDR

In reply to Juan Quintela
---
 hw/eepro100.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/eepro100.c +1 -1
index 07805b1..ab505bf 100644
@@ -1612,7 +1612,7 @@ static const VMStateDescription vmstate_eepro100 = {
         VMSTATE_UINT8(scb_stat, EEPRO100State),
         VMSTATE_UINT8(int_stat, EEPRO100State),
         VMSTATE_UNUSED(3*4),
-        VMSTATE_BUFFER(conf.macaddr, EEPRO100State),
+        VMSTATE_MACADDR(conf.macaddr, EEPRO100State),
         VMSTATE_UNUSED(19*4),
         VMSTATE_UINT16_ARRAY(mdimem, EEPRO100State, 32),
         /* The eeprom should be saved and restored by its own routines. */
Signature · 1 line
1.6.2.5