Skip to content

Commit

Permalink
migration/yank: Use channel features
Browse files Browse the repository at this point in the history
Stop using outside knowledge about the io channels when registering
yank functions. Query for features instead.

The yank method for all channels used with migration code currently is
to call the qio_channel_shutdown() function, so query for
QIO_CHANNEL_FEATURE_SHUTDOWN. We could add a separate feature in the
future for indicating whether a channel supports yanking, but that
seems overkill at the moment.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/r/20230911171320.24372-9-farosas@suse.de
Signed-off-by: Peter Xu <peterx@redhat.com>
  • Loading branch information
Fabiano Rosas authored and xzpeter committed Jan 26, 2024
1 parent 17e8f59 commit 347ceb8
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions migration/yank_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "io/channel.h"
#include "yank_functions.h"
#include "qemu/yank.h"
#include "io/channel-socket.h"
#include "io/channel-tls.h"
#include "qemu-file.h"

void migration_yank_iochannel(void *opaque)
Expand All @@ -26,8 +23,7 @@ void migration_yank_iochannel(void *opaque)
/* Return whether yank is supported on this ioc */
static bool migration_ioc_yank_supported(QIOChannel *ioc)
{
return object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_SOCKET) ||
object_dynamic_cast(OBJECT(ioc), TYPE_QIO_CHANNEL_TLS);
return qio_channel_has_feature(ioc, QIO_CHANNEL_FEATURE_SHUTDOWN);
}

void migration_ioc_register_yank(QIOChannel *ioc)
Expand Down

0 comments on commit 347ceb8

Please sign in to comment.