summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-03-06 14:50:31 +0100
committerHans de Goede <hdegoede@redhat.com>2013-03-06 16:22:15 +0100
commita5a2a6b9c4592de6eff434e68e7dbb3bb9c274dc (patch)
treedbb051fa968561b0c19333b6f46e02ad438a6fb3
parent8684159596fc66d63e486833c92fd71803b8e305 (diff)
vdagent-virtio-port: Add vdagent_virtio_port_reset()
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--src/vdagent-virtio-port.c10
-rw-r--r--src/vdagent-virtio-port.h1
2 files changed, 11 insertions, 0 deletions
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