[Spice-devel] [PATCH spice-server] spice-char: Add some documentation to SpiceCharDeviceInterface

Frediano Ziglio fziglio at redhat.com
Thu Mar 22 10:12:45 UTC 2018


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/spice-char.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/server/spice-char.h b/server/spice-char.h
index 1a8a031d..4d780eb7 100644
--- a/server/spice-char.h
+++ b/server/spice-char.h
@@ -40,9 +40,30 @@ typedef enum {
 struct SpiceCharDeviceInterface {
     SpiceBaseInterface base;
 
+    /* Set the state of the device.
+     * connected should be 0 or 1.
+     * Setting state to 0 cause the device to be disabled.
+     */
     void (*state)(SpiceCharDeviceInstance *sin, int connected);
+
+    /* Write some bytes to the character device.
+     * Returns bytes copied from buf or a value < 0 on errors.
+     * 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 cause 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 cause indeterminate results.
+     */
     int (*read)(SpiceCharDeviceInstance *sin, uint8_t *buf, int len);
+
     void (*event)(SpiceCharDeviceInstance *sin, uint8_t event);
     spice_char_device_flags flags;
 };
-- 
2.14.3



More information about the Spice-devel mailing list