]> git.proxmox.com Git - qemu.git/blobdiff - include/char/char.h
qemu-char: Automatically do fe_open / fe_close on qemu_chr_add_handlers
[qemu.git] / include / char / char.h
index 0326b2a47b4782f2d6e1e52135441eb6ee32c347..3cd2aef77dee246c308b1ff630ca3789755cfe32 100644 (file)
@@ -74,7 +74,9 @@ struct CharDriverState {
     int idle_tag;
     char *label;
     char *filename;
-    int opened;
+    int be_open;
+    int fe_open;
+    int explicit_fe_open;
     int avail_connections;
     QemuOpts *opts;
     QTAILQ_ENTRY(CharDriverState) next;
@@ -169,6 +171,21 @@ int qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond,
  */
 int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len);
 
+/**
+ * @qemu_chr_fe_write_all:
+ *
+ * Write data to a character backend from the front end.  This function will
+ * send data from the front end to the back end.  Unlike @qemu_chr_fe_write,
+ * this function will block if the back end cannot consume all of the data
+ * attempted to be written.
+ *
+ * @buf the data
+ * @len the number of bytes to send
+ *
+ * Returns: the number of bytes consumed
+ */
+int qemu_chr_fe_write_all(CharDriverState *s, const uint8_t *buf, int len);
+
 /**
  * @qemu_chr_fe_ioctl:
  *
@@ -235,7 +252,7 @@ void qemu_chr_add_handlers(CharDriverState *s,
                            IOEventHandler *fd_event,
                            void *opaque);
 
-void qemu_chr_generic_open(CharDriverState *s);
+void qemu_chr_be_generic_open(CharDriverState *s);
 void qemu_chr_accept_input(CharDriverState *s);
 int qemu_chr_add_client(CharDriverState *s, int fd);
 void qemu_chr_info_print(Monitor *mon, const QObject *ret_data);