[Spice-commits] server/char-device.c server/char-device.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Dec 19 12:33:05 UTC 2019


 server/char-device.c |    5 +++++
 server/char-device.h |    2 ++
 2 files changed, 7 insertions(+)

New commits:
commit 8ec691f056d633aea31028810b91aa8a4b60f18d
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Sat Feb 9 10:29:41 2019 +0000

    char-device: Allow to more safely and quickly get device instance
    
    This information is retrieved multiple time.
    Avoid to use just g_object_get which is dynamic so potentially
    unsafe and slow.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/char-device.c b/server/char-device.c
index 5c6f583b..0b7def3e 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -1164,6 +1164,11 @@ SPICE_GNUC_VISIBLE void spice_server_port_event(SpiceCharDeviceInstance *sin, ui
     return klass->port_event(sin->st, event);
 }
 
+SpiceCharDeviceInstance *red_char_device_get_device_instance(RedCharDevice *dev)
+{
+    return dev->priv->sin;
+}
+
 static void
 red_char_device_init(RedCharDevice *self)
 {
diff --git a/server/char-device.h b/server/char-device.h
index 0a87045b..830ca456 100644
--- a/server/char-device.h
+++ b/server/char-device.h
@@ -243,6 +243,8 @@ RedCharDevice *spicevmc_device_connect(RedsState *reds,
                                        uint8_t channel_type);
 void spicevmc_device_disconnect(SpiceCharDeviceInstance *char_device);
 
+SpiceCharDeviceInstance *red_char_device_get_device_instance(RedCharDevice *dev);
+
 SpiceCharDeviceInterface *spice_char_device_get_interface(SpiceCharDeviceInstance *instance);
 
 #endif /* CHAR_DEVICE_H_ */


More information about the Spice-commits mailing list