[libvirt] PATCH: 2/12: Make use of versioned linker scripts

Daniel P. Berrange berrange at redhat.com
Fri Nov 14 10:37:51 UTC 2008


On Thu, Nov 13, 2008 at 05:21:23PM +0000, Daniel P. Berrange wrote:
> This patch changes the way we use linker scripts to have fully versioned
> symbols, and a versioned private section for symbols needed by libvirtd
> and virsh.

If you look at the version script  below, you'll see that I've added
an explicit version section for each version in which we introduced
a symbol. Some people at Red Hat have suggested to me offlist that
this is overkil, and we could just have one section named 0.5.0
for all our existing symbols, and then just add new sections for 
each subsequent release. 

I kind of like the idea of representing all the releases in which
we added symbols, but functionally it doesn't matter which style
we pick for our existing symbols. Anyone else have an opinion ?

> diff -r bbf3d0bc9d49 src/libvirt_sym.version.in
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/src/libvirt_sym.version.in	Tue Nov 11 17:28:31 2008 +0000
> @@ -0,0 +1,318 @@
> +/*
> + * WARNING: libvirt_sym.version.in  is the master file
> + *
> + * WARNING: libvirt_sym.version is auto-generated by configure
> + */
> +
> +/*
> + * First officially exported symbols, for which header
> + * file definitions are installed in /usr/include/libvirt
> + * either from libvirt.h and virterror.h
> + *
> + * Versions here are *fixed* to match the libvirt version
> + * at which the symbol was introduced. This ensures that
> + * a new client app requiring symbol foo() can't accidentally
> + * run with old libvirt.so not providing foo() - the global
> + * soname version info can't enforce this since we never
> + * change the soname
> + */
> +LIBVIRT_0.0.3 {
> +    global:
> +	virConnectClose;
> +	virConnectGetType;
> +	virConnectGetVersion;
> +	virConnectListDomains;
> +	virConnectNumOfDomains;
> +	virConnectOpen;
> +	virConnectOpenReadOnly;
> +
> +	virDomainCreateLinux;
> +	virDomainDestroy;
> +	virDomainFree;
> +	virDomainGetID;
> +	virDomainGetInfo;
> +	virDomainGetMaxMemory;
> +	virDomainGetName;
> +	virDomainGetOSType;
> +	virDomainGetXMLDesc;
> +	virDomainLookupByID;
> +	virDomainLookupByName;
> +	virDomainRestore;
> +	virDomainResume;
> +	virDomainSave;
> +	virDomainSetMaxMemory;
> +	virDomainShutdown;
> +	virDomainSuspend;
> +
> +	virGetVersion;
> +};
> +
> +LIBVIRT_0.0.5 {
> +    global:
> +	virDomainLookupByUUID;
> +	virDomainGetUUID;
> +} LIBVIRT_0.0.3;
> +
> +LIBVIRT_0.1.0 {
> +    global:
> +	virInitialize;
> +	virNodeGetInfo;
> +	virDomainReboot;
> +
> +	virCopyLastError;
> +	virConnSetErrorFunc;
> +	virResetLastError;
> +	virErrorFunc;
> +	virResetError;
> +	virConnGetLastError;
> +	virGetLastError;
> +	virSetErrorFunc;
> +	virConnCopyLastError;
> +	virConnResetLastError;
> +	virDefaultErrorFunc;
> +} LIBVIRT_0.0.5;
> +
> +LIBVIRT_0.1.1 {
> +    global:
> +	virDomainLookupByUUIDString;
> +	virDomainGetUUIDString;
> +	virDomainSetMemory;
> +	virDomainDefineXML;
> +	virDomainCreate;
> +	virDomainUndefine;
> +	virConnectListDefinedDomains;
> +} LIBVIRT_0.1.0;
> +
> +LIBVIRT_0.1.4 {
> +    global:
> +	virDomainSetVcpus;
> +	virDomainPinVcpu;
> +	virDomainGetVcpus;
> +} LIBVIRT_0.1.1;
> +
> +LIBVIRT_0.1.5 {
> +    global:
> +	virConnectNumOfDefinedDomains;
> +} LIBVIRT_0.1.4;
> +
> +LIBVIRT_0.1.9 {
> +    global:
> +	virDomainCoreDump;
> +	virDomainAttachDevice;
> +	virDomainDetachDevice;
> +} LIBVIRT_0.1.5;
> +
> +LIBVIRT_0.2.0 {
> +    global:
> +	virConnectNumOfNetworks;
> +	virConnectListNetworks;
> +	virConnectNumOfDefinedNetworks;
> +	virConnectListDefinedNetworks;
> +	virNetworkLookupByName;
> +	virNetworkLookupByUUID;
> +	virNetworkLookupByUUIDString;
> +	virNetworkCreateXML;
> +	virNetworkDefineXML;
> +	virNetworkUndefine;
> +	virNetworkCreate;
> +	virNetworkDestroy;
> +	virNetworkFree;
> +	virNetworkGetName;
> +	virNetworkGetUUID;
> +	virNetworkGetUUIDString;
> +	virNetworkGetXMLDesc;
> +	virNetworkGetBridgeName;
> +} LIBVIRT_0.1.9;
> +
> +LIBVIRT_0.2.1 {
> +    global:
> +	virConnectGetCapabilities;
> +	virConnectGetMaxVcpus;
> +	virDomainGetMaxVcpus;
> +	virDomainGetAutostart;
> +	virDomainSetAutostart;
> +	virNetworkGetAutostart;
> +	virNetworkSetAutostart;
> +} LIBVIRT_0.2.0;
> +
> +LIBVIRT_0.2.3 {
> +    global:
> +	virDomainGetSchedulerType;
> +	virDomainGetSchedulerParameters;
> +	virDomainSetSchedulerParameters;
> +} LIBVIRT_0.2.1;
> +
> +LIBVIRT_0.3.0 {
> +    global:
> +	virConnectGetHostname;
> +	virConnectGetURI;
> +	virDomainGetConnect;
> +	virNetworkGetConnect;
> +} LIBVIRT_0.2.3;
> +
> +LIBVIRT_0.3.2 {
> +    global:
> +	virDomainMigrate;
> +	virDomainBlockStats;
> +	virDomainInterfaceStats;
> +} LIBVIRT_0.3.0;
> +
> +LIBVIRT_0.3.3 {
> +    global:
> +	virNodeGetCellsFreeMemory;
> +	virNodeGetFreeMemory;
> +} LIBVIRT_0.3.2;
> +
> +LIBVIRT_0.4.0 {
> +    global:
> +	virConnectOpenAuth;
> +	virConnectAuthPtrDefault;
> +} LIBVIRT_0.3.3;
> +
> +LIBVIRT_0.4.1 {
> +    global:
> +	virStoragePoolGetConnect;
> +	virConnectNumOfStoragePools;
> +	virConnectNumOfDefinedStoragePools;
> +	virConnectListStoragePools;
> +	virConnectListDefinedStoragePools;
> +	virStoragePoolLookupByName;
> +	virStoragePoolLookupByUUID;
> +	virStoragePoolLookupByUUIDString;
> +	virStoragePoolLookupByVolume;
> +	virStoragePoolCreateXML;
> +	virStoragePoolDefineXML;
> +	virStoragePoolUndefine;
> +	virStoragePoolCreate;
> +	virStoragePoolBuild;
> +	virStoragePoolDestroy;
> +	virStoragePoolDelete;
> +	virStoragePoolRefresh;
> +	virStoragePoolFree;
> +	virStoragePoolGetName;
> +	virStoragePoolGetUUID;
> +	virStoragePoolGetUUIDString;
> +	virStoragePoolGetInfo;
> +	virStoragePoolGetXMLDesc;
> +	virStoragePoolSetAutostart;
> +	virStoragePoolGetAutostart;
> +	virStoragePoolNumOfVolumes;
> +	virStoragePoolListVolumes;
> +
> +	virConnectNumOfStorageVolumes;
> +	virConnectListStorageVolumes;
> +	virStorageVolGetConnect;
> +	virStorageVolLookupByName;
> +	virStorageVolLookupByKey;
> +	virStorageVolLookupByPath;
> +	virStorageVolCreateXML;
> +	virStorageVolDelete;
> +	virStorageVolFree;
> +	virStorageVolGetName;
> +	virStorageVolGetKey;
> +	virStorageVolGetInfo;
> +	virStorageVolGetXMLDesc;
> +	virStorageVolGetPath;
> +} LIBVIRT_0.4.0;
> +
> +LIBVIRT_0.4.2 {
> +    global:
> +	virDomainBlockPeek;
> +	virDomainMemoryPeek;
> +} LIBVIRT_0.4.1;
> +
> +LIBVIRT_0.4.5 {
> +    global:
> +	virConnectFindStoragePoolSources;
> +} LIBVIRT_0.4.2;
> +
> +LIBVIRT_0.5.0 {
> +    global:
> +	virDomainCreateXML;
> +	virEventRegisterImpl;
> +	virConnectDomainEventRegister;
> +	virConnectDomainEventDeregister;
> +} LIBVIRT_0.4.5;
> +
> +/* .... define new API here using predicted next version number .... */
> +
> +
> +
> +
> +/*
> + * Finally these symbols are private and semantics may change
> + * on every release, hence the version number is spliced in at
> + * build time. This ensures that if libvirtd, virsh, or a driver
> + * module was built against one libvirt release, it will refuse
> + * to load with another where symbols may have same names but
> + * different semantics.
> + *
> + * No header files are provided outside the source tree.
> + *
> + * Keep this section ordered alphabetically by header file name
> + *
> + * Symbols here are only for use by virsh, libvirtd and dlopen
> + * driver modules
> + */
> +LIBVIRT_PRIVATE_ at VERSION@ {
> +
> +  global:
> +
> +	/* buf.h */
> +	virBufferVSprintf;
> +	virBufferAdd;
> +	virBufferAddChar;
> +	virBufferContentAndReset;
> +	virBufferError;
> +
> +
> +	/* conf.h */
> +	virConfNew;
> +	virConfReadFile;
> +	virConfReadMem;
> +	virConfFree;
> +	virConfGetValue;
> +	virConfSetValue;
> +	virConfWriteFile;
> +	virConfWriteMem;
> +
> +
> +	/* datatypes.h */
> +	virGetDomain;
> +	virGetNetwork;
> +	virGetStoragePool;
> +	virGetStorageVol;
> +
> +
> +	/* libvirt_internal.h */
> +	virStateInitialize;
> +	virStateCleanup;
> +	virStateReload;
> +	virStateActive;
> +	virStateSigDispatcher;
> +	virDrvSupportsFeature;
> +	virDomainMigratePrepare;
> +	virDomainMigratePerform;
> +	virDomainMigrateFinish;
> +
> +
> +	/* memory.h */
> +	virAlloc;
> +	virAllocN;
> +	virReallocN;
> +	virFree;
> +
> +
> +	/* util.h */
> +	virFileReadAll;
> +	virStrToLong_i;
> +	virStrToLong_ull;
> +	saferead;
> +	safewrite;
> +	virMacAddrCompare;
> +
> +
> +	/* Finally everything else is totally private */
> +    local:
> +	*;
> +};

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list