Merge tag 'pull-qapi-2024-03-26' of https://repo.or.cz/qemu/armbru into staging
[qemu/armbru.git] / migration / yank_functions.c
blob979e60c7620c640076ebc97612869306b25f1b42
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 "io/channel.h"
12 #include "yank_functions.h"
13 #include "qemu/yank.h"
14 #include "qemu-file.h"
16 void migration_yank_iochannel(void *opaque)
18 QIOChannel *ioc = QIO_CHANNEL(opaque);
20 qio_channel_shutdown(ioc, QIO_CHANNEL_SHUTDOWN_BOTH, NULL);
23 /* Return whether yank is supported on this ioc */
24 static bool migration_ioc_yank_supported(QIOChannel *ioc)
26 return qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_SHUTDOWN);
29 void migration_ioc_register_yank(QIOChannel *ioc)
31 if (migration_ioc_yank_supported(ioc)) {
32 yank_register_function(MIGRATION_YANK_INSTANCE,
33 migration_yank_iochannel,
34 ioc);
38 void migration_ioc_unregister_yank(QIOChannel *ioc)
40 if (migration_ioc_yank_supported(ioc)) {
41 yank_unregister_function(MIGRATION_YANK_INSTANCE,
42 migration_yank_iochannel,
43 ioc);
47 void migration_ioc_unregister_yank_from_file(QEMUFile *file)
49 QIOChannel *ioc = qemu_file_get_ioc(file);
51 if (ioc) {
53 * For migration qemufiles, we'll always reach here. Though we'll skip
54 * calls from e.g. savevm/loadvm as they don't use yank.
56 migration_ioc_unregister_yank(ioc);