summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@redhat.com>2015-01-16 14:58:55 -0600
committerFabiano FidĂȘncio <fidencio@redhat.com>2015-02-23 23:00:42 +0100
commit976a6baeba782eab6c8d8f47229dae4251581a5d (patch)
treedcb1240bf8871bd02e43bfbcb87b9d0ad89b642a
parent31eef48361e9bd2a937fb82c14baf6924e4c9d6f (diff)
downloadspice-976a6baeba782eab6c8d8f47229dae4251581a5d.tar.gz
spice-976a6baeba782eab6c8d8f47229dae4251581a5d.tar.xz
spice-976a6baeba782eab6c8d8f47229dae4251581a5d.zip
Pass 'reds' as opaque data in vdi port char device
This allows us to access the RedsState variable non-globally without changing the signature of the callback functions.
-rw-r--r--server/reds.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/server/reds.c b/server/reds.c
index 6a18a557..0b6edd2e 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -680,6 +680,7 @@ static void vdi_port_read_buf_unref(RedsState *reds, VDIReadBuf *buf)
static SpiceCharDeviceMsgToClient *vdi_port_read_one_msg_from_device(SpiceCharDeviceInstance *sin,
void *opaque)
{
+ RedsState *reds = opaque;
VDIPortState *state = &reds->agent_state;
SpiceCharDeviceInterface *sif;
VDIReadBuf *dispatch_buf;
@@ -752,6 +753,7 @@ static SpiceCharDeviceMsgToClient *vdi_port_ref_msg_to_client(SpiceCharDeviceMsg
static void vdi_port_unref_msg_to_client(SpiceCharDeviceMsgToClient *msg,
void *opaque)
{
+ RedsState *reds = opaque;
vdi_port_read_buf_unref(reds, msg);
}
@@ -2865,7 +2867,7 @@ static SpiceCharDeviceState *attach_to_red_agent(SpiceCharDeviceInstance *sin)
REDS_TOKENS_TO_SEND,
REDS_NUM_INTERNAL_AGENT_MESSAGES,
&char_dev_state_cbs,
- NULL);
+ reds);
} else {
spice_char_device_state_reset_dev_instance(state->base, sin);
}