[Spice-devel] [PATCH 1/2] server: rename SpiceVDIPort* to SpiceCharDevice*
Alon Levy
alevy at redhat.com
Thu Aug 26 01:44:52 PDT 2010
---
server/reds.c | 48 +++++++++++++++++++++---------------------
server/spice-experimental.h | 28 ++++++++++++------------
2 files changed, 38 insertions(+), 38 deletions(-)
diff --git a/server/reds.c b/server/reds.c
index 571013f..0870612 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -63,7 +63,7 @@ SpiceCoreInterface *core = NULL;
static SpiceKbdInstance *keyboard = NULL;
static SpiceMouseInstance *mouse = NULL;
static SpiceTabletInstance *tablet = NULL;
-static SpiceVDIPortInstance *vdagent = NULL;
+static SpiceCharDeviceInstance *vdagent = NULL;
#define MIGRATION_NOTIFY_SPICE_KEY "spice_mig_ext"
@@ -734,8 +734,8 @@ static void reds_disconnect()
reds_reset_outgoing();
if (reds->agent_state.connected) {
- SpiceVDIPortInterface *sif;
- sif = SPICE_CONTAINEROF(vdagent->base.sif, SpiceVDIPortInterface, base);
+ SpiceCharDeviceInterface *sif;
+ sif = SPICE_CONTAINEROF(vdagent->base.sif, SpiceCharDeviceInterface, base);
reds->agent_state.connected = 0;
if (sif->state) {
sif->state(vdagent, reds->agent_state.connected);
@@ -1085,8 +1085,8 @@ static void reds_send_agent_disconnected()
static void reds_agent_remove()
{
- SpiceVDIPortInstance *sin = vdagent;
- SpiceVDIPortInterface *sif;
+ SpiceCharDeviceInstance *sin = vdagent;
+ SpiceCharDeviceInterface *sif;
vdagent = NULL;
reds_update_mouse_mode();
@@ -1096,7 +1096,7 @@ static void reds_agent_remove()
}
ASSERT(reds->agent_state.connected)
- sif = SPICE_CONTAINEROF(sin->base.sif, SpiceVDIPortInterface, base);
+ sif = SPICE_CONTAINEROF(sin->base.sif, SpiceCharDeviceInterface, base);
reds->agent_state.connected = 0;
if (sif->state) {
sif->state(sin, reds->agent_state.connected);
@@ -1151,7 +1151,7 @@ static void vdi_port_write_retry()
static int write_to_vdi_port()
{
VDIPortState *state = &reds->agent_state;
- SpiceVDIPortInterface *sif;
+ SpiceCharDeviceInterface *sif;
RingItem *ring_item;
VDIPortBuf *buf;
int total = 0;
@@ -1161,7 +1161,7 @@ static int write_to_vdi_port()
return 0;
}
- sif = SPICE_CONTAINEROF(vdagent->base.sif, SpiceVDIPortInterface, base);
+ sif = SPICE_CONTAINEROF(vdagent->base.sif, SpiceCharDeviceInterface, base);
while (reds->agent_state.connected) {
if (!(ring_item = ring_get_tail(&state->write_queue))) {
break;
@@ -1227,7 +1227,7 @@ static int read_from_vdi_port(void)
static int inside_call = 0;
int quit_loop = 0;
VDIPortState *state = &reds->agent_state;
- SpiceVDIPortInterface *sif;
+ SpiceCharDeviceInterface *sif;
VDIReadBuf *dispatch_buf;
int total = 0;
int n;
@@ -1241,7 +1241,7 @@ static int read_from_vdi_port(void)
return 0;
}
- sif = SPICE_CONTAINEROF(vdagent->base.sif, SpiceVDIPortInterface, base);
+ sif = SPICE_CONTAINEROF(vdagent->base.sif, SpiceCharDeviceInterface, base);
while (!quit_loop && reds->agent_state.connected) {
switch (state->read_state) {
case VDI_PORT_READ_STATE_READ_HADER:
@@ -1310,7 +1310,7 @@ static int read_from_vdi_port(void)
return total;
}
-__visible__ void spice_server_vdi_port_wakeup(SpiceVDIPortInstance *sin)
+__visible__ void spice_server_char_device_wakeup(SpiceCharDeviceInstance *sin)
{
while (read_from_vdi_port());
}
@@ -2042,8 +2042,8 @@ static void reds_handle_main_link(RedLinkInfo *link)
reds_show_new_channel(link);
__reds_release_link(link);
if (vdagent) {
- SpiceVDIPortInterface *sif;
- sif = SPICE_CONTAINEROF(vdagent->base.sif, SpiceVDIPortInterface, base);
+ SpiceCharDeviceInterface *sif;
+ sif = SPICE_CONTAINEROF(vdagent->base.sif, SpiceCharDeviceInterface, base);
reds->agent_state.connected = 1;
if (sif->state) {
sif->state(vdagent, reds->agent_state.connected);
@@ -3391,17 +3391,17 @@ static void mm_timer_proc(void *opaque)
core->timer_start(reds->mm_timer, MM_TIMER_GRANULARITY_MS);
}
-static void attach_to_red_agent(SpiceVDIPortInstance *sin)
+static void attach_to_red_agent(SpiceCharDeviceInstance *sin)
{
VDIPortState *state = &reds->agent_state;
- SpiceVDIPortInterface *sif;
+ SpiceCharDeviceInterface *sif;
vdagent = sin;
reds_update_mouse_mode();
if (!reds->peer) {
return;
}
- sif = SPICE_CONTAINEROF(vdagent->base.sif, SpiceVDIPortInterface, base);
+ sif = SPICE_CONTAINEROF(vdagent->base.sif, SpiceCharDeviceInterface, base);
state->connected = 1;
if (sif->state) {
sif->state(vdagent, state->connected);
@@ -3504,18 +3504,18 @@ __visible__ int spice_server_add_interface(SpiceServer *s,
}
snd_attach_record(SPICE_CONTAINEROF(sin, SpiceRecordInstance, base));
- } else if (strcmp(interface->type, SPICE_INTERFACE_VDI_PORT) == 0) {
- red_printf("SPICE_INTERFACE_VDI_PORT");
+ } else if (strcmp(interface->type, SPICE_INTERFACE_CHAR_DEVICE) == 0) {
+ red_printf("SPICE_INTERFACE_CHAR_DEVICE");
if (vdagent) {
red_printf("vdi port already attached");
return -1;
}
- if (interface->major_version != SPICE_INTERFACE_VDI_PORT_MAJOR ||
- interface->minor_version < SPICE_INTERFACE_VDI_PORT_MINOR) {
- red_printf("unsupported vdi port interface");
+ if (interface->major_version != SPICE_INTERFACE_CHAR_DEVICE_MAJOR ||
+ interface->minor_version < SPICE_INTERFACE_CHAR_DEVICE_MINOR) {
+ red_printf("unsupported char device interface");
return -1;
}
- attach_to_red_agent(SPICE_CONTAINEROF(sin, SpiceVDIPortInstance, base));
+ attach_to_red_agent(SPICE_CONTAINEROF(sin, SpiceCharDeviceInstance, base));
} else if (strcmp(interface->type, SPICE_INTERFACE_NET_WIRE) == 0) {
#ifdef USE_TUNNEL
@@ -3561,8 +3561,8 @@ __visible__ int spice_server_remove_interface(SpiceBaseInstance *sin)
red_printf("remove SPICE_INTERFACE_RECORD");
snd_detach_record(SPICE_CONTAINEROF(sin, SpiceRecordInstance, base));
- } else if (strcmp(interface->type, SPICE_INTERFACE_VDI_PORT) == 0) {
- red_printf("remove SPICE_INTERFACE_VDI_PORT");
+ } else if (strcmp(interface->type, SPICE_INTERFACE_CHAR_DEVICE) == 0) {
+ red_printf("remove SPICE_INTERFACE_CHAR_DEVICE");
if (sin == &vdagent->base) {
reds_agent_remove();
}
diff --git a/server/spice-experimental.h b/server/spice-experimental.h
index aede4ce..e40b3ec 100644
--- a/server/spice-experimental.h
+++ b/server/spice-experimental.h
@@ -1,26 +1,26 @@
-/* vdi port interface */
+/* char device interfaces */
-#define SPICE_INTERFACE_VDI_PORT "vdi_port"
-#define SPICE_INTERFACE_VDI_PORT_MAJOR 1
-#define SPICE_INTERFACE_VDI_PORT_MINOR 1
-typedef struct SpiceVDIPortInterface SpiceVDIPortInterface;
-typedef struct SpiceVDIPortInstance SpiceVDIPortInstance;
-typedef struct SpiceVDIPortState SpiceVDIPortState;
+#define SPICE_INTERFACE_CHAR_DEVICE "char_device"
+#define SPICE_INTERFACE_CHAR_DEVICE_MAJOR 1
+#define SPICE_INTERFACE_CHAR_DEVICE_MINOR 1
+typedef struct SpiceCharDeviceInterface SpiceCharDeviceInterface;
+typedef struct SpiceCharDeviceInstance SpiceCharDeviceInstance;
+typedef struct SpiceCharDeviceState SpiceCharDeviceState;
-struct SpiceVDIPortInterface {
+struct SpiceCharDeviceInterface {
SpiceBaseInterface base;
- void (*state)(SpiceVDIPortInstance *sin, int connected);
- int (*write)(SpiceVDIPortInstance *sin, const uint8_t *buf, int len);
- int (*read)(SpiceVDIPortInstance *sin, uint8_t *buf, int len);
+ void (*state)(SpiceCharDeviceInstance *sin, int connected);
+ int (*write)(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len);
+ int (*read)(SpiceCharDeviceInstance *sin, uint8_t *buf, int len);
};
-struct SpiceVDIPortInstance {
+struct SpiceCharDeviceInstance {
SpiceBaseInstance base;
- SpiceVDIPortState *st;
+ SpiceCharDeviceState *st;
};
-void spice_server_vdi_port_wakeup(SpiceVDIPortInstance *sin);
+void spice_server_char_device_wakeup(SpiceCharDeviceInstance *sin);
/* tunnel interface */
--
1.7.2
More information about the Spice-devel
mailing list