[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] PATCH: 8/11: Make better use of linker scripts



The libvirt.so file currently whitelists all the symbols in our public
API. libvirtd and virsh, however, also want to use a bunch of our so
called 'private' symbols which aren't in the public API. For saferead
and safewrite() we dealt with this by compiling the code twice with
some nasty macro tricks to give the function a different name to avoid
dup symbols when statically linking. For the other APIs, we prefixed
them with __ and then just added them to the exports.

Neither option is very good because they both impose a burden on the
source code - needing to append __ everywhere and write crazy macros.
Each time we want to export another symbol, we have to make lots of
manual changes to add __. This was OK if it was just a handful of
symbols, but we're now upto 30 odd, and its not scaling. When we
make drivers modular we'll be adding 100's more symbols.

As an aside, we use ELF library versioning when linking, via the
libtool -version-info flag. Since we maintain ABI compat going
forwards though, the version in the eventual .so is always going
to be 'libvirt.so.0'.  This is sub-optimal because you may build
a binary that requires 'virDomainBlockPeek' which appeared in
libvirt 0.4.2, but the ELF version cannot validate this. There is
nothing stopping your application launching against libvirt 0.3.0
and then aborting with a linker failure sometime while it is
running when it eventually referneces the non-existant symbol.
Likewise RPM automatic versioning hooks off the ELF version too,
so that's not preventing you installing too old a libvirt for
your app's needs.

A far better solution to all these problems has been sitting in
front of us the whole time. Namely we need to make full use of
the linkers symbol version scripts.

Our current libvirt_sym.version script is defining an unversioned
set of symbols. This only enforces what's exported, and can do
nothing about version compatability. So instead we need to switch
to a fully versioned script, where every symbol we export is tagged
with the libvirt version number at which it was introduced.

Taking the virDomainBlockPeek example again, this appeared in the
libvirt 0.4.2 release, so we'd add a section to the linker script

  LIBVIRT_0.4.2 {
      global:
          virDomainBlockPeek;
          virDomainMemoryPeek;
  } LIBVIRT_0.4.1;

Then 0.4.5 added in storage pool discovery so you get another
section

  LIBVIRT_0.4.5 {
      global:
          virConnectFindStoragePoolSources;
  } LIBVIRT_0.4.2;

And so on for every release.

The resulting libvirt.so file will thus gain metadata listing all
the ABI versions for all symbols it includes.

That deals with public APIs. Now we also want to export some internal
APIs whose semantics/syntax may arbitrarily change between releases.
Thus they should not be included in any of the formal public version
sections.

Instead they should be in a seperate versioned section, whose version
changes on every release. This will ensure that if libvirtd or virsh
link to some internal symbols, they are guareteened to only run
against the exactly same libvirt.so they were linked to. This will
avoid some nasty bugs our users have hit where they installed a custom
libvirt version on their OS which already had another version installed,
and then libvirtd crashed/behave wierdly/etc

To do this we rename  libvirt_sym.version to libvirt_sym.version.in
and add a section called

   LIBVIRT_PRIVATE_ VERSION@ {

     global:
        /* libvirt_internal.h */
        debugFlag;
        virStateInitialize;
        virStateCleanup;
        virStateReload;
        virStateActive;

        .... more private symbols...
   }

The @VERSION@ gets subsituted by the version number of the libvirt
release by configure.

Do a build with this all active and look at the resulting libvirt.so
using objdump (or eu-readelf). 

   # objdump -p  src/.libs/libvirt.so
Version definitions:
1 0x01 0x0e5a1d10 libvirt.so.0
2 0x00 0x0af6bd33 LIBVIRT_0.0.3
3 0x00 0x0af6bd35 LIBVIRT_0.0.5
  LIBVIRT_0.0.3 
4 0x00 0x0af6be30 LIBVIRT_0.1.0
  LIBVIRT_0.0.5 
5 0x00 0x0af6be31 LIBVIRT_0.1.1
  LIBVIRT_0.1.0 
6 0x00 0x0af6be34 LIBVIRT_0.1.4
  LIBVIRT_0.1.1 
7 0x00 0x0af6be35 LIBVIRT_0.1.5
  LIBVIRT_0.1.4 
8 0x00 0x0af6be39 LIBVIRT_0.1.9
  LIBVIRT_0.1.5 
9 0x00 0x0af6bb30 LIBVIRT_0.2.0
  LIBVIRT_0.1.9 
