[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v1 05/26] char-socket: add 'fd' property
From: |
Adalbert Lazăr |
Subject: |
[RFC PATCH v1 05/26] char-socket: add 'fd' property |
Date: |
Wed, 15 Apr 2020 03:59:17 +0300 |
This is used by the VM introspection object, after handshake, to hand
over the file descriptor to KVM.
CC: "Marc-André Lureau" <address@hidden>
CC: Paolo Bonzini <address@hidden>
Signed-off-by: Adalbert Lazăr <address@hidden>
---
chardev/char-socket.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index 22ab242748..76d0fb8839 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -1499,6 +1499,21 @@ static bool char_socket_get_reconnecting(Object *obj,
Error **errp)
return s->reconnect_time > 0;
}
+static void
+char_socket_get_fd(Object *obj, Visitor *v, const char *name, void *opaque,
+ Error **errp)
+{
+ int fd = -1;
+ SocketChardev *s = SOCKET_CHARDEV(obj);
+ QIOChannelSocket *sock = QIO_CHANNEL_SOCKET(s->sioc);
+
+ if (sock) {
+ fd = sock->fd;
+ }
+
+ visit_type_int32(v, name, &fd, errp);
+}
+
static int tcp_chr_reconnect_time(Chardev *chr, int secs)
{
SocketChardev *s = SOCKET_CHARDEV(chr);
@@ -1539,6 +1554,9 @@ static void char_socket_class_init(ObjectClass *oc, void
*data)
object_class_property_add_bool(oc, "reconnecting",
char_socket_get_reconnecting,
NULL, &error_abort);
+
+ object_class_property_add(oc, "fd", "int32", char_socket_get_fd,
+ NULL, NULL, NULL, &error_abort);
}
static const TypeInfo char_socket_type_info = {
- Re: [RFC PATCH v1 03/26] char-socket: fix the client mode when created through QMP, (continued)
[RFC PATCH v1 08/26] kvm: add VM introspection usage documentation, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 04/26] char-socket: add 'reconnecting' property, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 06/26] E820: extend the table access interface, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 07/26] linux-headers: update with VM introspection interface, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 05/26] char-socket: add 'fd' property,
Adalbert Lazăr <=
[RFC PATCH v1 13/26] kvm: vmi: block the object destruction if the chardev is connected, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 09/26] kvm: introduce the VM introspection object, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 02/26] char-socket: allow vsock parameters (cid, port), Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 01/26] chardev: tcp: allow to change the reconnect timer, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 14/26] kvm: vmi: allow only one instance of the introspection object, Adalbert Lazăr, 2020/04/14
[RFC PATCH v1 11/26] kvm: vmi: add 'handshake_timeout' property, Adalbert Lazăr, 2020/04/14