aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorLukas Straub <lukasstraub2@web.de>2021-03-23 18:52:42 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2021-04-01 15:27:44 +0400
commit1a92d6d500e5de762bad78bee1362a7dafb909fd (patch)
treefff77d93a8642903931e15a899e38c4a5341866d /migration
parent816f93b20045f3363a4bc1c31e5e7aebbb6c1087 (diff)
yank: Remove dependency on qiochannel
Remove dependency on qiochannel by removing yank_generic_iochannel and letting migration and chardev use their own yank function for iochannel. Signed-off-by: Lukas Straub <lukasstraub2@web.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20ff143fc2db23e27cd41d38043e481376c9cec1.1616521341.git.lukasstraub2@web.de>
Diffstat (limited to 'migration')
-rw-r--r--migration/channel.c6
-rw-r--r--migration/meson.build1
-rw-r--r--migration/multifd.c3
-rw-r--r--migration/qemu-file-channel.c3
-rw-r--r--migration/yank_functions.c20
-rw-r--r--migration/yank_functions.h17
6 files changed, 46 insertions, 4 deletions
diff --git a/migration/channel.c b/migration/channel.c
index 35fe234e9c..c9ee902021 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -20,6 +20,7 @@
#include "io/channel-tls.h"
#include "io/channel-socket.h"
#include "qemu/yank.h"
+#include "yank_functions.h"
/**
* @migration_channel_process_incoming - Create new incoming migration channel
@@ -38,7 +39,8 @@ void migration_channel_process_incoming(QIOChannel *ioc)
ioc, object_get_typename(OBJECT(ioc)));
if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET)) {
- yank_register_function(MIGRATION_YANK_INSTANCE, yank_generic_iochannel,
+ yank_register_function(MIGRATION_YANK_INSTANCE,
+ migration_yank_iochannel,
QIO_CHANNEL(ioc));
}
@@ -76,7 +78,7 @@ void migration_channel_connect(MigrationState *s,
if (!error) {
if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET)) {
yank_register_function(MIGRATION_YANK_INSTANCE,
- yank_generic_iochannel,
+ migration_yank_iochannel,
QIO_CHANNEL(ioc));
}
diff --git a/migration/meson.build b/migration/meson.build
index 9645f44005..2cfa8eed72 100644
--- a/migration/meson.build
+++ b/migration/meson.build
@@ -6,6 +6,7 @@ migration_files = files(
'vmstate.c',
'qemu-file-channel.c',
'qemu-file.c',
+ 'yank_functions.c',
)
softmmu_ss.add(migration_files)
diff --git a/migration/multifd.c b/migration/multifd.c
index 03527c564c..a6677c45c8 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -27,6 +27,7 @@
#include "qemu/yank.h"
#include "io/channel-socket.h"
+#include "yank_functions.h"
/* Multiple fd's */
@@ -989,7 +990,7 @@ int multifd_load_cleanup(Error **errp)
if (object_dynamic_cast(OBJECT(p->c), TYPE_QIO_CHANNEL_SOCKET)
&& OBJECT(p->c)->ref == 1) {
yank_unregister_function(MIGRATION_YANK_INSTANCE,
- yank_generic_iochannel,
+ migration_yank_iochannel,
QIO_CHANNEL(p->c));
}
diff --git a/migration/qemu-file-channel.c b/migration/qemu-file-channel.c
index afc3a7f642..876d05a540 100644
--- a/migration/qemu-file-channel.c
+++ b/migration/qemu-file-channel.c
@@ -28,6 +28,7 @@
#include "io/channel-socket.h"
#include "qemu/iov.h"
#include "qemu/yank.h"
+#include "yank_functions.h"
static ssize_t channel_writev_buffer(void *opaque,
@@ -108,7 +109,7 @@ static int channel_close(void *opaque, Error **errp)
if (object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET)
&& OBJECT(ioc)->ref == 1) {
yank_unregister_function(MIGRATION_YANK_INSTANCE,
- yank_generic_iochannel,
+ migration_yank_iochannel,
QIO_CHANNEL(ioc));
}
object_unref(OBJECT(ioc));
diff --git a/migration/yank_functions.c b/migration/yank_functions.c
new file mode 100644
index 0000000000..96c90e17dc
--- /dev/null
+++ b/migration/yank_functions.c
@@ -0,0 +1,20 @@
+/*
+ * migration yank functions
+ *
+ * Copyright (c) Lukas Straub <lukasstraub2@web.de>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "io/channel.h"
+#include "yank_functions.h"
+
+void migration_yank_iochannel(void *opaque)
+{
+ QIOChannel *ioc = QIO_CHANNEL(opaque);
+
+ qio_channel_shutdown(ioc, QIO_CHANNEL_SHUTDOWN_BOTH, NULL);
+}
diff --git a/migration/yank_functions.h b/migration/yank_functions.h
new file mode 100644
index 0000000000..055ea22523
--- /dev/null
+++ b/migration/yank_functions.h
@@ -0,0 +1,17 @@
+/*
+ * migration yank functions
+ *
+ * Copyright (c) Lukas Straub <lukasstraub2@web.de>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+/**
+ * migration_yank_iochannel: yank function for iochannel
+ *
+ * This yank function will call qio_channel_shutdown on the provided QIOChannel.
+ *
+ * @opaque: QIOChannel to shutdown
+ */
+void migration_yank_iochannel(void *opaque);