Skip to contentSkip to conversation

unify popen/fopen qemu wrappers

PATCH In review Paolo Bonzini 2 participants 2 messages Aug 12, 2009 – Aug 18, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 unify popen/fopen qemu wrappers

While reading Chris's code for fd migration I noticed the duplication between QEMUFilePopen and QEMUFileStdio. This fixes it, and makes qemu_fopen more similar qemu_popen.

---
 hw/hw.h          |    2 +-
 migration-exec.c |    4 +-
 savevm.c         |   99 +++++++++++++++++++++++++++--------------------------
 3 files changed, 53 insertions(+), 52 deletions(-)
hw/hw.h +1 -1
index 1e5783d..322f077 100644
@@ -52,7 +52,7 @@ QEMUFile *qemu_fopen(const char *filename, const char *mode);
 QEMUFile *qemu_fopen_socket(int fd);
 QEMUFile *qemu_popen(FILE *popen_file, const char *mode);
 QEMUFile *qemu_popen_cmd(const char *command, const char *mode);
-int qemu_popen_fd(QEMUFile *f);
+int qemu_stdio_fd(QEMUFile *f);
 void qemu_fflush(QEMUFile *f);
 int qemu_fclose(QEMUFile *f);
 void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size);
migration-exec.c +2 -2
index e3616be..235f3f7 100644
@@ -117,7 +117,7 @@ static void exec_accept_incoming_migration(void *opaque)
     qemu_announce_self();
     dprintf("successfully loaded vm state\n");
     /* we've successfully migrated, close the fd */
-    qemu_set_fd_handler2(qemu_popen_fd(f), NULL, NULL, NULL, NULL);
+    qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL);
     if (autostart)
         vm_start();
 
@@ -136,7 +136,7 @@ int exec_start_incoming_migration(const char *command)
         return -errno;
     }
 
-    qemu_set_fd_handler2(qemu_popen_fd(f), NULL,
+    qemu_set_fd_handler2(qemu_stdio_fd(f), NULL,
 			 exec_accept_incoming_migration, NULL,
 			 (void *)(unsigned long)f);
 
savevm.c +50 -49

174 lines not on this page · raw message

Signature · 1 line
1.6.2.5
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Paolo Bonzini

While reading Chris's code for fd migration I noticed the duplication between QEMUFilePopen and QEMUFileStdio. This fixes it, and makes qemu_fopen more similar qemu_popen.

I finally got around to testing this, along with Paolo's upcoming re-post of the migration-fd stuff, and it seems to work fine for me, and is a nice cleanup.

Quoted 1 line