10 0x00 0x0af6bb31 LIBVIRT_0.2.1
   LIBVIRT_0.2.0 
11 0x00 0x0af6bb33 LIBVIRT_0.2.3
   LIBVIRT_0.2.1 
12 0x00 0x0af6bc30 LIBVIRT_0.3.0
   LIBVIRT_0.2.3 
13 0x00 0x0af6bc32 LIBVIRT_0.3.2
   LIBVIRT_0.3.0 
14 0x00 0x0af6bc33 LIBVIRT_0.3.3
   LIBVIRT_0.3.2 
15 0x00 0x0af6b930 LIBVIRT_0.4.0
   LIBVIRT_0.3.3 
16 0x00 0x0af6b931 LIBVIRT_0.4.1
   LIBVIRT_0.4.0 
17 0x00 0x0af6b932 LIBVIRT_0.4.2
   LIBVIRT_0.4.1 
18 0x00 0x0af6b935 LIBVIRT_0.4.5
   LIBVIRT_0.4.2 
19 0x00 0x0af6ba30 LIBVIRT_0.5.0
   LIBVIRT_0.4.5 
20 0x00 0x09e39b06 LIBVIRT_PRIVATE_0.4.6


You can see that as well as the main SONAME libvirt.so.0, we've
got version info for each release which introduced new public
API symbols, as well as our versioned private symbols.  If you
look at glibc's  libc.so, you'll see a similar set of versioned
interfaces.

Then take a look at the virsh binary, and see that it has references
to all of the versions corresponding to symbols it uses. You can
also see that it used some libvirt internal symbols, by presence of
the LIBVIRT_PRIVATE_0.4.6 reference. This ensures that this virsh
binary can't accidentally be used against libvirt 0.4.5 or 0.4.7
where it'd likely crash at runtime

  # objdump -p src/.libs/virsh
Version References:
  required from libpthread.so.0:
    0x09691a75 0x00 10 GLIBC_2.2.5
  required from libc.so.6:
    0x0d696918 0x00 19 GLIBC_2.8
    0x09691974 0x00 13 GLIBC_2.3.4
    0x09691a75 0x00 04 GLIBC_2.2.5
  required from libvirt.so.0:
    0x0af6ba30 0x00 22 LIBVIRT_0.5.0
    0x0af6bc30 0x00 21 LIBVIRT_0.3.0
    0x0af6bc33 0x00 20 LIBVIRT_0.3.3
    0x0af6be34 0x00 18 LIBVIRT_0.1.4
    0x0af6be35 0x00 17 LIBVIRT_0.1.5
    0x0af6b935 0x00 16 LIBVIRT_0.4.5
    0x0af6be31 0x00 15 LIBVIRT_0.1.1
    0x0af6bc32 0x00 14 LIBVIRT_0.3.2
    0x0af6be39 0x00 12 LIBVIRT_0.1.9
    0x0af6bd33 0x00 11 LIBVIRT_0.0.3
    0x0af6bb31 0x00 09 LIBVIRT_0.2.1
    0x09e39b06 0x00 08 LIBVIRT_PRIVATE_0.4.6
    0x0af6b930 0x00 07 LIBVIRT_0.4.0
    0x0af6bb30 0x00 06 LIBVIRT_0.2.0
    0x0af6be30 0x00 05 LIBVIRT_0.1.0
    0x0af6bb33 0x00 03 LIBVIRT_0.2.3
    0x0af6b931 0x00 02 LIBVIRT_0.4.1


The next nice thing is that RPM knows how to make use of these symbols
for strong dependancies.

