[Spice-devel] Purpose of interface version checks in server/reds.c

Alon Levy alevy at redhat.com
Fri Jul 1 08:17:27 PDT 2011


On Fri, Jul 01, 2011 at 03:58:01PM +0200, Christophe Fergeau wrote:
> Hi,
> 
> While looking at a crash in qemu when SPICE_INTERFACE_PLAYBACK_MINOR was
> increased, I came across the version checking code in spice_server_add_interface
> in server/reds.c which does stuff like
> 
> if (strcmp(interface->type, SPICE_INTERFACE_RECORD) == 0) {
>     red_printf("SPICE_INTERFACE_RECORD");
>     if (interface->major_version != SPICE_INTERFACE_RECORD_MAJOR ||
>         interface->minor_version < SPICE_INTERFACE_RECORD_MINOR) {
>         red_printf("unsupported record interface");
>         return -1;
>     }
>     snd_attach_record(SPICE_CONTAINEROF(sin, SpiceRecordInstance, base));
> }
> 
> interface->major_version/interface->minor_version are filled in
> qemu/audio/spiceaudio.c using compile time constants from spice-server.
> It seems to be useful to detect when qemu was compiled against an older
> spice-server than the one that is currently installed.
> I'm a bit surprised by this mechanism, if we break these interfaces in such
> a way that qemu needs to be recompiled, shouldn't we use different library
> sonames to make sure things are recompiled?
How would you do that? have an soname that includes all the various interfaces?
or just the version number and change that whenever one of those (record/playback/qxl/etc.)
interfaces are changed? To be honest I'm not sure how one changes the soname anyway. (I guess
there is some linker switch).

> 
> I'm basically curious about exactly what problem is this mechanism solving
> so that I don't break it by mistake :)
> 
> Thanks,
> 
> Christophe



> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel



More information about the Spice-devel mailing list