[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 10/23] Introduce util functions to control ft_tr
From: |
Yoshiaki Tamura |
Subject: |
[Qemu-devel] [RFC PATCH 10/23] Introduce util functions to control ft_transaction from savevm layer. |
Date: |
Tue, 25 May 2010 17:36:51 +0900 |
To utilize ft_transaction function, savevm needs interfaces to be
exported.
Signed-off-by: Yoshiaki Tamura <address@hidden>
---
hw/hw.h | 5 +++++
savevm.c | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/hw/hw.h b/hw/hw.h
index fc9ed29..5a48a91 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -54,6 +54,8 @@ QEMUFile *qemu_fopen_ops(void *opaque, QEMUFilePutBufferFunc
*put_buffer,
QEMUFile *qemu_fopen(const char *filename, const char *mode);
QEMUFile *qemu_fdopen(int fd, const char *mode);
QEMUFile *qemu_fopen_socket(int fd);
+QEMUFile *qemu_fopen_transaction(int fd);
+QEMUFile *qemu_fopen_tranx_sender(void *opaque);
QEMUFile *qemu_popen(FILE *popen_file, const char *mode);
QEMUFile *qemu_popen_cmd(const char *command, const char *mode);
int qemu_stdio_fd(QEMUFile *f);
@@ -63,6 +65,9 @@ void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int
size);
void qemu_put_byte(QEMUFile *f, int v);
void *qemu_realloc_buffer(QEMUFile *f, int size);
void qemu_clear_buffer(QEMUFile *f);
+int qemu_transaction_begin(QEMUFile *f);
+int qemu_transaction_commit(QEMUFile *f);
+int qemu_transaction_cancel(QEMUFile *f);
static inline void qemu_put_ubyte(QEMUFile *f, unsigned int v)
{
diff --git a/savevm.c b/savevm.c
index 2ab883b..81cb711 100644
--- a/savevm.c
+++ b/savevm.c
@@ -82,6 +82,7 @@
#include "migration.h"
#include "qemu_socket.h"
#include "qemu-queue.h"
+#include "ft_transaction.h"
/* point to the block driver where the snapshots are managed */
static BlockDriverState *bs_snapshots;
@@ -207,6 +208,21 @@ static int socket_get_buffer(void *opaque, uint8_t *buf,
int64_t pos, int size)
return len;
}
+static ssize_t socket_put_buffer(void *opaque, const void *buf, size_t size)
+{
+ QEMUFileSocket *s = opaque;
+ ssize_t len;
+
+ do {
+ len = send(s->fd, (void *)buf, size, 0);
+ } while (len == -1 && socket_error() == EINTR);
+
+ if (len == -1)
+ len = -socket_error();
+
+ return len;
+}
+
static int socket_close(void *opaque)
{
QEMUFileSocket *s = opaque;
@@ -335,6 +351,16 @@ QEMUFile *qemu_fopen_socket(int fd)
return s->file;
}
+QEMUFile *qemu_fopen_transaction(int fd)
+{
+ QEMUFileSocket *s = qemu_mallocz(sizeof(QEMUFileSocket));
+
+ s->fd = fd;
+ s->file = qemu_fopen_ops_ft_tranx(s, socket_put_buffer, socket_get_buffer,
+ socket_close, 0);
+ return s->file;
+}
+
static int file_put_buffer(void *opaque, const uint8_t *buf,
int64_t pos, int size)
{
@@ -472,6 +498,21 @@ void qemu_clear_buffer(QEMUFile *f)
memset(f->buf, 0, f->buf_max_size);
}
+int qemu_transaction_begin(QEMUFile *f)
+{
+ return qemu_ft_tranx_begin(f->opaque);
+}
+
+int qemu_transaction_commit(QEMUFile *f)
+{
+ return qemu_ft_tranx_commit(f->opaque);
+}
+
+int qemu_transaction_cancel(QEMUFile *f)
+{
+ return qemu_ft_tranx_cancel(f->opaque);
+}
+
static void qemu_fill_buffer(QEMUFile *f)
{
int len;
--
1.7.0.31.g1df487
- [Qemu-devel] [RFC PATCH 00/23] Kemari for KVM v0.1.1, Yoshiaki Tamura, 2010/05/25
- [Qemu-devel] [RFC PATCH 14/23] Call init handler of event-tap at main()., Yoshiaki Tamura, 2010/05/25
- [Qemu-devel] [RFC PATCH 15/23] Insert event_tap_ioport() to ioport_write()., Yoshiaki Tamura, 2010/05/25
- [Qemu-devel] [RFC PATCH 16/23] Insert event_tap_mmio() to cpu_physical_memory_rw()., Yoshiaki Tamura, 2010/05/25
- [Qemu-devel] [RFC PATCH 10/23] Introduce util functions to control ft_transaction from savevm layer.,
Yoshiaki Tamura <=
- [Qemu-devel] [RFC PATCH 19/23] Introduce ft_tranx_ready(), and modify migrate_fd_put_ready() when ft_mode is on., Yoshiaki Tamura, 2010/05/25
- [Qemu-devel] [RFC PATCH 22/23] Introduce -k option to enable FT migration mode (Kemari)., Yoshiaki Tamura, 2010/05/25
- [Qemu-devel] [RFC PATCH 21/23] virtio-blk: Modify save/load handler to handle inuse varialble., Yoshiaki Tamura, 2010/05/25
- [Qemu-devel] [RFC PATCH 08/23] Introduce some socket util functions., Yoshiaki Tamura, 2010/05/25
- [Qemu-devel] [RFC PATCH 04/23] Use cpu_physical_memory_get_dirty_range() to check multiple dirty pages., Yoshiaki Tamura, 2010/05/25
- [Qemu-devel] [RFC PATCH 20/23] Modify tcp_accept_incoming_migration() to handle ft_mode, and add a hack not to close fd when ft_mode is enabled., Yoshiaki Tamura, 2010/05/25
- [Qemu-devel] [RFC PATCH 23/23] Add a parser to accept FT migration incoming mode., Yoshiaki Tamura, 2010/05/25
- [Qemu-devel] [RFC PATCH 07/23] Introduce skip_header parameter to qemu_loadvm_state()., Yoshiaki Tamura, 2010/05/25
- [Qemu-devel] [RFC PATCH 12/23] Insent event-tap callbacks to net/block layer., Yoshiaki Tamura, 2010/05/25
- [Qemu-devel] [RFC PATCH 03/23] Use cpu_physical_memory_set_dirty_range() to update phys_ram_dirty., Yoshiaki Tamura, 2010/05/25