diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2018-11-14 17:29:30 +0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2018-11-27 15:35:15 +0100 |
commit | 03fee66fde3f9e179e3973e8c50f6fa0a0a14613 (patch) | |
tree | 0e9eb8138fe8f5a653b752e54f0cc035d48a2aab /migration/vmstate-types.c | |
parent | 5aaac46793828d01c893b9d99d905c657f59541e (diff) |
vmstate: constify VMStateField
Because they are supposed to remain const.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20181114132931.22624-1-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'migration/vmstate-types.c')
-rw-r--r-- | migration/vmstate-types.c | 119 |
1 files changed, 66 insertions, 53 deletions
diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c index 48184c380d..6f75f97a07 100644 --- a/migration/vmstate-types.c +++ b/migration/vmstate-types.c @@ -22,15 +22,16 @@ /* bool */ -static int get_bool(QEMUFile *f, void *pv, size_t size, VMStateField *field) +static int get_bool(QEMUFile *f, void *pv, size_t size, + const VMStateField *field) { bool *v = pv; *v = qemu_get_byte(f); return 0; } -static int put_bool(QEMUFile *f, void *pv, size_t size, VMStateField *field, - QJSON *vmdesc) +static int put_bool(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, QJSON *vmdesc) { bool *v = pv; qemu_put_byte(f, *v); @@ -45,15 +46,16 @@ const VMStateInfo vmstate_info_bool = { /* 8 bit int */ -static int get_int8(QEMUFile *f, void *pv, size_t size, VMStateField *field) +static int get_int8(QEMUFile *f, void *pv, size_t size, + const VMStateField *field) { int8_t *v = pv; qemu_get_s8s(f, v); return 0; } -static int put_int8(QEMUFile *f, void *pv, size_t size, VMStateField *field, - QJSON *vmdesc) +static int put_int8(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, QJSON *vmdesc) { int8_t *v = pv; qemu_put_s8s(f, v); @@ -68,15 +70,16 @@ const VMStateInfo vmstate_info_int8 = { /* 16 bit int */ -static int get_int16(QEMUFile *f, void *pv, size_t size, VMStateField *field) +static int get_int16(QEMUFile *f, void *pv, size_t size, + const VMStateField *field) { int16_t *v = pv; qemu_get_sbe16s(f, v); return 0; } -static int put_int16(QEMUFile *f, void *pv, size_t size, VMStateField *field, - QJSON *vmdesc) +static int put_int16(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, QJSON *vmdesc) { int16_t *v = pv; qemu_put_sbe16s(f, v); @@ -91,15 +94,16 @@ const VMStateInfo vmstate_info_int16 = { /* 32 bit int */ -static int get_int32(QEMUFile *f, void *pv, size_t size, VMStateField *field) +static int get_int32(QEMUFile *f, void *pv, size_t size, + const VMStateField *field) { int32_t *v = pv; qemu_get_sbe32s(f, v); return 0; } -static int put_int32(QEMUFile *f, void *pv, size_t size, VMStateField *field, - QJSON *vmdesc) +static int put_int32(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, QJSON *vmdesc) { int32_t *v = pv; qemu_put_sbe32s(f, v); @@ -116,7 +120,7 @@ const VMStateInfo vmstate_info_int32 = { in the field */ static int get_int32_equal(QEMUFile *f, void *pv, size_t size, - VMStateField *field) + const VMStateField *field) { int32_t *v = pv; int32_t v2; @@ -142,7 +146,8 @@ const VMStateInfo vmstate_info_int32_equal = { * and less than or equal to the one in the field. */ -static int get_int32_le(QEMUFile *f, void *pv, size_t size, VMStateField *field) +static int get_int32_le(QEMUFile *f, void *pv, size_t size, + const VMStateField *field) { int32_t *cur = pv; int32_t loaded; @@ -166,15 +171,16 @@ const VMStateInfo vmstate_info_int32_le = { /* 64 bit int */ -static int get_int64(QEMUFile *f, void *pv, size_t size, VMStateField *field) +static int get_int64(QEMUFile *f, void *pv, size_t size, + const VMStateField *field) { int64_t *v = pv; qemu_get_sbe64s(f, v); return 0; } -static int put_int64(QEMUFile *f, void *pv, size_t size, VMStateField *field, - QJSON *vmdesc) +static int put_int64(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, QJSON *vmdesc) { int64_t *v = pv; qemu_put_sbe64s(f, v); @@ -189,15 +195,16 @@ const VMStateInfo vmstate_info_int64 = { /* 8 bit unsigned int */ -static int get_uint8(QEMUFile *f, void *pv, size_t size, VMStateField *field) +static int get_uint8(QEMUFile *f, void *pv, size_t size, + const VMStateField *field) { uint8_t *v = pv; qemu_get_8s(f, v); return 0; } -static int put_uint8(QEMUFile *f, void *pv, size_t size, VMStateField *field, - QJSON *vmdesc) +static int put_uint8(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, QJSON *vmdesc) { uint8_t *v = pv; qemu_put_8s(f, v); @@ -212,15 +219,16 @@ const VMStateInfo vmstate_info_uint8 = { /* 16 bit unsigned int */ -static int get_uint16(QEMUFile *f, void *pv, size_t size, VMStateField *field) +static int get_uint16(QEMUFile *f, void *pv, size_t size, + const VMStateField *field) { uint16_t *v = pv; qemu_get_be16s(f, v); return 0; } -static int put_uint16(QEMUFile *f, void *pv, size_t size, VMStateField *field, - QJSON *vmdesc) +static int put_uint16(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, QJSON *vmdesc) { uint16_t *v = pv; qemu_put_be16s(f, v); @@ -235,15 +243,16 @@ const VMStateInfo vmstate_info_uint16 = { /* 32 bit unsigned int */ -static int get_uint32(QEMUFile *f, void *pv, size_t size, VMStateField *field) +static int get_uint32(QEMUFile *f, void *pv, size_t size, + const VMStateField *field) { uint32_t *v = pv; qemu_get_be32s(f, v); return 0; } -static int put_uint32(QEMUFile *f, void *pv, size_t size, VMStateField *field, - QJSON *vmdesc) +static int put_uint32(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, QJSON *vmdesc) { uint32_t *v = pv; qemu_put_be32s(f, v); @@ -260,7 +269,7 @@ const VMStateInfo vmstate_info_uint32 = { in the field */ static int get_uint32_equal(QEMUFile *f, void *pv, size_t size, - VMStateField *field) + const VMStateField *field) { uint32_t *v = pv; uint32_t v2; @@ -284,15 +293,16 @@ const VMStateInfo vmstate_info_uint32_equal = { /* 64 bit unsigned int */ -static int get_uint64(QEMUFile *f, void *pv, size_t size, VMStateField *field) +static int get_uint64(QEMUFile *f, void *pv, size_t size, + const VMStateField *field) { uint64_t *v = pv; qemu_get_be64s(f, v); return 0; } -static int put_uint64(QEMUFile *f, void *pv, size_t size, VMStateField *field, - QJSON *vmdesc) +static int put_uint64(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, QJSON *vmdesc) { uint64_t *v = pv; qemu_put_be64s(f, v); @@ -305,7 +315,8 @@ const VMStateInfo vmstate_info_uint64 = { .put = put_uint64, }; -static int get_nullptr(QEMUFile *f, void *pv, size_t size, VMStateField *field) +static int get_nullptr(QEMUFile *f, void *pv, size_t size, + const VMStateField *field) { if (qemu_get_byte(f) == VMS_NULLPTR_MARKER) { @@ -316,7 +327,7 @@ static int get_nullptr(QEMUFile *f, void *pv, size_t size, VMStateField *field) } static int put_nullptr(QEMUFile *f, void *pv, size_t size, - VMStateField *field, QJSON *vmdesc) + const VMStateField *field, QJSON *vmdesc) { if (pv == NULL) { @@ -337,7 +348,7 @@ const VMStateInfo vmstate_info_nullptr = { in the field */ static int get_uint64_equal(QEMUFile *f, void *pv, size_t size, - VMStateField *field) + const VMStateField *field) { uint64_t *v = pv; uint64_t v2; @@ -363,7 +374,7 @@ const VMStateInfo vmstate_info_uint64_equal = { in the field */ static int get_uint8_equal(QEMUFile *f, void *pv, size_t size, - VMStateField *field) + const VMStateField *field) { uint8_t *v = pv; uint8_t v2; @@ -389,7 +400,7 @@ const VMStateInfo vmstate_info_uint8_equal = { in the field */ static int get_uint16_equal(QEMUFile *f, void *pv, size_t size, - VMStateField *field) + const VMStateField *field) { uint16_t *v = pv; uint16_t v2; @@ -414,7 +425,7 @@ const VMStateInfo vmstate_info_uint16_equal = { /* floating point */ static int get_float64(QEMUFile *f, void *pv, size_t size, - VMStateField *field) + const VMStateField *field) { float64 *v = pv; @@ -422,8 +433,8 @@ static int get_float64(QEMUFile *f, void *pv, size_t size, return 0; } -static int put_float64(QEMUFile *f, void *pv, size_t size, VMStateField *field, - QJSON *vmdesc) +static int put_float64(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, QJSON *vmdesc) { uint64_t *v = pv; @@ -440,7 +451,7 @@ const VMStateInfo vmstate_info_float64 = { /* CPU_DoubleU type */ static int get_cpudouble(QEMUFile *f, void *pv, size_t size, - VMStateField *field) + const VMStateField *field) { CPU_DoubleU *v = pv; qemu_get_be32s(f, &v->l.upper); @@ -449,7 +460,7 @@ static int get_cpudouble(QEMUFile *f, void *pv, size_t size, } static int put_cpudouble(QEMUFile *f, void *pv, size_t size, - VMStateField *field, QJSON *vmdesc) + const VMStateField *field, QJSON *vmdesc) { CPU_DoubleU *v = pv; qemu_put_be32s(f, &v->l.upper); @@ -466,15 +477,15 @@ const VMStateInfo vmstate_info_cpudouble = { /* uint8_t buffers */ static int get_buffer(QEMUFile *f, void *pv, size_t size, - VMStateField *field) + const VMStateField *field) { uint8_t *v = pv; qemu_get_buffer(f, v, size); return 0; } -static int put_buffer(QEMUFile *f, void *pv, size_t size, VMStateField *field, - QJSON *vmdesc) +static int put_buffer(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, QJSON *vmdesc) { uint8_t *v = pv; qemu_put_buffer(f, v, size); @@ -491,7 +502,7 @@ const VMStateInfo vmstate_info_buffer = { not useful anymore */ static int get_unused_buffer(QEMUFile *f, void *pv, size_t size, - VMStateField *field) + const VMStateField *field) { uint8_t buf[1024]; int block_len; @@ -505,7 +516,7 @@ static int get_unused_buffer(QEMUFile *f, void *pv, size_t size, } static int put_unused_buffer(QEMUFile *f, void *pv, size_t size, - VMStateField *field, QJSON *vmdesc) + const VMStateField *field, QJSON *vmdesc) { static const uint8_t buf[1024]; int block_len; @@ -531,7 +542,8 @@ const VMStateInfo vmstate_info_unused_buffer = { * in fields that don't really exist in the parent but need to be in the * stream. */ -static int get_tmp(QEMUFile *f, void *pv, size_t size, VMStateField *field) +static int get_tmp(QEMUFile *f, void *pv, size_t size, + const VMStateField *field) { int ret; const VMStateDescription *vmsd = field->vmsd; @@ -545,8 +557,8 @@ static int get_tmp(QEMUFile *f, void *pv, size_t size, VMStateField *field) return ret; } -static int put_tmp(QEMUFile *f, void *pv, size_t size, VMStateField *field, - QJSON *vmdesc) +static int put_tmp(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, QJSON *vmdesc) { const VMStateDescription *vmsd = field->vmsd; void *tmp = g_malloc(size); @@ -573,7 +585,8 @@ const VMStateInfo vmstate_info_tmp = { */ /* This is the number of 64 bit words sent over the wire */ #define BITS_TO_U64S(nr) DIV_ROUND_UP(nr, 64) -static int get_bitmap(QEMUFile *f, void *pv, size_t size, VMStateField *field) +static int get_bitmap(QEMUFile *f, void *pv, size_t size, + const VMStateField *field) { unsigned long *bmp = pv; int i, idx = 0; @@ -587,8 +600,8 @@ static int get_bitmap(QEMUFile *f, void *pv, size_t size, VMStateField *field) return 0; } -static int put_bitmap(QEMUFile *f, void *pv, size_t size, VMStateField *field, - QJSON *vmdesc) +static int put_bitmap(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, QJSON *vmdesc) { unsigned long *bmp = pv; int i, idx = 0; @@ -613,7 +626,7 @@ const VMStateInfo vmstate_info_bitmap = { * meta data about the QTAILQ is encoded in a VMStateField structure */ static int get_qtailq(QEMUFile *f, void *pv, size_t unused_size, - VMStateField *field) + const VMStateField *field) { int ret = 0; const VMStateDescription *vmsd = field->vmsd; @@ -652,7 +665,7 @@ static int get_qtailq(QEMUFile *f, void *pv, size_t unused_size, /* put for QTAILQ */ static int put_qtailq(QEMUFile *f, void *pv, size_t unused_size, - VMStateField *field, QJSON *vmdesc) + const VMStateField *field, QJSON *vmdesc) { const VMStateDescription *vmsd = field->vmsd; /* offset of the QTAILQ entry in a QTAILQ element*/ |