$ rpm -qp --provides libvirt-0.4.6-1.fc9.berrange1225311229.x86_64.rpm
config(libvirt) = 0.4.6-1.fc9.berrange1225311229
libvirt.so.0()(64bit)  
libvirt.so.0(LIBVIRT_0.0.3)(64bit)  
libvirt.so.0(LIBVIRT_0.0.5)(64bit)  
libvirt.so.0(LIBVIRT_0.1.0)(64bit)  
libvirt.so.0(LIBVIRT_0.1.1)(64bit)  
libvirt.so.0(LIBVIRT_0.1.4)(64bit)  
libvirt.so.0(LIBVIRT_0.1.5)(64bit)  
libvirt.so.0(LIBVIRT_0.1.9)(64bit)  
libvirt.so.0(LIBVIRT_0.2.0)(64bit)  
libvirt.so.0(LIBVIRT_0.2.1)(64bit)  
libvirt.so.0(LIBVIRT_0.2.3)(64bit)  
libvirt.so.0(LIBVIRT_0.3.0)(64bit)  
libvirt.so.0(LIBVIRT_0.3.2)(64bit)  
libvirt.so.0(LIBVIRT_0.3.3)(64bit)  
libvirt.so.0(LIBVIRT_0.4.0)(64bit)  
libvirt.so.0(LIBVIRT_0.4.1)(64bit)  
libvirt.so.0(LIBVIRT_0.4.2)(64bit)  
libvirt.so.0(LIBVIRT_0.4.5)(64bit)  
libvirt.so.0(LIBVIRT_0.5.0)(64bit)  
libvirt.so.0(LIBVIRT_PRIVATE_0.4.6)(64bit)  

Again notice the LIBVIRT_PRIVATE_0.4.6 version here. If some $EVIL
user links to libvirt private symbols, RPM wil ensure they can only
ever be installed with the exactly matching libvirt build.

The libvirt-python bindings demonstrate a well behaved app that
doesn't access internal sybols:

$ rpm -qp --requires libvirt-python-0.4.6-1.fc9.berrange1225311229.x86_64.rpm
/usr/bin/python  
libc.so.6()(64bit)  
libc.so.6(GLIBC_2.2.5)(64bit)  
libc.so.6(GLIBC_2.4)(64bit)  
libpthread.so.0()(64bit)  
libvirt = 0.4.6
libvirt.so.0()(64bit)  
libvirt.so.0(LIBVIRT_0.0.3)(64bit)  
libvirt.so.0(LIBVIRT_0.0.5)(64bit)  
libvirt.so.0(LIBVIRT_0.1.0)(64bit)  
libvirt.so.0(LIBVIRT_0.1.1)(64bit)  
libvirt.so.0(LIBVIRT_0.1.4)(64bit)  
libvirt.so.0(LIBVIRT_0.1.5)(64bit)  
libvirt.so.0(LIBVIRT_0.1.9)(64bit)  
libvirt.so.0(LIBVIRT_0.2.0)(64bit)  
libvirt.so.0(LIBVIRT_0.2.1)(64bit)  
libvirt.so.0(LIBVIRT_0.2.3)(64bit)  
libvirt.so.0(LIBVIRT_0.3.0)(64bit)  
libvirt.so.0(LIBVIRT_0.3.2)(64bit)  
libvirt.so.0(LIBVIRT_0.3.3)(64bit)  
libvirt.so.0(LIBVIRT_0.4.0)(64bit)  
libvirt.so.0(LIBVIRT_0.4.1)(64bit)  
libvirt.so.0(LIBVIRT_0.4.5)(64bit)  
libvirt.so.0(LIBVIRT_0.5.0)(64bit)  
python(abi) = 2.5
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PartialHardlinkSets) <= 4.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rtld(GNU_HASH)  


There is one important thing to note. Going from an unversioned ELF
library to a versioned library is a one-way operation. If you have
a existing binary built against an unversioned .so, it'll link just
fine to the versioned .so.  If you have a binary built against a
versioned .so, then it'll never run with an unversioned .so. Of course
this is the entire point of having formal versioning info, but it
bears mentioning anyway.

This is all quite a complex subject, but there are actually some very
good docs on this exact topic. See 'info ld', and follow 'Scripts',
'VERSION' for the GNU docs. Or see it online:

  http://sources.redhat.com/binutils/docs-2.16/ld/VERSION.html#VERSION

Solaris uses exact same format for its linker, but calls this concept
a mapfile rather than a linker script, so this all applies to Solaris
libvirt builds too. Their docs are excellant reading

  http://docs.sun.com/app/docs/doc/817-1974/6mhlu8fds?l=en&q=linkers&a=view
  http://developers.sun.com/solaris/articles/linker_mapfiles.html
  http://www.usenix.org/publications/library/proceedings/als00/2000papers/papers/full_papers/browndavid/browndavid_html/

For non Linux, non Solaris platforms we're no worse than before - everything
is publically visible and we rely on trust.

