]> Git Repo - qemu.git/commitdiff
char: add chr_wait_connected callback
authorMarc-André Lureau <[email protected]>
Tue, 26 Jul 2016 21:15:17 +0000 (01:15 +0400)
committerMichael S. Tsirkin <[email protected]>
Thu, 28 Jul 2016 21:33:48 +0000 (00:33 +0300)
A function to wait on the backend to be connected, to be used in the
following patches.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
include/sysemu/char.h
qemu-char.c

index 0ea9eacc406aebe4c7e9b9493279c81a715eac4c..ee7e55468f8f8dfe7d6bde9d483304a84a571226 100644 (file)
@@ -70,6 +70,7 @@ struct CharDriverState {
     int (*get_msgfds)(struct CharDriverState *s, int* fds, int num);
     int (*set_msgfds)(struct CharDriverState *s, int *fds, int num);
     int (*chr_add_client)(struct CharDriverState *chr, int fd);
+    int (*chr_wait_connected)(struct CharDriverState *chr, Error **errp);
     IOEventHandler *chr_event;
     IOCanReadHandler *chr_can_read;
     IOReadHandler *chr_read;
@@ -158,6 +159,13 @@ void qemu_chr_disconnect(CharDriverState *chr);
  */
 void qemu_chr_cleanup(void);
 
+/**
+ * @qemu_chr_wait_connected:
+ *
+ * Wait for characted backend to be connected.
+ */
+int qemu_chr_wait_connected(CharDriverState *chr, Error **errp);
+
 /**
  * @qemu_chr_new_noreplay:
  *
index 1274f50e00c4ff73e623940b50fc818492bd596b..6eba615818b7ae96256017663acde90e0e674d30 100644 (file)
@@ -3139,6 +3139,15 @@ static gboolean tcp_chr_accept(QIOChannel *channel,
     return TRUE;
 }
 
+int qemu_chr_wait_connected(CharDriverState *chr, Error **errp)
+{
+    if (chr->chr_wait_connected) {
+        return chr->chr_wait_connected(chr, errp);
+    }
+
+    return 0;
+}
+
 static void tcp_chr_close(CharDriverState *chr)
 {
     TCPCharDriver *s = chr->opaque;
This page took 0.031882 seconds and 4 git commands to generate.