diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2016-04-27 11:04:55 +0100 |
---|---|---|
committer | Amit Shah <amit.shah@redhat.com> | 2016-05-26 11:31:16 +0530 |
commit | 0436e09f9654dfa6f7439531bf443b1f78870ed6 (patch) | |
tree | b17129a565c93377b71d71fc3e3221e0b26e8a4a /migration/rdma.c | |
parent | baf51e7739a4d176284d2e38e1755afeafcd2ee0 (diff) |
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 <dgilbert@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <1461751518-12128-6-git-send-email-berrange@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'migration/rdma.c')
-rw-r--r-- | migration/rdma.c | 8 |
1 files changed, 8 insertions, 0 deletions
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; |