From 0436e09f9654dfa6f7439531bf443b1f78870ed6 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Wed, 27 Apr 2016 11:04:55 +0100 Subject: migration: split migration hooks out of QEMUFileOps The QEMUFileOps struct contains the I/O subsystem callbacks and the migration stage hooks. Split the hooks out into a separate QEMUFileHooks struct to make it easier to refactor the I/O side of QEMUFile without affecting the hooks. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Daniel P. Berrange Reviewed-by: Juan Quintela Message-Id: <1461751518-12128-6-git-send-email-berrange@redhat.com> Signed-off-by: Amit Shah --- migration/rdma.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'migration/rdma.c') diff --git a/migration/rdma.c b/migration/rdma.c index f6a9992b3e..0d067a1a51 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3380,12 +3380,18 @@ static const QEMUFileOps rdma_read_ops = { .get_buffer = qemu_rdma_get_buffer, .get_fd = qemu_rdma_get_fd, .close = qemu_rdma_close, +}; + +static const QEMUFileHooks rdma_read_hooks = { .hook_ram_load = rdma_load_hook, }; static const QEMUFileOps rdma_write_ops = { .put_buffer = qemu_rdma_put_buffer, .close = qemu_rdma_close, +}; + +static const QEMUFileHooks rdma_write_hooks = { .before_ram_iterate = qemu_rdma_registration_start, .after_ram_iterate = qemu_rdma_registration_stop, .save_page = qemu_rdma_save_page, @@ -3404,8 +3410,10 @@ static void *qemu_fopen_rdma(RDMAContext *rdma, const char *mode) if (mode[0] == 'w') { r->file = qemu_fopen_ops(r, &rdma_write_ops); + qemu_file_set_hooks(r->file, &rdma_write_hooks); } else { r->file = qemu_fopen_ops(r, &rdma_read_ops); + qemu_file_set_hooks(r->file, &rdma_read_hooks); } return r->file; -- cgit v1.2.3