]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
char: move fe_open in CharBackend
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Sat, 22 Oct 2016 10:09:37 +0000 (13:09 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 24 Oct 2016 13:46:10 +0000 (15:46 +0200)
The fe_open state belongs to front end.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20161022100951.19562-1-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/sysemu/char.h
qemu-char.c

index ae32e1ce25fb680bdfca7cf0556a89176de06106..2c3060ced39a6eb32cd663426dc505dafb712775 100644 (file)
@@ -81,6 +81,7 @@ typedef struct CharBackend {
     IOReadHandler *chr_read;
     void *opaque;
     int tag;
+    int fe_open;
 } CharBackend;
 
 struct CharDriverState {
@@ -108,7 +109,6 @@ struct CharDriverState {
     char *filename;
     int logfd;
     int be_open;
-    int fe_open;
     int explicit_be_open;
     int avail_connections;
     int is_mux;
index a1517a4e4c8f825d0d4a31b8b41294d3e26ed91a..3b98acf279cd30f7a138b18a5f02225269df96ee 100644 (file)
@@ -910,6 +910,7 @@ bool qemu_chr_fe_init(CharBackend *b, CharDriverState *s, Error **errp)
         s->be = b;
     }
 
+    b->fe_open = false;
     b->tag = tag;
     b->chr = s;
 
@@ -4216,10 +4217,10 @@ void qemu_chr_fe_set_open(CharBackend *be, int fe_open)
         return;
     }
 
-    if (chr->fe_open == fe_open) {
+    if (be->fe_open == fe_open) {
         return;
     }
-    chr->fe_open = fe_open;
+    be->fe_open = fe_open;
     if (chr->chr_set_fe_open) {
         chr->chr_set_fe_open(chr, fe_open);
     }
@@ -4304,7 +4305,7 @@ ChardevInfoList *qmp_query_chardev(Error **errp)
         info->value = g_malloc0(sizeof(*info->value));
         info->value->label = g_strdup(chr->label);
         info->value->filename = g_strdup(chr->filename);
-        info->value->frontend_open = chr->fe_open;
+        info->value->frontend_open = chr->be && chr->be->fe_open;
 
         info->next = chr_list;
         chr_list = info;