Index: new/vma-reader.c
===================================================================
---- new.orig/vma-reader.c 2014-11-20 12:17:11.000000000 +0100
-+++ new/vma-reader.c 2014-11-20 12:17:39.000000000 +0100
-@@ -334,11 +334,6 @@
+--- new.orig/vma-reader.c
++++ new/vma-reader.c
+@@ -334,11 +334,6 @@ static int vma_reader_read_head(VmaReade
}
}
for (i = 0; i < VMA_MAX_CONFIGS; i++) {
uint32_t name_ptr = GUINT32_FROM_BE(h->config_names[i]);
uint32_t data_ptr = GUINT32_FROM_BE(h->config_data[i]);
-@@ -830,16 +825,20 @@
+@@ -830,16 +825,20 @@ static int vma_reader_restore_full(VmaRe
}
if (verbose) {
return ret;
Index: new/vma-writer.c
===================================================================
---- new.orig/vma-writer.c 2014-11-20 12:17:23.000000000 +0100
-+++ new/vma-writer.c 2014-11-20 12:17:39.000000000 +0100
-@@ -258,7 +258,7 @@
+--- new.orig/vma-writer.c
++++ new/vma-writer.c
+@@ -258,7 +258,7 @@ vma_queue_write(VmaWriter *vmaw, const v
}
vmaw->co_writer = NULL;
return (done == bytes) ? bytes : -1;
}
-@@ -382,10 +382,6 @@
+@@ -382,10 +382,6 @@ static int coroutine_fn vma_write_header
time_t ctime = time(NULL);
head->ctime = GUINT64_TO_BE(ctime);
for (i = 0; i < VMA_MAX_CONFIGS; i++) {
head->config_names[i] = GUINT32_TO_BE(vmaw->config_names[i]);
head->config_data[i] = GUINT32_TO_BE(vmaw->config_data[i]);
-@@ -502,6 +498,23 @@
+@@ -502,6 +498,23 @@ static int vma_count_open_streams(VmaWri
return open_drives;
}
/**
* all jobs should call this when there is no more data
* Returns: number of remaining stream (0 ==> finished)
-@@ -529,12 +542,7 @@
+@@ -529,12 +542,7 @@ vma_writer_close_stream(VmaWriter *vmaw,
if (open_drives <= 0) {
DPRINTF("vma_writer_set_status all drives completed\n");
return open_drives;
Index: new/vma.c
===================================================================
---- new.orig/vma.c 2014-11-20 12:17:11.000000000 +0100
-+++ new/vma.c 2014-11-20 12:17:39.000000000 +0100
-@@ -33,7 +33,7 @@
+--- new.orig/vma.c
++++ new/vma.c
+@@ -33,7 +33,7 @@ static void help(void)
"\n"
"vma list <filename>\n"
"vma config <filename> [-c config]\n"
"vma extract <filename> [-r <fifo>] <targetdir>\n"
"vma verify <filename> [-v]\n"
;
-@@ -401,6 +401,18 @@
+@@ -401,6 +401,18 @@ typedef struct BackupJob {
#define BACKUP_SECTORS_PER_CLUSTER (VMA_CLUSTER_SIZE / BDRV_SECTOR_SIZE)
static void coroutine_fn backup_run(void *opaque)
{
BackupJob *job = (BackupJob *)opaque;
-@@ -474,8 +486,8 @@
+@@ -474,8 +486,8 @@ static int create_archive(int argc, char
}
help();
}
-@@ -510,11 +522,11 @@
+@@ -510,11 +522,11 @@ static int create_archive(int argc, char
l = g_list_next(l);
}
BlockDriver *drv = NULL;
Error *errp = NULL;
-@@ -546,37 +558,42 @@
+@@ -546,37 +558,49 @@ static int create_archive(int argc, char
int percent = 0;
int last_percent = -1;
+ } else {
+ Coroutine *co = qemu_coroutine_create(backup_run_empty);
+ qemu_coroutine_enter(co, vmaw);
++ while (1) {
++ main_loop_wait(false);
++ vma_writer_get_status(vmaw, &vmastat);
++ if (vmastat.closed) {
++ break;
++ }
++ }
}
bdrv_drain_all();
Index: new/vma.h
===================================================================
---- new.orig/vma.h 2014-11-20 12:17:11.000000000 +0100
-+++ new/vma.h 2014-11-20 12:17:39.000000000 +0100
-@@ -128,6 +128,7 @@
+--- new.orig/vma.h
++++ new/vma.h
+@@ -128,6 +128,7 @@ int64_t coroutine_fn vma_writer_write(Vm
size_t *zero_bytes);
int coroutine_fn vma_writer_close_stream(VmaWriter *vmaw, uint8_t dev_id);