mirror of
https://github.com/qemu/qemu.git
synced 2026-04-05 21:46:25 +00:00
chardev: Consolidate yank registration
There's currently five places where the yank function is being registered and they all come right before tcp_chr_new_client(). Fold them into it. Signed-off-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20260302092225.4088227-8-peter.maydell@linaro.org [PMM: rebased] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
committed by
Peter Maydell
parent
3f0170505e
commit
5c102ac9f1
@@ -905,6 +905,12 @@ static int tcp_chr_new_client(Chardev *chr, QIOChannelSocket *sioc)
|
||||
s->sioc = sioc;
|
||||
object_ref(OBJECT(sioc));
|
||||
|
||||
if (s->registered_yank) {
|
||||
yank_register_function(CHARDEV_YANK_INSTANCE(chr->label),
|
||||
char_socket_yank_iochannel,
|
||||
QIO_CHANNEL(sioc));
|
||||
}
|
||||
|
||||
if (s->do_nodelay) {
|
||||
qio_channel_set_delay(s->ioc, false);
|
||||
}
|
||||
@@ -943,11 +949,6 @@ static int tcp_chr_add_client(Chardev *chr, int fd)
|
||||
}
|
||||
tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING);
|
||||
tcp_chr_set_client_ioc_name(chr, sioc);
|
||||
if (s->registered_yank) {
|
||||
yank_register_function(CHARDEV_YANK_INSTANCE(chr->label),
|
||||
char_socket_yank_iochannel,
|
||||
QIO_CHANNEL(sioc));
|
||||
}
|
||||
ret = tcp_chr_new_client(chr, sioc);
|
||||
object_unref(OBJECT(sioc));
|
||||
return ret;
|
||||
@@ -962,11 +963,6 @@ static void tcp_chr_accept(QIONetListener *listener,
|
||||
|
||||
tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING);
|
||||
tcp_chr_set_client_ioc_name(chr, cioc);
|
||||
if (s->registered_yank) {
|
||||
yank_register_function(CHARDEV_YANK_INSTANCE(chr->label),
|
||||
char_socket_yank_iochannel,
|
||||
QIO_CHANNEL(cioc));
|
||||
}
|
||||
tcp_chr_new_client(chr, cioc);
|
||||
}
|
||||
|
||||
@@ -982,11 +978,6 @@ static int tcp_chr_connect_client_sync(Chardev *chr, Error **errp)
|
||||
object_unref(OBJECT(sioc));
|
||||
return -1;
|
||||
}
|
||||
if (s->registered_yank) {
|
||||
yank_register_function(CHARDEV_YANK_INSTANCE(chr->label),
|
||||
char_socket_yank_iochannel,
|
||||
QIO_CHANNEL(sioc));
|
||||
}
|
||||
tcp_chr_new_client(chr, sioc);
|
||||
object_unref(OBJECT(sioc));
|
||||
return 0;
|
||||
@@ -1002,11 +993,6 @@ static void tcp_chr_accept_server_sync(Chardev *chr)
|
||||
tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING);
|
||||
sioc = qio_net_listener_wait_client(s->listener);
|
||||
tcp_chr_set_client_ioc_name(chr, sioc);
|
||||
if (s->registered_yank) {
|
||||
yank_register_function(CHARDEV_YANK_INSTANCE(chr->label),
|
||||
char_socket_yank_iochannel,
|
||||
QIO_CHANNEL(sioc));
|
||||
}
|
||||
tcp_chr_new_client(chr, sioc);
|
||||
object_unref(OBJECT(sioc));
|
||||
}
|
||||
@@ -1180,11 +1166,6 @@ static void tcp_chr_connect_client_async(Chardev *chr)
|
||||
tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING);
|
||||
sioc = qio_channel_socket_new();
|
||||
tcp_chr_set_client_ioc_name(chr, sioc);
|
||||
if (s->registered_yank) {
|
||||
yank_register_function(CHARDEV_YANK_INSTANCE(chr->label),
|
||||
char_socket_yank_iochannel,
|
||||
QIO_CHANNEL(sioc));
|
||||
}
|
||||
/*
|
||||
* Normally code would use the qio_channel_socket_connect_async
|
||||
* method which uses a QIOTask + qio_task_set_error internally
|
||||
|
||||
Reference in New Issue
Block a user