[Spice-commits] server/spice-char.h
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jul 10 08:55:28 UTC 2019
server/spice-char.h | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
New commits:
commit 3e299cede850bc889b1f122e1eca70342ca0c39b
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Wed Mar 21 17:46:37 2018 +0000
spice-char: Add some documentation to SpiceCharDeviceInterface
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Victor Toso <victortoso at redhat.com>
diff --git a/server/spice-char.h b/server/spice-char.h
index 1a8a031d..a3b9d26b 100644
--- a/server/spice-char.h
+++ b/server/spice-char.h
@@ -40,9 +40,35 @@ typedef enum {
struct SpiceCharDeviceInterface {
SpiceBaseInterface base;
+ /* Set the state of the device.
+ * connected should be 0 or 1.
+ * Setting state to 0 causes the device to be disabled.
+ * This can be used by SPICE server to tell guest that device is not
+ * working anymore (for instance because the guest itself sent some
+ * wrong request).
+ */
void (*state)(SpiceCharDeviceInstance *sin, int connected);
+
+ /* Write some bytes to the character device.
+ * Returns bytes copied from buf or a value < 0 on errors.
+ * If able to write some bytes the function should return the amount of
+ * bytes successfully written.
+ * Function can return a value < len, even 0.
+ * errno is not determined after calling this function.
+ * Function should be implemented as no-blocking.
+ * A len < 0 causes indeterminate results.
+ */
int (*write)(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len);
+
+ /* Read some bytes from the character device.
+ * Returns bytes copied into buf or a value < 0 on errors.
+ * Function can return 0 if no data is available or len is 0.
+ * errno is not determined after calling this function.
+ * Function should be implemented as no-blocking.
+ * A len < 0 causes indeterminate results.
+ */
int (*read)(SpiceCharDeviceInstance *sin, uint8_t *buf, int len);
+
void (*event)(SpiceCharDeviceInstance *sin, uint8_t event);
spice_char_device_flags flags;
};
More information about the Spice-commits
mailing list