summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-10-22 12:52:58 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2016-10-24 15:27:21 +0200
commitc39860e6dc90f6ee2e82ee078f978c5d7f3df86a (patch)
tree7af723a578b9f33ee172254b20fd9bbdd519cd0c /include
parent5d300164d00cf9d37a4481831d2c993255dfa0e8 (diff)
downloadqemu-c39860e6dc90f6ee2e82ee078f978c5d7f3df86a.tar.gz
char: replace qemu_chr_claim/release with qemu_chr_fe_init/deinit
Now that all front end use qemu_chr_fe_init(), we can move chardev claiming in init(), and add a function deinit() to release the chardev and cleanup handlers. The qemu_chr_fe_claim_no_fail() for property are gone, since the property will raise an error instead. In other cases, where there is already an error path, an error is raised instead. Finally, other cases are handled by &error_abort in qemu_chr_fe_init(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-19-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/sysemu/char.h39
1 files changed, 9 insertions, 30 deletions
diff --git a/include/sysemu/char.h b/include/sysemu/char.h
index f2b3999735..b81dbcc33b 100644
--- a/include/sysemu/char.h
+++ b/include/sysemu/char.h
@@ -362,35 +362,6 @@ int qemu_chr_fe_get_msgfds(CharBackend *be, int *fds, int num);
int qemu_chr_fe_set_msgfds(CharBackend *be, int *fds, int num);
/**
- * @qemu_chr_fe_claim:
- *
- * Claim a backend before using it, should be called before calling
- * qemu_chr_fe_set_handlers().
- *
- * Returns: -1 if the backend is already in use by another frontend, 0 on
- * success.
- */
-int qemu_chr_fe_claim(CharDriverState *s);
-
-/**
- * @qemu_chr_fe_claim_no_fail:
- *
- * Like qemu_chr_fe_claim, but will exit qemu with an error when the
- * backend is already in use.
- */
-void qemu_chr_fe_claim_no_fail(CharDriverState *s);
-
-/**
- * @qemu_chr_fe_release:
- *
- * Release a backend for use by another frontend.
- *
- * Returns: -1 if the backend is already in use by another frontend, 0 on
- * success.
- */
-void qemu_chr_fe_release(CharDriverState *s);
-
-/**
* @qemu_chr_be_can_write:
*
* Determine how much data the front end can currently accept. This function
@@ -437,7 +408,8 @@ void qemu_chr_be_event(CharDriverState *s, int event);
* @qemu_chr_fe_init:
*
* Initializes a front end for the given CharBackend and
- * CharDriver.
+ * CharDriver. Call qemu_chr_fe_deinit() to remove the association and
+ * release the driver.
*
* Returns: false on error.
*/
@@ -451,6 +423,13 @@ bool qemu_chr_fe_init(CharBackend *b, CharDriverState *s, Error **errp);
CharDriverState *qemu_chr_fe_get_driver(CharBackend *be);
/**
+ * @qemu_chr_fe_deinit:
+ *
+ * Dissociate the CharBackend from the CharDriver.
+ */
+void qemu_chr_fe_deinit(CharBackend *b);
+
+/**
* @qemu_chr_fe_set_handlers:
* @b: a CharBackend
* @fd_can_read: callback to get the amount of data the frontend may