[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 04/11] chardev: add some comments about the class methods
|
From: |
marcandre . lureau |
|
Subject: |
[PATCH v2 04/11] chardev: add some comments about the class methods |
|
Date: |
Wed, 4 Aug 2021 19:48:41 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
include/chardev/char.h | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/include/chardev/char.h b/include/chardev/char.h
index 589e7fe46d..a319b5fdff 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -254,24 +254,57 @@ struct ChardevClass {
bool internal; /* TODO: eventually use TYPE_USER_CREATABLE */
bool supports_yank;
+
+ /* parse command line options and populate QAPI @backend */
void (*parse)(QemuOpts *opts, ChardevBackend *backend, Error **errp);
+ /* called after construction, open/starts the backend */
void (*open)(Chardev *chr, ChardevBackend *backend,
bool *be_opened, Error **errp);
+ /* write buf to the backend */
int (*chr_write)(Chardev *s, const uint8_t *buf, int len);
+
+ /*
+ * Read from the backend (blocking). A typical front-end will instead rely
+ * on chr_can_read/chr_read being called when polling/looping.
+ */
int (*chr_sync_read)(Chardev *s, const uint8_t *buf, int len);
+
+ /* create a watch on the backend */
GSource *(*chr_add_watch)(Chardev *s, GIOCondition cond);
+
+ /* update the backend internal sources */
void (*chr_update_read_handler)(Chardev *s);
+
+ /* send an ioctl to the backend */
int (*chr_ioctl)(Chardev *s, int cmd, void *arg);
+
+ /* get ancillary-received fds during last read */
int (*get_msgfds)(Chardev *s, int* fds, int num);
+
+ /* set ancillary fds to be sent with next write */
int (*set_msgfds)(Chardev *s, int *fds, int num);
+
+ /* accept the given fd */
int (*chr_add_client)(Chardev *chr, int fd);
+
+ /* wait for a connection */
int (*chr_wait_connected)(Chardev *chr, Error **errp);
+
+ /* disconnect a connection */
void (*chr_disconnect)(Chardev *chr);
+
+ /* called by frontend when it can read */
void (*chr_accept_input)(Chardev *chr);
+
+ /* set terminal echo */
void (*chr_set_echo)(Chardev *chr, bool echo);
+
+ /* notify the backend of frontend open state */
void (*chr_set_fe_open)(Chardev *chr, int fe_open);
+
+ /* handle various events */
void (*chr_be_event)(Chardev *s, QEMUChrEvent event);
};
--
2.32.0.264.g75ae10bc75
- Re: [PATCH v2 05/11] chardev: mark explicitly first argument as poisoned, (continued)
[PATCH v2 01/11] util: fix abstract socket path copy, marcandre . lureau, 2021/08/04
[PATCH v2 03/11] chardev: remove needless class method, marcandre . lureau, 2021/08/04
[PATCH v2 07/11] chardev: fix qemu_chr_open_fd() being called with fd=-1, marcandre . lureau, 2021/08/04
[PATCH v2 06/11] chardev: fix fd_chr_add_watch() when in != out, marcandre . lureau, 2021/08/04
[PATCH v2 08/11] chardev: fix qemu_chr_open_fd() with fd_in==fd_out, marcandre . lureau, 2021/08/04
[PATCH v2 04/11] chardev: add some comments about the class methods,
marcandre . lureau <=
[PATCH v2 02/11] chardev/socket: print a more correct command-line address, marcandre . lureau, 2021/08/04
[PATCH v2 11/11] chardev: reuse qmp_chardev_new(), marcandre . lureau, 2021/08/04
[PATCH v2 09/11] chardev: give some context on chardev-add error, marcandre . lureau, 2021/08/04
[PATCH v2 10/11] chardev: report a simpler error about duplicated id, marcandre . lureau, 2021/08/04