On 07/01/11 15:58, 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));
}
That looks bogous.
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.
Indeed.
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?
No. The purpose of the versions is exactly to avoid the need for a new
soname. The rules are basically:
(1) You add stuff to the interface, strictly append-only to not break
binary compatibility.
(2) You bump the minor version of the interface.
(3) You check the minor version at runtime to figure whenever the
added fields contain valid stuff or not.
An example is here (core interface, minor goes from 2 to 3, new
channel_event callback):
http://cgit.freedesktop.org/spice/spice/commit/?id=97f33fa86aa6edd25111b173dc0d9599ac29f879
cheers,
Gerd
_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel