[Spice-devel] [PATCH 2/9] add spice_usb_device_manager shared CD related api functions

Alexander Nezhinsky anezhins at redhat.com
Mon Dec 9 17:02:40 UTC 2019


On Sat, Dec 7, 2019 at 12:20 PM Alexander Nezhinsky <anezhins at redhat.com>
wrote:

>
> On Fri, Dec 6, 2019 at 12:04 PM Frediano Ziglio <fziglio at redhat.com>
> wrote:
>
> > +    bdev = spice_usb_device_manager_device_to_bdev(self, device);
>>
>> see below
>>
>> > +#ifdef USE_USBREDIR
>> > +    SpiceUsbBackendDevice *bdev;
>> > +    gboolean is_cd;
>> > +
>> > +    bdev = spice_usb_device_manager_device_to_bdev(self, device);
>>
>> Note that SpiceUsbBackendDevice is defined as
>>
>>     typedef struct _SpiceUsbDevice SpiceUsbBackendDevice;
>>
>> no need to call this function.
>>
>> I agree with Yuri. This is the current practice in all API functions.
> We can rework it everywhere, or leave it as is.
>
>
I looked at it just an inch deeper and saw that the function
spice_usb_device_manager_device_to_bdev actually increments the reference
of the device object.
So it seems to be necessary and the change would require rework of some
further logic, i guess.
In view of the fact that the struct is the same, we could change the name
of the functions to reflect the refcounting, like:
spice_usb_device_manager_get_bdev_device() or just
spice_usb_device_manager_get_device()
What do you think?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20191209/6f4ada7b/attachment.html>


More information about the Spice-devel mailing list