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

Frediano Ziglio fziglio at redhat.com
Tue Dec 10 10:54:26 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?

I was thinking something more "strong", like removing it entirely,
see https://gitlab.freedesktop.org/fziglio/spice-gtk/commits/no_bdev
(last 3 commits).

Frediano



More information about the Spice-devel mailing list