[Spice-commits] 3 commits - server/reds.c server/red_worker.c server/smartcard.c
Alon Levy
alon at kemper.freedesktop.org
Tue Jul 5 05:04:51 PDT 2011
server/red_worker.c | 12 ------------
server/reds.c | 4 ----
server/smartcard.c | 10 +++++++---
3 files changed, 7 insertions(+), 19 deletions(-)
New commits:
commit 8b5be0609f5226234aaefdb9197b2e189b1a0339
Author: Alon Levy <alevy at redhat.com>
Date: Wed Jun 29 14:13:16 2011 +0200
server/smartcard: register channel only when hardware is available
diff --git a/server/reds.c b/server/reds.c
index d01c104..eb9c32a 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3522,10 +3522,6 @@ static int do_spice_init(SpiceCoreInterface *core_interface)
reds->main_channel = NULL;
inputs_init();
-#ifdef USE_SMARTCARD
- smartcard_channel_init();
-#endif
-
reds->mouse_mode = SPICE_MOUSE_MODE_SERVER;
atexit(reds_exit);
return 0;
diff --git a/server/smartcard.c b/server/smartcard.c
index f948e5b..49bf3cb 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -81,6 +81,7 @@ static void smartcard_on_message_from_device(
SmartCardChannel *smartcard_channel, VSCMsgHeader *vheader);
static SmartCardDeviceState* smartcard_device_state_new();
static void smartcard_device_state_free(SmartCardDeviceState* st);
+static void smartcard_register_channel(void);
void smartcard_char_device_wakeup(SpiceCharDeviceInstance *sin)
{
@@ -166,6 +167,7 @@ static int smartcard_char_device_add_to_readers(SpiceCharDeviceInstance *char_de
}
state->reader_id = g_smartcard_readers.num;
g_smartcard_readers.sin[g_smartcard_readers.num++] = char_device;
+ smartcard_register_channel();
return 0;
}
@@ -534,10 +536,16 @@ static void smartcard_migrate(Channel *channel)
{
}
-void smartcard_channel_init(void)
+static void smartcard_register_channel(void)
{
Channel *channel;
+ static int registered = 0;
+ if (registered) {
+ return;
+ }
+ red_printf("registering smartcard channel");
+ registered = 1;
channel = spice_new0(Channel, 1);
channel->type = SPICE_CHANNEL_SMARTCARD;
channel->link = smartcard_link;
@@ -545,4 +553,3 @@ void smartcard_channel_init(void)
channel->migrate = smartcard_migrate;
reds_register_channel(channel);
}
-
commit 392bb921dc985baf748dead1c29a93ae808aed4f
Author: Alon Levy <alevy at redhat.com>
Date: Wed Jun 29 12:06:51 2011 +0200
Revert "server/smartcard: don't register the channel if no hardware emulated"
This reverts commit 456ff9f8d5d27ac763e89e67a100661084695dc5.
That patch just disabled the smartcard channel completely because
the check was done *before* the initialization of the qemu smartcard
devices, not after.
diff --git a/server/smartcard.c b/server/smartcard.c
index 7830c9a..f948e5b 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -538,10 +538,6 @@ void smartcard_channel_init(void)
{
Channel *channel;
- /* don't register the channel if no hardware registered */
- if (g_smartcard_readers.num == 0) {
- return;
- }
channel = spice_new0(Channel, 1);
channel->type = SPICE_CHANNEL_SMARTCARD;
channel->link = smartcard_link;
@@ -549,3 +545,4 @@ void smartcard_channel_init(void)
channel->migrate = smartcard_migrate;
reds_register_channel(channel);
}
+
commit 5ff78b617da31d4b28f22293e4d82772576758ac
Author: Christophe Fergeau <cfergeau at redhat.com>
Date: Tue Jun 28 13:18:02 2011 +0200
red_worker: remove 2 empty functions
red_worker was using some share/unshare stream_buf functions whose
body is empty. This commit removes them and their use.
diff --git a/server/red_worker.c b/server/red_worker.c
index bee86b9..577dee2 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -7309,14 +7309,6 @@ static inline uint8_t *red_get_image_line(RedWorker *worker, SpiceChunks *chunks
return ret;
}
-static void red_display_share_stream_buf(DisplayChannel *display_channel)
-{
-}
-
-static void red_display_unshare_stream_buf(DisplayChannel *display_channel)
-{
-}
-
static int red_rgb32bpp_to_24 (RedWorker *worker, const SpiceRect *src,
const SpiceBitmap *image,
uint8_t *frame, size_t frame_stride,
@@ -7526,11 +7518,9 @@ static inline int red_send_stream_data(DisplayChannel *display_channel,
new_size = display_channel->send_data.stream_outbuf_size * 2;
new_buf = spice_malloc(new_size);
- red_display_unshare_stream_buf(display_channel);
free(display_channel->send_data.stream_outbuf);
display_channel->send_data.stream_outbuf = new_buf;
display_channel->send_data.stream_outbuf_size = new_size;
- red_display_share_stream_buf(display_channel);
}
red_channel_init_send_data(channel, SPICE_MSG_DISPLAY_STREAM_DATA, NULL);
@@ -8282,7 +8272,6 @@ static void red_disconnect_display(RedChannel *channel)
print_compress_stats(display_channel);
#endif
worker->display_channel = NULL;
- red_display_unshare_stream_buf(display_channel);
red_release_pixmap_cache(display_channel);
red_release_glz(display_channel);
red_reset_palette_cache(display_channel);
@@ -9185,7 +9174,6 @@ static void handle_new_display_channel(RedWorker *worker, RedsStream *stream, in
stream_buf_size = 32*1024;
display_channel->send_data.stream_outbuf = spice_malloc(stream_buf_size);
display_channel->send_data.stream_outbuf_size = stream_buf_size;
- red_display_share_stream_buf(display_channel);
red_display_init_glz_data(display_channel);
worker->display_channel = display_channel;
More information about the Spice-commits
mailing list