Now onto the patch itself

 - Remove libvirt_sym.version, and add libvirt_sym.version.in
 - Change the unversion public API into a fully versioned API.
   I did this getting a checkout of every single libvirt release,
   and comparing the APIs listed in the public libvirt.h file
   to find out what version we introduced them in
 - Remove the leading __ prefix for all private symbols that
   we export for virsh/libvirtd & fix up code using them
 - Add a LIBVIRT_PRIVATE section mentioning all the private symbols
   needed by virsh/libivrtd
 - Merge util-lib.c back into util.c, and add saferead/write to the
   private exports

There should be no functional change in this patch. We're merely renaming
symbols, and playing games with the linker.

 a/src/libvirt_sym.version    |  203 ---------------------------
 a/src/util-lib.c             |   52 -------
 a/src/util-lib.h             |   25 ---
 b/src/libvirt_sym.version.in |  318 +++++++++++++++++++++++++++++++++++++++++++
 configure.in                 |    1 
 qemud/Makefile.am            |    3 
 qemud/remote.c               |   28 +--
 src/Makefile.am              |    1 
 src/buf.c                    |   10 -
 src/buf.h                    |   19 --
 src/conf.c                   |   36 ++--
 src/conf.h                   |   28 +--
 src/console.c                |    2 
 src/datatypes.c              |    8 -
 src/datatypes.h              |   14 -
 src/driver.h                 |    4 
 src/libvirt.c                |   16 +-
 src/libvirt_internal.h       |   56 +++----
 src/memory.c                 |    8 -
 src/memory.h                 |   16 +-
 src/util.c                   |   53 ++++++-
 src/util.h                   |   25 +--
 src/virsh.c                  |    1 
 23 files changed, 486 insertions(+), 441 deletions(-)

Daniel

diff -r 2a018ec3c877 configure.in
--- a/configure.in	Thu Oct 30 10:11:40 2008 +0000
+++ b/configure.in	Thu Oct 30 10:46:19 2008 +0000
@@ -1072,6 +1072,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 2a018ec3c877 qemud/Makefile.am
--- a/qemud/Makefile.am	Thu Oct 30 10:11:40 2008 +0000
+++ b/qemud/Makefile.am	Thu Oct 30 10:46:19 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 2a018ec3c877 qemud/remote.c
--- a/qemud/remote.c	Thu Oct 30 10:11:40 2008 +0000
+++ b/qemud/remote.c	Thu Oct 30 10:46:19 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 2a018ec3c877 src/Makefile.am
--- a/src/Makefile.am	Thu Oct 30 10:11:40 2008 +0000
+++ b/src/Makefile.am	Thu Oct 30 10:46:19 2008 +0000
@@ -284,7 +284,6 @@
 
 virsh_SOURCES =							\
 		console.c console.h				\
-		util-lib.c util-lib.h				\
 		virsh.c
 
 virsh_LDFLAGS = $(WARN_CFLAGS) $(COVERAGE_LDFLAGS)
diff -r 2a018ec3c877 src/buf.c
--- a/src/buf.c	Thu Oct 30 10:11:40 2008 +0000
+++ b/src/buf.c	Thu Oct 30 10:46:19 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 2a018ec3c877 src/buf.h
--- a/src/buf.h	Thu Oct 30 10:11:40 2008 +0000
+++ b/src/buf.h	Thu Oct 30 10:46:19 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 2a018ec3c877 src/conf.c
--- a/src/conf.c	Thu Oct 30 10:11:40 2008 +0000
+++ b/src/conf.c	Thu Oct 30 10:46:19 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 2a018ec3c877 src/conf.h
--- a/src/conf.h	Thu Oct 30 10:11:40 2008 +0000
+++ b/src/conf.h	Thu Oct 30 10:46:19 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 2a018ec3c877 src/console.c
--- a/src/console.c	Thu Oct 30 10:11:40 2008 +0000
+++ b/src/console.c	Thu Oct 30 10:46:19 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 2a018ec3c877 src/datatypes.c
--- a/src/datatypes.c	Thu Oct 30 10:11:40 2008 +0000
+++ b/src/datatypes.c	Thu Oct 30 10:46:19 2008 +0000
@@ -238,7 +238,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)) {
@@ -378,7 +378,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)) {
@@ -515,7 +515,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)) {
@@ -649,7 +649,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 2a018ec3c877 src/datatypes.h
--- a/src/datatypes.h	Thu Oct 30 10:11:40 2008 +0000
+++ b/src/datatypes.h	Thu Oct 30 10:46:19 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 2a018ec3c877 src/driver.h
--- a/src/driver.h	Thu Oct 30 10:11:40 2008 +0000
+++ b/src/driver.h	Thu Oct 30 10:46:19 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 2a018ec3c877 src/libvirt.c
--- a/src/libvirt.c	Thu Oct 30 10:11:40 2008 +0000
+++ b/src/libvirt.c	Thu Oct 30 10:46:19 2008 +0000
@@ -582,7 +582,7 @@
     return virStateDriverTabCount++;
 }
 
