[PATCH 2/2] libvirt-admin: Generate symbols file

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

 



Since we're linking this into libvirtd we need some symbols to be public
but not part of the public API so mark them as
LIBVIRT_ADMIN_PRIVATE_<VERSION> as we do with libvirt.

Making all other symbols local makes sure we don't accidentally leak
unwanted ones.
---
 configure.ac                   |  2 +-
 src/Makefile.am                | 20 ++++++++++++++++++--
 src/libvirt_admin.syms         | 18 ------------------
 src/libvirt_admin_private.syms | 14 ++++++++++++++
 src/libvirt_admin_public.syms  | 18 ++++++++++++++++++
 5 files changed, 51 insertions(+), 21 deletions(-)
 delete mode 100644 src/libvirt_admin.syms
 create mode 100644 src/libvirt_admin_private.syms
 create mode 100644 src/libvirt_admin_public.syms

diff --git a/configure.ac b/configure.ac
index 46c80ce..9066ed6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2346,7 +2346,7 @@ WIN32_EXTRA_CFLAGS=
 dnl libvirt.syms is generated in builddir, but libvirt_qemu.syms is in git;
 dnl hence the asymmetric naming of these two symbol files.
 LIBVIRT_SYMBOL_FILE=libvirt.syms
-LIBVIRT_ADMIN_SYMBOL_FILE='$(srcdir)/libvirt_admin.syms'
+LIBVIRT_ADMIN_SYMBOL_FILE=libvirt_admin.syms
 LIBVIRT_LXC_SYMBOL_FILE='$(srcdir)/libvirt_lxc.syms'
 LIBVIRT_QEMU_SYMBOL_FILE='$(srcdir)/libvirt_qemu.syms'
 MSCOM_LIBS=
diff --git a/src/Makefile.am b/src/Makefile.am
index c4d49a5..9667292 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -540,7 +540,7 @@ check-drivername:
 	$(AM_V_GEN)$(PERL) $(srcdir)/check-drivername.pl \
 		$(srcdir)/driver.h \
 		$(srcdir)/libvirt_public.syms \
-		$(srcdir)/libvirt_admin.syms \
+		$(srcdir)/libvirt_admin_public.syms \
 		$(srcdir)/libvirt_qemu.syms \
 		$(srcdir)/libvirt_lxc.syms
 
@@ -2010,8 +2010,9 @@ EXTRA_DIST += \
 	libvirt_public.syms		\
 	libvirt_lxc.syms		\
 	libvirt_qemu.syms		\
-	libvirt_admin.syms		\
+	libvirt_admin_public.syms	\
 	$(SYM_FILES)			\
+	$(ADMIN_SYM_FILES)		\
 	$(NULL)
 
 BUILT_SOURCES += $(GENERATED_SYM_FILES)
@@ -2038,6 +2039,19 @@ libvirt.syms: libvirt_public.syms $(USED_SYM_FILES) \
 	chmod a-w $@-tmp && \
 	mv $@-tmp $@
 
+libvirt_admin.syms: libvirt_admin_public.syms $(ADMIN_SYM_FILES) \
+		$(top_builddir)/config.status
+	$(AM_V_GEN)rm -f $@-tmp $@ ; \
+	printf '# WARNING: generated from the following:\n# $^\n\n' >$@-tmp && \
+	cat $(srcdir)/libvirt_admin_public.syms >>$@-tmp && \
+	printf '\n\n# Private symbols\n\n' >>$@-tmp && \
+	printf 'LIBVIRT_ADMIN_PRIVATE_$(VERSION) {\n\n'  >>$@-tmp && \
+	printf 'global:\n\n' >>$@-tmp && \
+	cat $(ADMIN_SYM_FILES) >>$@-tmp && \
+	printf '\n\nlocal:\n*;\n\n};' >>$@-tmp && \
+	chmod a-w $@-tmp && \
+	mv $@-tmp libvirt_admin.syms
+
 lib_LTLIBRARIES += libvirt-admin.la
 libvirt_admin_la_SOURCES = \
 		libvirt-admin.c			\
@@ -2077,6 +2091,8 @@ libvirt_admin_la_LIBADD += \
 		$(SASL_LIBS)			\
 		$(GNUTLS_LIBS)
 
+ADMIN_SYM_FILES = $(srcdir)/libvirt_admin_private.syms
+
 if WITH_DTRACE_PROBES
 libvirt_admin_la_LIBADD += libvirt_probes.lo
 endif WITH_DTRACE_PROBES
diff --git a/src/libvirt_admin.syms b/src/libvirt_admin.syms
deleted file mode 100644
index d9e3c0b..0000000
--- a/src/libvirt_admin.syms
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Officially exported symbols, for which header
-# file definitions are installed in /usr/include/libvirt
-# from libvirt-admin.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-admin.so not providing foo() - the global
-# soname version info can't enforce this since we never
-# change the soname
-#
-LIBVIRT_ADMIN_1.3.0 {
-    global:
-        virAdmConnectOpen;
-        virAdmConnectClose;
-        virAdmConnectRef;
-};
diff --git a/src/libvirt_admin_private.syms b/src/libvirt_admin_private.syms
new file mode 100644
index 0000000..401cd4e
--- /dev/null
+++ b/src/libvirt_admin_private.syms
@@ -0,0 +1,14 @@
+#
+# General private symbols for libvirt_admin. Add symbols here, and see
+# Makefile.am for more details.
+#
+# Keep this file sorted by header name, then by symbols with each header.
+#
+
+# admin/admin_protocol.x
+xdr_admin_connect_open_args;
+
+# Let emacs know we want case-insensitive sorting
+# Local Variables:
+# sort-fold-case: t
+# End:
diff --git a/src/libvirt_admin_public.syms b/src/libvirt_admin_public.syms
new file mode 100644
index 0000000..d9e3c0b
--- /dev/null
+++ b/src/libvirt_admin_public.syms
@@ -0,0 +1,18 @@
+#
+# Officially exported symbols, for which header
+# file definitions are installed in /usr/include/libvirt
+# from libvirt-admin.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-admin.so not providing foo() - the global
+# soname version info can't enforce this since we never
+# change the soname
+#
+LIBVIRT_ADMIN_1.3.0 {
+    global:
+        virAdmConnectOpen;
+        virAdmConnectClose;
+        virAdmConnectRef;
+};
-- 
2.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]