[Spice-devel] [PATCH v6 14/14] UsbDeviceManager: Make synchronous disconnect method static

Jonathon Jongsma jjongsma at redhat.com
Tue Mar 1 20:20:52 UTC 2016


I apologize for not responding to your questions about deprecation earlier.

Basically, if you look at spice-channel.h you can see an example of how to
deprecate this function instead of removing it from the API. Basically:

#ifndef SPICE_DISABLE_DEPRECATED
SPICE_DEPRECATED
void spice_channel_set_capability(SpiceChannel *channel, guint32 cap);
SPICE_DEPRECATED
void spice_channel_destroy(SpiceChannel *channel);
#endif

The function will still need to be listed in the map-file though.


On Sun, 2016-02-28 at 11:54 +0200, Dmitry Fleytman wrote:
> From: Dmitry Fleytman <dfleytma at redhat.com>
> 
> Synchronous disconnection is not a part of public interface anymore.
> 
> Signed-off-by: Dmitry Fleytman <dfleytma at redhat.com>
> ---
>  src/map-file             |  1 -
>  src/usb-device-manager.c | 15 ++++++++-------
>  src/usb-device-manager.h |  3 ---
>  3 files changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/src/map-file b/src/map-file
> index b9ba950..04442c8 100644
> --- a/src/map-file
> +++ b/src/map-file
> @@ -126,7 +126,6 @@ spice_usb_device_get_type;
>  spice_usb_device_manager_can_redirect_device;
>  spice_usb_device_manager_connect_device_async;
>  spice_usb_device_manager_connect_device_finish;
> -spice_usb_device_manager_disconnect_device;
>  spice_usb_device_manager_disconnect_device_async;
>  spice_usb_device_manager_is_redirecting;
>  spice_usb_device_manager_get;
> diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
> index c51cdba..6a665e7 100644
> --- a/src/usb-device-manager.c
> +++ b/src/usb-device-manager.c
> @@ -214,6 +214,9 @@ void _connect_device_async_cb(GObject *gobject,
>                                GAsyncResult *channel_res,
>                                gpointer user_data);
>  
> +static void
> +_disconnect_device(SpiceUsbDeviceManager *self, SpiceUsbDevice *device);
> +
>  G_DEFINE_BOXED_TYPE(SpiceUsbDevice, spice_usb_device,
>                      (GBoxedCopyFunc)spice_usb_device_ref,
>                      (GBoxedFreeFunc)spice_usb_device_unref)
> @@ -992,7 +995,7 @@ static void
> spice_usb_device_manager_remove_dev(SpiceUsbDeviceManager *self,
>      }
>  #endif
>  
> -    spice_usb_device_manager_disconnect_device(self, device);
> +    _disconnect_device(self, device);
>  
>      SPICE_DEBUG("device removed %04x:%04x (%p)",
>                  spice_usb_device_get_vid(device),
> @@ -1694,10 +1697,9 @@ void _connect_device_async_cb(GObject *gobject,
>      g_simple_async_result_complete(result);
>      g_object_unref(result);
>  }
> -#endif
>  
>  /**
> - * spice_usb_device_manager_disconnect_device:
> + * _disconnect_device:
>   * @manager: the #SpiceUsbDeviceManager manager
>   * @device: a #SpiceUsbDevice to disconnect
>   *
> @@ -1705,15 +1707,14 @@ void _connect_device_async_cb(GObject *gobject,
>   *
>   * Returns: %TRUE if @device has an associated USB redirection channel
>   */
> -void spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *self,
> -                                                SpiceUsbDevice *device)
> +static void
> +_disconnect_device(SpiceUsbDeviceManager *self, SpiceUsbDevice *device)
>  {
>      g_return_if_fail(SPICE_IS_USB_DEVICE_MANAGER(self));
>      g_return_if_fail(device != NULL);
>  
>      SPICE_DEBUG("disconnecting device %p", device);
>  
> -#ifdef USE_USBREDIR
>      SpiceUsbredirChannel *channel;
>  
>      channel = spice_usb_device_manager_get_channel_for_dev(self, device);
> @@ -1724,9 +1725,9 @@ void
> spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *self,
>      if(self->priv->use_usbclerk)
>          _spice_usb_device_manager_uninstall_driver_async(self, device);
>  #endif
> +}
>  
>  #endif
> -}
>  
>  typedef struct _disconnect_cb_data
>  {
> diff --git a/src/usb-device-manager.h b/src/usb-device-manager.h
> index 814af2e..978f4a0 100644
> --- a/src/usb-device-manager.h
> +++ b/src/usb-device-manager.h
> @@ -127,9 +127,6 @@ void spice_usb_device_manager_disconnect_device_async(
>  gboolean spice_usb_device_manager_connect_device_finish(
>      SpiceUsbDeviceManager *self, GAsyncResult *res, GError **err);
>  
> -void spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager
> *manager,
> -                                                SpiceUsbDevice *device);
> -
>  gboolean
>  spice_usb_device_manager_can_redirect_device(SpiceUsbDeviceManager  *self,
>                                               SpiceUsbDevice         *device,


Reviewed-by: Jonathon Jongsma <jjongsma at redhat.com>


More information about the Spice-devel mailing list