[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 19/20] migration: remove the QEMUFileOps 'get_return_path' callba
From: |
Daniel P . Berrangé |
Subject: |
[PATCH 19/20] migration: remove the QEMUFileOps 'get_return_path' callback |
Date: |
Tue, 24 May 2022 12:02:34 +0100 |
This directly implements the get_return_path logic using QIOChannel APIs.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
migration/qemu-file-channel.c | 16 ----------------
migration/qemu-file.c | 22 ++++++++++------------
migration/qemu-file.h | 6 ------
3 files changed, 10 insertions(+), 34 deletions(-)
diff --git a/migration/qemu-file-channel.c b/migration/qemu-file-channel.c
index 2e139f7bcd..51717c1137 100644
--- a/migration/qemu-file-channel.c
+++ b/migration/qemu-file-channel.c
@@ -32,27 +32,11 @@
#include "yank_functions.h"
-static QEMUFile *channel_get_input_return_path(void *opaque)
-{
- QIOChannel *ioc = QIO_CHANNEL(opaque);
-
- return qemu_fopen_channel_output(ioc);
-}
-
-static QEMUFile *channel_get_output_return_path(void *opaque)
-{
- QIOChannel *ioc = QIO_CHANNEL(opaque);
-
- return qemu_fopen_channel_input(ioc);
-}
-
static const QEMUFileOps channel_input_ops = {
- .get_return_path = channel_get_input_return_path,
};
static const QEMUFileOps channel_output_ops = {
- .get_return_path = channel_get_output_return_path,
};
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index 72a6f58af5..dfee808924 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -92,18 +92,6 @@ int qemu_file_shutdown(QEMUFile *f)
return ret;
}
-/*
- * Result: QEMUFile* for a 'return path' for comms in the opposite direction
- * NULL if not available
- */
-QEMUFile *qemu_file_get_return_path(QEMUFile *f)
-{
- if (!f->ops->get_return_path) {
- return NULL;
- }
- return f->ops->get_return_path(f->ioc);
-}
-
bool qemu_file_mode_is_not_valid(const char *mode)
{
if (mode == NULL ||
@@ -131,6 +119,16 @@ static QEMUFile *qemu_file_new_impl(QIOChannel *ioc,
return f;
}
+/*
+ * Result: QEMUFile* for a 'return path' for comms in the opposite direction
+ * NULL if not available
+ */
+QEMUFile *qemu_file_get_return_path(QEMUFile *f)
+{
+ object_ref(f->ioc);
+ return qemu_file_new_impl(f->ioc, f->ops, !f->is_writable);
+}
+
QEMUFile *qemu_file_new_output(QIOChannel *ioc, const QEMUFileOps *ops)
{
return qemu_file_new_impl(ioc, ops, true);
diff --git a/migration/qemu-file.h b/migration/qemu-file.h
index 542c637934..5370e4e5ec 100644
--- a/migration/qemu-file.h
+++ b/migration/qemu-file.h
@@ -55,13 +55,7 @@ typedef size_t (QEMURamSaveFunc)(QEMUFile *f,
size_t size,
uint64_t *bytes_sent);
-/*
- * Return a QEMUFile for comms in the opposite direction
- */
-typedef QEMUFile *(QEMURetPathFunc)(void *opaque);
-
typedef struct QEMUFileOps {
- QEMURetPathFunc *get_return_path;
} QEMUFileOps;
typedef struct QEMUFileHooks {
--
2.36.1
- [PATCH 03/20] migration: remove unreachble RDMA code in save_hook impl, (continued)
- [PATCH 03/20] migration: remove unreachble RDMA code in save_hook impl, Daniel P . Berrangé, 2022/05/24
- [PATCH 15/20] migration: remove the QEMUFileOps 'set_blocking' callback, Daniel P . Berrangé, 2022/05/24
- [PATCH 12/20] migration: introduce new constructors for QEMUFile, Daniel P . Berrangé, 2022/05/24
- [PATCH 16/20] migration: remove the QEMUFileOps 'close' callback, Daniel P . Berrangé, 2022/05/24
- [PATCH 14/20] migration: remove the QEMUFileOps 'shut_down' callback, Daniel P . Berrangé, 2022/05/24
- [PATCH 17/20] migration: remove the QEMUFileOps 'get_buffer' callback, Daniel P . Berrangé, 2022/05/24
- [PATCH 20/20] migration: remove the QEMUFileOps abstraction, Daniel P . Berrangé, 2022/05/24
- [PATCH 18/20] migration: remove the QEMUFileOps 'writev_buffer' callback, Daniel P . Berrangé, 2022/05/24
- [PATCH 08/20] migration: introduce a QIOChannel impl for BlockDriverState VMState, Daniel P . Berrangé, 2022/05/24
- [PATCH 19/20] migration: remove the QEMUFileOps 'get_return_path' callback,
Daniel P . Berrangé <=