gitlab-ci: Disable the riscv64-debian-cross-container by default
[qemu/armbru.git] / migration / yank_functions.c
blobd5a710a3f2f53b0c8b361e445291d4353149d160
1 /*
2 * migration yank functions
4 * Copyright (c) Lukas Straub <lukasstraub2@web.de>
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 */
10 #include "qemu/osdep.h"
11 #include "qapi/error.h"
12 #include "io/channel.h"
13 #include "yank_functions.h"
14 #include "qemu/yank.h"
15 #include "io/channel-socket.h"
16 #include "io/channel-tls.h"
17 #include "qemu-file.h"
19 void migration_yank_iochannel(void *opaque)
21 QIOChannel *ioc = QIO_CHANNEL(opaque);
23 qio_channel_shutdown(ioc, QIO_CHANNEL_SHUTDOWN_BOTH, NULL);
26 /* Return whether yank is supported on this ioc */
27 static bool migration_ioc_yank_supported(QIOChannel *ioc)
29 return object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET) ||
30 object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_TLS);
33 void migration_ioc_register_yank(QIOChannel *ioc)
35 if (migration_ioc_yank_supported(ioc)) {
36 yank_register_function(MIGRATION_YANK_INSTANCE,
37 migration_yank_iochannel,
38 ioc);
42 void migration_ioc_unregister_yank(QIOChannel *ioc)
44 if (migration_ioc_yank_supported(ioc)) {
45 yank_unregister_function(MIGRATION_YANK_INSTANCE,
46 migration_yank_iochannel,
47 ioc);
51 void migration_ioc_unregister_yank_from_file(QEMUFile *file)
53 QIOChannel *ioc = qemu_file_get_ioc(file);
55 if (ioc) {
57 * For migration qemufiles, we'll always reach here. Though we'll skip
58 * calls from e.g. savevm/loadvm as they don't use yank.
60 migration_ioc_unregister_yank(ioc);