[Spice-devel] [spice-gtk 9/9] usb-redir: enable redirection of emulated CD drive
Frediano Ziglio
fziglio at redhat.com
Fri Jul 26 15:51:40 UTC 2019
> On Fri, Jul 26, 2019 at 4:17 PM Frediano Ziglio <fziglio at redhat.com> wrote:
> >
> > >
> > > Register constructor for emulated CD device. Now creation
> > > of CD devices at startup is possible.
> > >
> > > Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com>
> > > ---
> > > src/meson.build | 6 ++++++
> > > src/usb-backend.c | 1 +
> > > 2 files changed, 7 insertions(+)
> > >
> > > diff --git a/src/meson.build b/src/meson.build
> > > index 49fec52..944b083 100644
> > > --- a/src/meson.build
> > > +++ b/src/meson.build
> > > @@ -124,6 +124,12 @@ spice_client_glib_sources = [
> > > 'usb-backend.c',
> > > 'usb-emulation.h',
> > > 'usb-backend.h',
> > > + 'usb-device-cd.c',
> > > + 'cd-scsi.c',
> > > + 'cd-scsi.h',
> > > + 'cd-scsi-dev-params.h',
> > > + 'cd-usb-bulk-msd.c',
> > > + 'cd-usb-bulk-msd.h',
> > > 'vmcstream.c',
> > > 'vmcstream.h',
> > > ]
> >
> > I would split this part of the patch and add the files to the
> > build as soon as they are added so to check that at least they
> > compiler, even if they are not used.
>
> No problem
>
> >
> > > diff --git a/src/usb-backend.c b/src/usb-backend.c
> > > index 02369d2..760dc16 100644
> > > --- a/src/usb-backend.c
> > > +++ b/src/usb-backend.c
> > > @@ -432,6 +432,7 @@ SpiceUsbBackend *spice_usb_backend_new(GError
> > > **error)
> > > #endif
> > > #endif
> > > be->own_devices_mask = 3; /* exclude addresses 0 and 1 */
> > > + spice_usb_device_register_cd(be);
> > > }
> > > SPICE_DEBUG("%s <<", __FUNCTION__);
> > > return be;
> >
> > This is adding a circular dependency.
> > usb-backend will depend on usb-device-cd which depends on usb-backend.
>
> I am not aware of deprecation of circular dependency between C files.
> For example, last time I was requested by Victor to create such
> dependency between usb-redir-channel and usb-backend.
>
Not specifically referring to link issue, I'm talking about Design Patterns,
Dependency Inversion Principle and such stuff.
If you like spaghetti code circular dependency is perfectly fine.
Frediano
More information about the Spice-devel
mailing list