qemu-file: Make total_transferred an uint64_t
Change all the functions that use it. It was already passed as
uint64_t.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20230504113841.23130-8-quintela@redhat.com>
diff --git a/migration/block.c b/migration/block.c
index 3499f75..a37678c 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -747,8 +747,7 @@
static int block_save_iterate(QEMUFile *f, void *opaque)
{
int ret;
- int64_t last_bytes = qemu_file_total_transferred(f);
- int64_t delta_bytes;
+ uint64_t last_bytes = qemu_file_total_transferred(f);
trace_migration_block_save("iterate", block_mig_state.submitted,
block_mig_state.transferred);
@@ -800,7 +799,7 @@
}
qemu_put_be64(f, BLK_MIG_FLAG_EOS);
- delta_bytes = qemu_file_total_transferred(f) - last_bytes;
+ uint64_t delta_bytes = qemu_file_total_transferred(f) - last_bytes;
return (delta_bytes > 0);
}
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index 11b510a..ccbefc3 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -51,7 +51,7 @@
int64_t rate_limit_used;
/* The sum of bytes transferred on the wire */
- int64_t total_transferred;
+ uint64_t total_transferred;
int buf_index;
int buf_size; /* 0 when writing */
@@ -708,9 +708,9 @@
return result;
}
-int64_t qemu_file_total_transferred_fast(QEMUFile *f)
+uint64_t qemu_file_total_transferred_fast(QEMUFile *f)
{
- int64_t ret = f->total_transferred;
+ uint64_t ret = f->total_transferred;
int i;
for (i = 0; i < f->iovcnt; i++) {
@@ -720,7 +720,7 @@
return ret;
}
-int64_t qemu_file_total_transferred(QEMUFile *f)
+uint64_t qemu_file_total_transferred(QEMUFile *f)
{
qemu_fflush(f);
return f->total_transferred;
diff --git a/migration/qemu-file.h b/migration/qemu-file.h
index d16cd50..4f26bf6 100644
--- a/migration/qemu-file.h
+++ b/migration/qemu-file.h
@@ -83,7 +83,7 @@
*
* Returns: the total bytes transferred
*/
-int64_t qemu_file_total_transferred(QEMUFile *f);
+uint64_t qemu_file_total_transferred(QEMUFile *f);
/*
* qemu_file_total_transferred_fast:
@@ -95,7 +95,7 @@
*
* Returns: the total bytes transferred and queued
*/
-int64_t qemu_file_total_transferred_fast(QEMUFile *f);
+uint64_t qemu_file_total_transferred_fast(QEMUFile *f);
/*
* put_buffer without copying the buffer.
diff --git a/migration/savevm.c b/migration/savevm.c
index a9d0a88..032044b 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -927,11 +927,9 @@
static void vmstate_save_old_style(QEMUFile *f, SaveStateEntry *se,
JSONWriter *vmdesc)
{
- int64_t old_offset, size;
-
- old_offset = qemu_file_total_transferred_fast(f);
+ uint64_t old_offset = qemu_file_total_transferred_fast(f);
se->ops->save_state(f, se->opaque);
- size = qemu_file_total_transferred_fast(f) - old_offset;
+ uint64_t size = qemu_file_total_transferred_fast(f) - old_offset;
if (vmdesc) {
json_writer_int64(vmdesc, "size", size);
diff --git a/migration/vmstate.c b/migration/vmstate.c
index 83ca4c7..351f561 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -349,7 +349,7 @@
void *first_elem = opaque + field->offset;
int i, n_elems = vmstate_n_elems(opaque, field);
int size = vmstate_size(opaque, field);
- int64_t old_offset, written_bytes;
+ uint64_t old_offset, written_bytes;
JSONWriter *vmdesc_loop = vmdesc;
trace_vmstate_save_state_loop(vmsd->name, field->name, n_elems);