[Spice-devel] [RFC 1/2] spice, server: introduce SpiceCharDevice

Alexander Larsson alexl at redhat.com
Thu Aug 26 06:33:05 PDT 2010


On Wed, 2010-08-25 at 11:19 -0400, Alon Levy wrote:
> ----- "Alexander Larsson" <alexl at redhat.com> wrote:
> > > +    const char* (*subtype)(SpiceCharDeviceInstance *sin);
> > 
> > I don't think we need a callback here. Just make this a const char *.
> > 
> 
> No, that doesn't work - the subtype is not a feature of the interface, it's a feature
> of the specific instance:
> 
> typedef struct SpiceVirtualChannel {
>     VirtIOSerialPort      port;
>     VMChangeStateEntry    *vmstate;
>     SpiceCharDeviceInstance  sin;
> ...
> }
> 
> and then:
> 
> static const char* vmc_subtype(SpiceCharDeviceInstance* sin)
> {
>     SpiceVirtualChannel *scd = container_of(sin, SpiceVirtualChannel, sin);
> 
>     dprintf(scd, 2, "%s\n", __func__);
>     return scd->subtype;
> }

I see. So, make the const char *subtype member be a member of
SpiceCharDeviceInstance then. Just like "int id" is in QXLInstance.



More information about the Spice-devel mailing list