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. Daniel diff -r bbf3d0bc9d49 configure.in --- a/configure.in Tue Nov 11 17:28:27 2008 +0000 +++ b/configure.in Tue Nov 11 17:28:31 2008 +0000 @@ -1076,6 +1076,7 @@ gnulib/lib/Makefile \ gnulib/tests/Makefile \ libvirt.pc libvirt.spec mingw32-libvirt.spec \ + src/libvirt_sym.version \ po/Makefile.in \ include/libvirt/Makefile include/libvirt/libvirt.h \ python/Makefile python/tests/Makefile \ diff -r bbf3d0bc9d49 qemud/Makefile.am --- a/qemud/Makefile.am Tue Nov 11 17:28:27 2008 +0000 +++ b/qemud/Makefile.am Tue Nov 11 17:28:31 2008 +0000 @@ -7,8 +7,7 @@ remote_dispatch_prototypes.h \ remote_dispatch_localvars.h \ remote_dispatch_proc_switch.h \ - remote_protocol.h remote_protocol.c \ - $(srcdir)/../src/util-lib.c + remote_protocol.h remote_protocol.c AVAHI_SOURCES = \ mdns.c mdns.h diff -r bbf3d0bc9d49 qemud/remote.c --- a/qemud/remote.c Tue Nov 11 17:28:27 2008 +0000 +++ b/qemud/remote.c Tue Nov 11 17:28:31 2008 +0000 @@ -487,7 +487,7 @@ { CHECK_CONN(client); - ret->supported = __virDrvSupportsFeature (client->conn, args->feature); + ret->supported = virDrvSupportsFeature (client->conn, args->feature); if (ret->supported == -1) return -1; return 0; @@ -1396,9 +1396,9 @@ return -2; } - r = __virDomainMigratePrepare (client->conn, &cookie, &cookielen, - uri_in, uri_out, - args->flags, dname, args->resource); + r = virDomainMigratePrepare (client->conn, &cookie, &cookielen, + uri_in, uri_out, + args->flags, dname, args->resource); if (r == -1) { VIR_FREE(uri_out); return -1; @@ -1439,11 +1439,11 @@ dname = args->dname == NULL ? NULL : *args->dname; - r = __virDomainMigratePerform (dom, - args->cookie.cookie_val, - args->cookie.cookie_len, - args->uri, - args->flags, dname, args->resource); + r = virDomainMigratePerform (dom, + args->cookie.cookie_val, + args->cookie.cookie_len, + args->uri, + args->flags, dname, args->resource); virDomainFree (dom); if (r == -1) return -1; @@ -1460,11 +1460,11 @@ virDomainPtr ddom; CHECK_CONN (client); - ddom = __virDomainMigrateFinish (client->conn, args->dname, - args->cookie.cookie_val, - args->cookie.cookie_len, - args->uri, - args->flags); + ddom = virDomainMigrateFinish (client->conn, args->dname, + args->cookie.cookie_val, + args->cookie.cookie_len, + args->uri, + args->flags); if (ddom == NULL) return -1; make_nonnull_domain (&ret->ddom, ddom); diff -r bbf3d0bc9d49 src/Makefile.am --- a/src/Makefile.am Tue Nov 11 17:28:27 2008 +0000 +++ b/src/Makefile.am Tue Nov 11 17:28:31 2008 +0000 @@ -285,7 +285,6 @@ virsh_SOURCES = \ console.c console.h \ - util-lib.c util-lib.h \ virsh.c virsh_LDFLAGS = $(WARN_CFLAGS) $(COVERAGE_LDFLAGS) diff -r bbf3d0bc9d49 src/buf.c --- a/src/buf.c Tue Nov 11 17:28:27 2008 +0000 +++ b/src/buf.c Tue Nov 11 17:28:31 2008 +0000 @@ -88,7 +88,7 @@ * */ void -__virBufferAdd(const virBufferPtr buf, const char *str, int len) +virBufferAdd(const virBufferPtr buf, const char *str, int len) { unsigned int needSize; @@ -120,7 +120,7 @@ * */ void -__virBufferAddChar (virBufferPtr buf, char c) +virBufferAddChar (virBufferPtr buf, char c) { unsigned int needSize; @@ -150,7 +150,7 @@ * Returns the buffer content or NULL in case of error. */ char * -__virBufferContentAndReset(const virBufferPtr buf) +virBufferContentAndReset(const virBufferPtr buf) { char *str; if (buf == NULL) @@ -176,7 +176,7 @@ * Return true if in error, 0 if normal */ int -__virBufferError(const virBufferPtr buf) +virBufferError(const virBufferPtr buf) { if (buf == NULL) return 1; @@ -208,7 +208,7 @@ * Do a formatted print to an XML buffer. */ void -__virBufferVSprintf(const virBufferPtr buf, const char *format, ...) +virBufferVSprintf(const virBufferPtr buf, const char *format, ...) { int size, count, grow_size; va_list locarg, argptr; diff -r bbf3d0bc9d49 src/buf.h --- a/src/buf.h Tue Nov 11 17:28:27 2008 +0000 +++ b/src/buf.h Tue Nov 11 17:28:31 2008 +0000 @@ -34,25 +34,18 @@ }; #endif -char *__virBufferContentAndReset(const virBufferPtr buf); -int __virBufferError(const virBufferPtr buf); +char *virBufferContentAndReset(const virBufferPtr buf); +int virBufferError(const virBufferPtr buf); unsigned int virBufferUse(const virBufferPtr buf); -void __virBufferAdd(const virBufferPtr buf, const char *str, int len); -void __virBufferAddChar(const virBufferPtr buf, char c); -void __virBufferVSprintf(const virBufferPtr buf, const char *format, ...) +void virBufferAdd(const virBufferPtr buf, const char *str, int len); +void virBufferAddChar(const virBufferPtr buf, char c); +void virBufferVSprintf(const virBufferPtr buf, const char *format, ...) ATTRIBUTE_FORMAT(printf, 2, 3); void virBufferStrcat(const virBufferPtr buf, ...); void virBufferEscapeString(const virBufferPtr buf, const char *format, const char *str); void virBufferURIEncodeString (const virBufferPtr buf, const char *str); #define virBufferAddLit(buf_, literal_string_) \ - __virBufferAdd (buf_, "" literal_string_ "", sizeof literal_string_ - 1) - -#define virBufferAdd(b,s,l) __virBufferAdd((b),(s),(l)) -#define virBufferAddChar(b,c) __virBufferAddChar((b),(c)) -#define virBufferVSprintf(b,f,...) __virBufferVSprintf((b),(f), __VA_ARGS__) - -#define virBufferContentAndReset(b) __virBufferContentAndReset((b)) -#define virBufferError(b) __virBufferError((b)) + virBufferAdd (buf_, "" literal_string_ "", sizeof literal_string_ - 1) #endif /* __VIR_BUFFER_H__ */ diff -r bbf3d0bc9d49 src/conf.c --- a/src/conf.c Tue Nov 11 17:28:27 2008 +0000 +++ b/src/conf.c Tue Nov 11 17:28:31 2008 +0000 @@ -142,7 +142,7 @@ * Free a value */ void -__virConfFreeValue(virConfValuePtr val) +virConfFreeValue(virConfValuePtr val) { if (val == NULL) return; @@ -156,7 +156,7 @@ } virConfPtr -__virConfNew(void) +virConfNew(void) { virConfPtr ret; @@ -691,7 +691,7 @@ #define MAX_CONFIG_FILE_SIZE (1024*1024*10) /** - * __virConfReadFile: + * virConfReadFile: * @filename: the path to the configuration file. * * Reads a configuration file. @@ -700,7 +700,7 @@ * read or parse the file, use virConfFree() to free the data. */ virConfPtr -__virConfReadFile(const char *filename) +virConfReadFile(const char *filename) { char *content; int len; @@ -724,7 +724,7 @@ } /** - * __virConfReadMem: + * virConfReadMem: * @memory: pointer to the content of the configuration file * @len: length in byte * @@ -735,7 +735,7 @@ * parse the content, use virConfFree() to free the data. */ virConfPtr -__virConfReadMem(const char *memory, int len) +virConfReadMem(const char *memory, int len) { if ((memory == NULL) || (len < 0)) { virConfError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__); @@ -748,7 +748,7 @@ } /** - * __virConfFree: + * virConfFree: * @conf: a configuration file handle * * Frees all data associated to the handle @@ -756,7 +756,7 @@ * Returns 0 in case of success, -1 in case of error. */ int -__virConfFree(virConfPtr conf) +virConfFree(virConfPtr conf) { virConfEntryPtr tmp; if (conf == NULL) { @@ -779,7 +779,7 @@ } /** - * __virConfGetValue: + * virConfGetValue: * @conf: a configuration file handle * @entry: the name of the entry * @@ -789,7 +789,7 @@ * associated will be freed when virConfFree() is called */ virConfValuePtr -__virConfGetValue(virConfPtr conf, const char *setting) +virConfGetValue(virConfPtr conf, const char *setting) { virConfEntryPtr cur; @@ -803,7 +803,7 @@ } /** - * __virConfSetValue: + * virConfSetValue: * @conf: a configuration file handle * @entry: the name of the entry * @value: the new configuration value @@ -816,9 +816,9 @@ * Returns 0 on success, or -1 on failure. */ int -__virConfSetValue (virConfPtr conf, - const char *setting, - virConfValuePtr value) +virConfSetValue (virConfPtr conf, + const char *setting, + virConfValuePtr value) { virConfEntryPtr cur, prev = NULL; @@ -861,7 +861,7 @@ /** - * __virConfWriteFile: + * virConfWriteFile: * @filename: the path to the configuration file. * @conf: the conf * @@ -870,7 +870,7 @@ * Returns the number of bytes written or -1 in case of error. */ int -__virConfWriteFile(const char *filename, virConfPtr conf) +virConfWriteFile(const char *filename, virConfPtr conf) { virBuffer buf = VIR_BUFFER_INITIALIZER; virConfEntryPtr cur; @@ -915,7 +915,7 @@ } /** - * __virConfWriteMem: + * virConfWriteMem: * @memory: pointer to the memory to store the config file * @len: pointer to the length in bytes of the store, on output the size * @conf: the conf @@ -928,7 +928,7 @@ * Returns the number of bytes written or -1 in case of error. */ int -__virConfWriteMem(char *memory, int *len, virConfPtr conf) +virConfWriteMem(char *memory, int *len, virConfPtr conf) { virBuffer buf = VIR_BUFFER_INITIALIZER; virConfEntryPtr cur; diff -r bbf3d0bc9d49 src/conf.h --- a/src/conf.h Tue Nov 11 17:28:27 2008 +0000 +++ b/src/conf.h Tue Nov 11 17:28:31 2008 +0000 @@ -61,32 +61,22 @@ typedef struct _virConf virConf; typedef virConf *virConfPtr; -virConfPtr __virConfNew (void); -virConfPtr __virConfReadFile (const char *filename); -virConfPtr __virConfReadMem (const char *memory, +virConfPtr virConfNew (void); +virConfPtr virConfReadFile (const char *filename); +virConfPtr virConfReadMem (const char *memory, int len); -int __virConfFree (virConfPtr conf); -void __virConfFreeValue (virConfValuePtr val); +int virConfFree (virConfPtr conf); +void virConfFreeValue (virConfValuePtr val); -virConfValuePtr __virConfGetValue (virConfPtr conf, +virConfValuePtr virConfGetValue (virConfPtr conf, const char *setting); -int __virConfSetValue (virConfPtr conf, +int virConfSetValue (virConfPtr conf, const char *setting, virConfValuePtr value); -int __virConfWriteFile (const char *filename, +int virConfWriteFile (const char *filename, virConfPtr conf); -int __virConfWriteMem (char *memory, +int virConfWriteMem (char *memory, int *len, virConfPtr conf); -#define virConfNew() __virConfNew() -#define virConfReadFile(f) __virConfReadFile((f)) -#define virConfReadMem(m,l) __virConfReadMem((m),(l)) -#define virConfFree(c) __virConfFree((c)) -#define virConfFreeValue(v) __virConfFreeValue((v)) -#define virConfGetValue(c,s) __virConfGetValue((c),(s)) -#define virConfSetValue(c,s,v) __virConfSetValue((c),(s),(v)) -#define virConfWriteFile(f,c) __virConfWriteFile((f),(c)) -#define virConfWriteMem(m,l,c) __virConfWriteMem((m),(l),(c)) - #endif /* __VIR_CONF_H__ */ diff -r bbf3d0bc9d49 src/console.c --- a/src/console.c Tue Nov 11 17:28:27 2008 +0000 +++ b/src/console.c Tue Nov 11 17:28:31 2008 +0000 @@ -37,7 +37,7 @@ #include "console.h" #include "internal.h" -#include "util-lib.h" +#include "util.h" /* ie Ctrl-] as per telnet */ #define CTRL_CLOSE_BRACKET '\35' diff -r bbf3d0bc9d49 src/datatypes.c --- a/src/datatypes.c Tue Nov 11 17:28:27 2008 +0000 +++ b/src/datatypes.c Tue Nov 11 17:28:31 2008 +0000 @@ -239,7 +239,7 @@ * Returns a pointer to the domain, or NULL in case of failure */ virDomainPtr -__virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) { +virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) { virDomainPtr ret = NULL; if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (uuid == NULL)) { @@ -379,7 +379,7 @@ * Returns a pointer to the network, or NULL in case of failure */ virNetworkPtr -__virGetNetwork(virConnectPtr conn, const char *name, const unsigned char *uuid) { +virGetNetwork(virConnectPtr conn, const char *name, const unsigned char *uuid) { virNetworkPtr ret = NULL; if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (uuid == NULL)) { @@ -516,7 +516,7 @@ * Returns a pointer to the network, or NULL in case of failure */ virStoragePoolPtr -__virGetStoragePool(virConnectPtr conn, const char *name, const unsigned char *uuid) { +virGetStoragePool(virConnectPtr conn, const char *name, const unsigned char *uuid) { virStoragePoolPtr ret = NULL; if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (uuid == NULL)) { @@ -650,7 +650,7 @@ * Returns a pointer to the storage vol, or NULL in case of failure */ virStorageVolPtr -__virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const char *key) { +virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const char *key) { virStorageVolPtr ret = NULL; if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (key == NULL)) { diff -r bbf3d0bc9d49 src/datatypes.h --- a/src/datatypes.h Tue Nov 11 17:28:27 2008 +0000 +++ b/src/datatypes.h Tue Nov 11 17:28:31 2008 +0000 @@ -184,29 +184,23 @@ virConnectPtr virGetConnect(void); int virUnrefConnect(virConnectPtr conn); -virDomainPtr __virGetDomain(virConnectPtr conn, +virDomainPtr virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid); int virUnrefDomain(virDomainPtr domain); -virNetworkPtr __virGetNetwork(virConnectPtr conn, +virNetworkPtr virGetNetwork(virConnectPtr conn, const char *name, const unsigned char *uuid); int virUnrefNetwork(virNetworkPtr network); -virStoragePoolPtr __virGetStoragePool(virConnectPtr conn, +virStoragePoolPtr virGetStoragePool(virConnectPtr conn, const char *name, const unsigned char *uuid); int virUnrefStoragePool(virStoragePoolPtr pool); -virStorageVolPtr __virGetStorageVol(virConnectPtr conn, +virStorageVolPtr virGetStorageVol(virConnectPtr conn, const char *pool, const char *name, const char *key); int virUnrefStorageVol(virStorageVolPtr vol); -#define virGetDomain(c,n,u) __virGetDomain((c),(n),(u)) -#define virGetNetwork(c,n,u) __virGetNetwork((c),(n),(u)) -#define virGetStoragePool(c,n,u) __virGetStoragePool((c),(n),(u)) -#define virGetStorageVol(c,p,n,u) __virGetStorageVol((c),(p),(n),(u)) - - #endif diff -r bbf3d0bc9d49 src/driver.h --- a/src/driver.h Tue Nov 11 17:28:27 2008 +0000 +++ b/src/driver.h Tue Nov 11 17:28:31 2008 +0000 @@ -73,7 +73,7 @@ typedef int (*virDrvClose) (virConnectPtr conn); typedef int - (*virDrvSupportsFeature) (virConnectPtr conn, int feature); + (*virDrvDrvSupportsFeature) (virConnectPtr conn, int feature); typedef const char * (*virDrvGetType) (virConnectPtr conn); typedef int @@ -305,7 +305,7 @@ virDrvProbe probe; virDrvOpen open; virDrvClose close; - virDrvSupportsFeature supports_feature; + virDrvDrvSupportsFeature supports_feature; virDrvGetType type; virDrvGetVersion version; virDrvGetHostname getHostname; diff -r bbf3d0bc9d49 src/libvirt.c --- a/src/libvirt.c Tue Nov 11 17:28:27 2008 +0000 +++ b/src/libvirt.c Tue Nov 11 17:28:31 2008 +0000 @@ -579,7 +579,7 @@ return virStateDriverTabCount++; } -int __virStateInitialize(void) { +int virStateInitialize(void) { int i, ret = 0; if (virInitialize() < 0) @@ -593,7 +593,7 @@ return ret; } -int __virStateCleanup(void) { +int virStateCleanup(void) { int i, ret = 0; for (i = 0 ; i < virStateDriverTabCount ; i++) { @@ -604,7 +604,7 @@ return ret; } -int __virStateReload(void) { +int virStateReload(void) { int i, ret = 0; for (i = 0 ; i < virStateDriverTabCount ; i++) { @@ -615,7 +615,7 @@ return ret; } -int __virStateActive(void) { +int virStateActive(void) { int i, ret = 0; for (i = 0 ; i < virStateDriverTabCount ; i++) { @@ -967,7 +967,7 @@ * implementation of driver features in the remote case. */ int -__virDrvSupportsFeature (virConnectPtr conn, int feature) +virDrvSupportsFeature (virConnectPtr conn, int feature) { DEBUG("conn=%p, feature=%d", conn, feature); @@ -2255,7 +2255,7 @@ * implementation of migration in the remote case. */ int -__virDomainMigratePrepare (virConnectPtr dconn, +virDomainMigratePrepare (virConnectPtr dconn, char **cookie, int *cookielen, const char *uri_in, @@ -2284,7 +2284,7 @@ * implementation of migration in the remote case. */ int -__virDomainMigratePerform (virDomainPtr domain, +virDomainMigratePerform (virDomainPtr domain, const char *cookie, int cookielen, const char *uri, @@ -2314,7 +2314,7 @@ * implementation of migration in the remote case. */ virDomainPtr -__virDomainMigrateFinish (virConnectPtr dconn, +virDomainMigrateFinish (virConnectPtr dconn, const char *dname, const char *cookie, int cookielen, diff -r bbf3d0bc9d49 src/libvirt_internal.h --- a/src/libvirt_internal.h Tue Nov 11 17:28:27 2008 +0000 +++ b/src/libvirt_internal.h Tue Nov 11 17:28:31 2008 +0000 @@ -26,39 +26,35 @@ #ifdef WITH_LIBVIRTD -int __virStateInitialize(void); -int __virStateCleanup(void); -int __virStateReload(void); -int __virStateActive(void); -#define virStateInitialize() __virStateInitialize() -#define virStateCleanup() __virStateCleanup() -#define virStateReload() __virStateReload() -#define virStateActive() __virStateActive() +int virStateInitialize(void); +int virStateCleanup(void); +int virStateReload(void); +int virStateActive(void); #endif -int __virDrvSupportsFeature (virConnectPtr conn, int feature); +int virDrvSupportsFeature (virConnectPtr conn, int feature); -int __virDomainMigratePrepare (virConnectPtr dconn, - char **cookie, - int *cookielen, - const char *uri_in, - char **uri_out, - unsigned long flags, - const char *dname, - unsigned long bandwidth); -int __virDomainMigratePerform (virDomainPtr domain, - const char *cookie, - int cookielen, - const char *uri, - unsigned long flags, - const char *dname, - unsigned long bandwidth); -virDomainPtr __virDomainMigrateFinish (virConnectPtr dconn, - const char *dname, - const char *cookie, - int cookielen, - const char *uri, - unsigned long flags); +int virDomainMigratePrepare (virConnectPtr dconn, + char **cookie, + int *cookielen, + const char *uri_in, + char **uri_out, + unsigned long flags, + const char *dname, + unsigned long bandwidth); +int virDomainMigratePerform (virDomainPtr domain, + const char *cookie, + int cookielen, + const char *uri, + unsigned long flags, + const char *dname, + unsigned long bandwidth); +virDomainPtr virDomainMigrateFinish (virConnectPtr dconn, + const char *dname, + const char *cookie, + int cookielen, + const char *uri, + unsigned long flags); #endif diff -r bbf3d0bc9d49 src/libvirt_sym.version --- a/src/libvirt_sym.version Tue Nov 11 17:28:27 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,203 +0,0 @@ -{ - global: - virInitialize; - virConnectOpen; - virConnectOpenReadOnly; - virConnectOpenAuth; - virConnectAuthPtrDefault; - - virConnectClose; - virConnectGetType; - virConnectGetVersion; - virConnectGetHostname; - virConnectGetURI; - virDomainGetConnect; - virConnectListDomains; - virConnectNumOfDomains; - virDomainCreate; - virDomainCreateLinux; - virDomainCreateXML; - virDomainDefineXML; - virDomainDestroy; - virDomainFree; - virDomainGetID; - virDomainGetUUID; - virDomainGetUUIDString; - virDomainGetInfo; - virNodeGetCellsFreeMemory; - virDomainGetMaxMemory; - virDomainGetName; - virDomainGetOSType; - virDomainGetXMLDesc; - virDomainLookupByID; - virDomainLookupByName; - virDomainLookupByUUID; - virDomainLookupByUUIDString; - virDomainRestore; - virDomainResume; - virDomainSave; - virDomainCoreDump; - virDomainSetMemory; - virDomainSetMaxMemory; - virDomainShutdown; - virDomainReboot; - virDomainSuspend; - virConnectListDefinedDomains; - virConnectNumOfDefinedDomains; - virConnectGetMaxVcpus; - virDomainUndefine; - virDomainGetAutostart; - virDomainSetAutostart; - virGetVersion; - virCopyLastError; - virConnSetErrorFunc; - virResetLastError; - virErrorFunc; - virResetError; - virConnGetLastError; - virGetLastError; - virSetErrorFunc; - virConnCopyLastError; - virConnResetLastError; - virDefaultErrorFunc; - virNodeGetInfo; - virConnectGetCapabilities; - virNodeGetCellsFreeMemory; - virNodeGetFreeMemory; - - virDomainSetVcpus; - virDomainPinVcpu; - virDomainGetVcpus; - virDomainGetMaxVcpus; - virDomainGetSchedulerType; - virDomainGetSchedulerParameters; - virDomainSetSchedulerParameters; - virDomainBlockStats; - virDomainInterfaceStats; - virDomainBlockPeek; - virDomainMemoryPeek; - virDomainAttachDevice; - virDomainDetachDevice; - - virDomainMigrate; - - virNetworkGetConnect; - virConnectNumOfNetworks; - virConnectListNetworks; - virConnectNumOfDefinedNetworks; - virConnectListDefinedNetworks; - virNetworkLookupByName; - virNetworkLookupByUUID; - virNetworkLookupByUUIDString; - virNetworkCreateXML; - virNetworkDefineXML; - virNetworkUndefine; - virNetworkCreate; - virNetworkDestroy; - virNetworkFree; - virNetworkGetName; - virNetworkGetUUID; - virNetworkGetUUIDString; - virNetworkGetXMLDesc; - virNetworkGetBridgeName; - virNetworkGetAutostart; - virNetworkSetAutostart; - - virStoragePoolGetConnect; - virConnectNumOfStoragePools; - virConnectNumOfDefinedStoragePools; - virConnectListStoragePools; - virConnectListDefinedStoragePools; - virConnectFindStoragePoolSources; - 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; - - virEventRegisterImpl; - virConnectDomainEventRegister; - virConnectDomainEventDeregister; - - /* Symbols with __ are private only - for use by the libvirtd daemon. - They are not part of stable ABI - guarentee provided for the public - symbols above */ - - __virConfNew; - __virConfReadFile; - __virConfReadMem; - __virConfFree; - __virConfGetValue; - __virConfSetValue; - __virConfWriteFile; - __virConfWriteMem; - - __virGetDomain; - __virGetNetwork; - __virGetStoragePool; - __virGetStorageVol; - - __virStateInitialize; - __virStateCleanup; - __virStateReload; - __virStateActive; - __virStateSigDispatcher; - - __virDrvSupportsFeature; - - __virDomainMigratePrepare; - __virDomainMigratePerform; - __virDomainMigrateFinish; - - __virFileReadAll; - __virStrToLong_i; - __virStrToLong_ull; - - __virBufferVSprintf; - __virBufferAdd; - __virBufferAddChar; - __virBufferContentAndReset; - __virBufferError; - - __virMacAddrCompare; - - __virAlloc; - __virAllocN; - __virReallocN; - __virFree; - local: *; -}; 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_@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: + *; +}; diff -r bbf3d0bc9d49 src/memory.c --- a/src/memory.c Tue Nov 11 17:28:27 2008 +0000 +++ b/src/memory.c Tue Nov 11 17:28:31 2008 +0000 @@ -88,7 +88,7 @@ * * Returns -1 on failure to allocate, zero on success */ -int __virAlloc(void *ptrptr, size_t size) +int virAlloc(void *ptrptr, size_t size) { #if TEST_OOM if (virAllocTestFail()) { @@ -116,7 +116,7 @@ * * Returns -1 on failure to allocate, zero on success */ -int __virAllocN(void *ptrptr, size_t size, size_t count) +int virAllocN(void *ptrptr, size_t size, size_t count) { #if TEST_OOM if (virAllocTestFail()) { @@ -145,7 +145,7 @@ * * Returns -1 on failure to allocate, zero on success */ -int __virReallocN(void *ptrptr, size_t size, size_t count) +int virReallocN(void *ptrptr, size_t size, size_t count) { void *tmp; #if TEST_OOM @@ -172,7 +172,7 @@ * the 'ptrptr' variable. After release, 'ptrptr' will be * updated to point to NULL. */ -void __virFree(void *ptrptr) +void virFree(void *ptrptr) { free(*(void**)ptrptr); *(void**)ptrptr = NULL; diff -r bbf3d0bc9d49 src/memory.h --- a/src/memory.h Tue Nov 11 17:28:27 2008 +0000 +++ b/src/memory.h Tue Nov 11 17:28:31 2008 +0000 @@ -45,10 +45,10 @@ /* Don't call these directly - use the macros below */ -int __virAlloc(void *ptrptr, size_t size) ATTRIBUTE_RETURN_CHECK; -int __virAllocN(void *ptrptr, size_t size, size_t count) ATTRIBUTE_RETURN_CHECK; -int __virReallocN(void *ptrptr, size_t size, size_t count) ATTRIBUTE_RETURN_CHECK; -void __virFree(void *ptrptr); +int virAlloc(void *ptrptr, size_t size) ATTRIBUTE_RETURN_CHECK; +int virAllocN(void *ptrptr, size_t size, size_t count) ATTRIBUTE_RETURN_CHECK; +int virReallocN(void *ptrptr, size_t size, size_t count) ATTRIBUTE_RETURN_CHECK; +void virFree(void *ptrptr); /** * VIR_ALLOC: @@ -60,7 +60,7 @@ * * Returns -1 on failure, 0 on success */ -#define VIR_ALLOC(ptr) __virAlloc(&(ptr), sizeof(*(ptr))) +#define VIR_ALLOC(ptr) virAlloc(&(ptr), sizeof(*(ptr))) /** * VIR_ALLOC_N: @@ -73,7 +73,7 @@ * * Returns -1 on failure, 0 on success */ -#define VIR_ALLOC_N(ptr, count) __virAllocN(&(ptr), sizeof(*(ptr)), (count)) +#define VIR_ALLOC_N(ptr, count) virAllocN(&(ptr), sizeof(*(ptr)), (count)) /** * VIR_REALLOC_N: @@ -86,7 +86,7 @@ * * Returns -1 on failure, 0 on success */ -#define VIR_REALLOC_N(ptr, count) __virReallocN(&(ptr), sizeof(*(ptr)), (count)) +#define VIR_REALLOC_N(ptr, count) virReallocN(&(ptr), sizeof(*(ptr)), (count)) /** * VIR_FREE: @@ -95,7 +95,7 @@ * Free the memory stored in 'ptr' and update to point * to NULL. */ -#define VIR_FREE(ptr) __virFree(&(ptr)) +#define VIR_FREE(ptr) virFree(&(ptr)) #if TEST_OOM diff -r bbf3d0bc9d49 src/util-lib.c --- a/src/util-lib.c Tue Nov 11 17:28:27 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * common, generic utility functions - * - * Copyright (C) 2006, 2007, 2008 Red Hat, Inc. - * See COPYING.LIB for the License of this software - */ - -#include <config.h> - -#include <unistd.h> -#include <errno.h> - -#include "util-lib.h" - -/* Like read(), but restarts after EINTR */ -int saferead(int fd, void *buf, size_t count) -{ - size_t nread = 0; - while (count > 0) { - ssize_t r = read(fd, buf, count); - if (r < 0 && errno == EINTR) - continue; - if (r < 0) - return r; - if (r == 0) - return nread; - buf = (char *)buf + r; - count -= r; - nread += r; - } - return nread; -} - -/* Like write(), but restarts after EINTR */ -ssize_t safewrite(int fd, const void *buf, size_t count) -{ - size_t nwritten = 0; - while (count > 0) { - ssize_t r = write(fd, buf, count); - - if (r < 0 && errno == EINTR) - continue; - if (r < 0) - return r; - if (r == 0) - return nwritten; - buf = (const char *)buf + r; - count -= r; - nwritten += r; - } - return nwritten; -} diff -r bbf3d0bc9d49 src/util-lib.h --- a/src/util-lib.h Tue Nov 11 17:28:27 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* - * private utility functions - * - * Copyright (C) 2008 Red Hat, Inc. - * See COPYING.LIB for the License of this software - */ - -#ifndef __UTIL_LIB_H__ -#define __UTIL_LIB_H__ - -#include <sys/types.h> - -/* - * To avoid a double definition of the function when compiling - * programs using both util-lib and libvirt, like virsh - */ -#ifdef IN_LIBVIRT -#define saferead libvirt_saferead -#define safewrite libvirt_safewrite -#endif - -int saferead(int fd, void *buf, size_t count); -ssize_t safewrite(int fd, const void *buf, size_t count); - -#endif diff -r bbf3d0bc9d49 src/util.c --- a/src/util.c Tue Nov 11 17:28:27 2008 +0000 +++ b/src/util.c Tue Nov 11 17:28:31 2008 +0000 @@ -54,7 +54,6 @@ #include "buf.h" #include "util.h" #include "memory.h" -#include "util-lib.c" #ifndef NSIG # define NSIG 32 @@ -66,11 +65,51 @@ #define virLog(msg...) fprintf(stderr, msg) -#ifndef PROXY #define ReportError(conn, code, fmt...) \ virReportErrorHelper(conn, VIR_FROM_NONE, code, __FILE__, \ __FUNCTION__, __LINE__, fmt) + +/* Like read(), but restarts after EINTR */ +int saferead(int fd, void *buf, size_t count) +{ + size_t nread = 0; + while (count > 0) { + ssize_t r = read(fd, buf, count); + if (r < 0 && errno == EINTR) + continue; + if (r < 0) + return r; + if (r == 0) + return nread; + buf = (char *)buf + r; + count -= r; + nread += r; + } + return nread; +} + +/* Like write(), but restarts after EINTR */ +ssize_t safewrite(int fd, const void *buf, size_t count) +{ + size_t nwritten = 0; + while (count > 0) { + ssize_t r = write(fd, buf, count); + + if (r < 0 && errno == EINTR) + continue; + if (r < 0) + return r; + if (r == 0) + return nwritten; + buf = (const char *)buf + r; + count -= r; + nwritten += r; + } + return nwritten; +} + +#ifndef PROXY int virFileStripSuffix(char *str, const char *suffix) @@ -675,7 +714,7 @@ } /* Like virFileReadLimFP, but use a file descriptor rather than a FILE*. */ -int __virFileReadLimFD(int fd_arg, int maxlen, char **buf) +int virFileReadLimFD(int fd_arg, int maxlen, char **buf) { int fd = dup (fd_arg); if (fd >= 0) { @@ -695,7 +734,7 @@ return -1; } -int __virFileReadAll(const char *path, int maxlen, char **buf) +int virFileReadAll(const char *path, int maxlen, char **buf) { FILE *fh = fopen(path, "r"); if (fh == NULL) { @@ -985,7 +1024,7 @@ validity. This function is careful to return -1 when the string S represents a number that is not representable as an "int". */ int -__virStrToLong_i(char const *s, char **end_ptr, int base, int *result) +virStrToLong_i(char const *s, char **end_ptr, int base, int *result) { long int val; char *p; @@ -1042,7 +1081,7 @@ /* Just like virStrToLong_i, above, but produce an "unsigned long long" value. */ int -__virStrToLong_ull(char const *s, char **end_ptr, int base, unsigned long long *result) +virStrToLong_ull(char const *s, char **end_ptr, int base, unsigned long long *result) { unsigned long long val; char *p; @@ -1114,7 +1153,7 @@ * as well as leading zeros. */ int -__virMacAddrCompare (const char *p, const char *q) +virMacAddrCompare (const char *p, const char *q) { unsigned char c, d; do { diff -r bbf3d0bc9d49 src/util.h --- a/src/util.h Tue Nov 11 17:28:27 2008 +0000 +++ b/src/util.h Tue Nov 11 17:28:31 2008 +0000 @@ -25,9 +25,11 @@ #ifndef __VIR_UTIL_H__ #define __VIR_UTIL_H__ -#include "util-lib.h" #include "verify.h" #include <sys/select.h> + +int saferead(int fd, void *buf, size_t count); +ssize_t safewrite(int fd, const void *buf, size_t count); enum { VIR_EXEC_NONE = 0, @@ -46,11 +48,9 @@ int flags); int virRun(virConnectPtr conn, const char *const*argv, int *status); -int __virFileReadLimFD(int fd, int maxlen, char **buf); -#define virFileReadLimFD(fd,m,b) __virFileReadLimFD((fd),(m),(b)) +int virFileReadLimFD(int fd, int maxlen, char **buf); -int __virFileReadAll(const char *path, int maxlen, char **buf); -#define virFileReadAll(p,m,b) __virFileReadAll((p),(m),(b)) +int virFileReadAll(const char *path, int maxlen, char **buf); int virFileMatchesNameSuffix(const char *file, const char *name, @@ -90,11 +90,10 @@ char *virArgvToString(const char *const *argv); -int __virStrToLong_i(char const *s, +int virStrToLong_i(char const *s, char **end_ptr, int base, int *result); -#define virStrToLong_i(s,e,b,r) __virStrToLong_i((s),(e),(b),(r)) int virStrToLong_ui(char const *s, char **end_ptr, @@ -104,14 +103,12 @@ char **end_ptr, int base, long long *result); -int __virStrToLong_ull(char const *s, - char **end_ptr, - int base, - unsigned long long *result); -#define virStrToLong_ull(s,e,b,r) __virStrToLong_ull((s),(e),(b),(r)) +int virStrToLong_ull(char const *s, + char **end_ptr, + int base, + unsigned long long *result); -int __virMacAddrCompare (const char *mac1, const char *mac2); -#define virMacAddrCompare(mac1,mac2) __virMacAddrCompare((mac1),(mac2)) +int virMacAddrCompare (const char *mac1, const char *mac2); void virSkipSpaces(const char **str); int virParseNumber(const char **str); diff -r bbf3d0bc9d49 src/virsh.c --- a/src/virsh.c Tue Nov 11 17:28:27 2008 +0000 +++ b/src/virsh.c Tue Nov 11 17:28:31 2008 +0000 @@ -47,7 +47,6 @@ #include "buf.h" #include "console.h" #include "util.h" -#include "util-lib.h" static char *progname; -- |: 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 :| -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list