[Spice-devel] [linux-vdagent PATCH 03/10] vdagent-virtio-port: Add vdagent_virtio_port_reset()
Hans de Goede
hdegoede at redhat.com
Wed Mar 6 07:22:39 PST 2013
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
src/vdagent-virtio-port.c | 10 ++++++++++
src/vdagent-virtio-port.h | 1 +
2 files changed, 11 insertions(+)
diff --git a/src/vdagent-virtio-port.c b/src/vdagent-virtio-port.c
index 7e9a3e6..f56428e 100644
--- a/src/vdagent-virtio-port.c
+++ b/src/vdagent-virtio-port.c
@@ -260,6 +260,16 @@ void vdagent_virtio_port_flush(struct vdagent_virtio_port **vportp)
vdagent_virtio_port_do_write(vportp);
}
+void vdagent_virtio_port_reset(struct vdagent_virtio_port *vport, int port)
+{
+ if (port > VDP_LAST_PORT) {
+ syslog(LOG_ERR, "vdagent_virtio_port_reset port out of range");
+ return;
+ }
+ free(vport->port_data[port].message_data);
+ memset(&vport->port_data[port], 0, sizeof(vport->port_data[0]));
+}
+
static void vdagent_virtio_port_do_chunk(struct vdagent_virtio_port **vportp)
{
int avail, read, pos = 0;
diff --git a/src/vdagent-virtio-port.h b/src/vdagent-virtio-port.h
index c47fbcc..a392ebe 100644
--- a/src/vdagent-virtio-port.h
+++ b/src/vdagent-virtio-port.h
@@ -99,5 +99,6 @@ int vdagent_virtio_port_write(
uint32_t data_size);
void vdagent_virtio_port_flush(struct vdagent_virtio_port **vportp);
+void vdagent_virtio_port_reset(struct vdagent_virtio_port *vport, int port);
#endif
--
1.8.1.4
More information about the Spice-devel
mailing list