@@ -657,6 +657,12 @@ int64_t qemu_ftell(QEMUFile *f)
return f->pos;
}
+int64_t qemu_ftell2(QEMUFile *f)
+{
+ qemu_fflush(f);
+ return f->pos + f->buf_index - f->buf_size;
+}
+
int qemu_file_rate_limit(QEMUFile *f)
{
if (f->shutdown) {
@@ -124,6 +124,7 @@ void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks);
int qemu_get_fd(QEMUFile *f);
int qemu_fclose(QEMUFile *f);
int64_t qemu_ftell(QEMUFile *f);
+int64_t qemu_ftell2(QEMUFile *f);
int64_t qemu_ftell_fast(QEMUFile *f);
/*
* put_buffer without copying the buffer.
In qemu-snapshot it is needed to retrieve current QEMUFile offset as a number of bytes read by qemu_get_byte()/qemu_get_buffer(). The existing qemu_ftell() routine would give read position as a number of bytes fetched from underlying IOChannel which is not the same. Signed-off-by: Andrey Gruzdev <andrey.gruzdev@virtuozzo.com> --- migration/qemu-file.c | 6 ++++++ migration/qemu-file.h | 1 + 2 files changed, 7 insertions(+)