-int __virStateInitialize(void) {
+int virStateInitialize(void) {
     int i, ret = 0;
 
     if (virInitialize() < 0)
@@ -596,7 +596,7 @@
     return ret;
 }
 
-int __virStateCleanup(void) {
+int virStateCleanup(void) {
     int i, ret = 0;
 
     for (i = 0 ; i < virStateDriverTabCount ; i++) {
@@ -607,7 +607,7 @@
     return ret;
 }
 
-int __virStateReload(void) {
+int virStateReload(void) {
     int i, ret = 0;
 
     for (i = 0 ; i < virStateDriverTabCount ; i++) {
@@ -618,7 +618,7 @@
     return ret;
 }
 
-int __virStateActive(void) {
+int virStateActive(void) {
     int i, ret = 0;
 
     for (i = 0 ; i < virStateDriverTabCount ; i++) {
@@ -970,7 +970,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);
 
@@ -2258,7 +2258,7 @@
  * implementation of migration in the remote case.
  */
 int
-__virDomainMigratePrepare (virConnectPtr dconn,
+virDomainMigratePrepare (virConnectPtr dconn,
                            char **cookie,
                            int *cookielen,
                            const char *uri_in,
@@ -2287,7 +2287,7 @@
  * implementation of migration in the remote case.
  */
 int
-__virDomainMigratePerform (virDomainPtr domain,
+virDomainMigratePerform (virDomainPtr domain,
                            const char *cookie,
                            int cookielen,
                            const char *uri,
@@ -2317,7 +2317,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 2a018ec3c877 src/libvirt_internal.h
--- a/src/libvirt_internal.h	Thu Oct 30 10:11:40 2008 +0000
+++ b/src/libvirt_internal.h	Thu Oct 30 10:46:19 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 2a018ec3c877 src/libvirt_sym.version
--- a/src/libvirt_sym.version	Thu Oct 30 10:11:40 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 2a018ec3c877 src/libvirt_sym.version.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/libvirt_sym.version.in	Thu Oct 30 10:46:19 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 2a018ec3c877 src/memory.c
--- a/src/memory.c	Thu Oct 30 10:11:40 2008 +0000
+++ b/src/memory.c	Thu Oct 30 10:46:19 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 2a018ec3c877 src/memory.h
--- a/src/memory.h	Thu Oct 30 10:11:40 2008 +0000
+++ b/src/memory.h	Thu Oct 30 10:46:19 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 2a018ec3c877 src/util-lib.c
--- a/src/util-lib.c	Thu Oct 30 10:11:40 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 2a018ec3c877 src/util-lib.h
--- a/src/util-lib.h	Thu Oct 30 10:11:40 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 2a018ec3c877 src/util.c
--- a/src/util.c	Thu Oct 30 10:11:40 2008 +0000
+++ b/src/util.c	Thu Oct 30 10:46:19 2008 +0000
@@ -52,7 +52,6 @@
 #include "buf.h"
 #include "util.h"
 #include "memory.h"
-#include "util-lib.c"
 
 #ifndef NSIG
 # define NSIG 32
@@ -64,11 +63,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)
@@ -502,7 +541,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) {
@@ -522,7 +561,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) {
@@ -812,7 +851,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;
@@ -869,7 +908,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;
@@ -941,7 +980,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 2a018ec3c877 src/util.h
--- a/src/util.h	Thu Oct 30 10:11:40 2008 +0000
+++ b/src/util.h	Thu Oct 30 10:46:19 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,
@@ -88,11 +88,10 @@
 int virFileDeletePid(const char *dir,
                      const char *name);
 
-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,
@@ -102,14 +101,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 2a018ec3c877 src/virsh.c
--- a/src/virsh.c	Thu Oct 30 10:11:40 2008 +0000
+++ b/src/virsh.c	Thu Oct 30 10:46:19 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 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]