[libvirt] [PATCH 2/5] Link libvirt_util with datatypes

Martin Kletzander mkletzan at redhat.com
Wed Apr 15 09:10:20 UTC 2015


On Wed, Apr 15, 2015 at 09:26:45AM +0200, Peter Krempa wrote:
>On Mon, Apr 13, 2015 at 16:33:49 +0200, Martin Kletzander wrote:
>> We were lucky enough for this to work because the datatypes files were
>> linked to in the resulting binary, but the dependency really is already
>> in libvirt_util.
>>
>> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
>> ---
>>  src/Makefile.am | 7 ++++---
>>  1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/Makefile.am b/src/Makefile.am
>> index 91a4c17..8c26076 100644
>> --- a/src/Makefile.am
>> +++ b/src/Makefile.am
>> @@ -1,6 +1,6 @@
>>  ## Process this file with automake to produce Makefile.in
>>
>> -## Copyright (C) 2005-2014 Red Hat, Inc.
>> +## Copyright (C) 2005-2015 Red Hat, Inc.
>>  ##
>>  ## This library is free software; you can redistribute it and/or
>>  ## modify it under the terms of the GNU Lesser General Public
>> @@ -86,9 +86,12 @@ augeas_DATA =
>>  augeastestdir = $(datadir)/augeas/lenses/tests
>>  augeastest_DATA =
>>
>> +DATATYPES_SOURCES = datatypes.h datatypes.c
>> +
>>  # These files are not related to driver APIs. Simply generic
>>  # helper APIs for various purposes
>>  UTIL_SOURCES =							\
>> +		$(DATATYPES_SOURCES)				\
>>  		util/viralloc.c util/viralloc.h			\
>>  		util/virarch.h util/virarch.c			\
>>  		util/viratomic.h util/viratomic.c		\
>
>I think this makes it wrong the other way. While they are used in the
>utils they definitely are not just 'utils'. The source file contains
>definitions and declarations for the public data types and that
>definitely is not "just utils". Btw, read the comment right above the
>UTIL_SOURCES line ...
>
>The real problem here is that 'util' uses types from the datatypes file.
>
>Do you know of any examples that make utils depend on datatypes.h?
>

No, but the other way around.  most of the types in datatypes are
virObjects defined in util/virobject.c, so everything that has
DATATYPES_SOURCES must be linked with UTIL_SOURCES as well.  The right
way to put this together would be DATATYPES_SOURCES += UTIL_SOURCES,
but that's downright ugly to fix.  Moreover everything that links with
UTIL_SOURCES.  I should've probably squashed in the following patch.

diff --git i/src/Makefile.am w/src/Makefile.am
index 8c26076..84f489f 100644
--- i/src/Makefile.am
+++ w/src/Makefile.am
@@ -672,10 +672,6 @@ LXC_CONTROLLER_SOURCES =					\
 		lxc/lxc_fuse.c lxc/lxc_fuse.h			\
 		lxc/lxc_controller.c

-SECURITY_DRIVER_APPARMOR_HELPER_SOURCES =			\
-		$(DATATYPES_SOURCES)				\
-		security/virt-aa-helper.c
-
 PHYP_DRIVER_SOURCES =						\
 		phyp/phyp_driver.c phyp/phyp_driver.h

@@ -2605,8 +2601,7 @@ libexec_PROGRAMS += libvirt_lxc

 libvirt_lxc_SOURCES =						\
 		$(LXC_CONTROLLER_SOURCES)			\
-		$(NODE_INFO_SOURCES)				\
-		$(DATATYPES_SOURCES)
+		$(NODE_INFO_SOURCES)
 libvirt_lxc_LDFLAGS = \
 		$(AM_LDFLAGS) \
 		$(PIE_LDFLAGS) \
@@ -2644,7 +2639,7 @@ if WITH_SECDRIVER_APPARMOR
 if WITH_LIBVIRTD
 libexec_PROGRAMS += virt-aa-helper

-virt_aa_helper_SOURCES = $(SECURITY_DRIVER_APPARMOR_HELPER_SOURCES)
+virt_aa_helper_SOURCES = security/virt-aa-helper.c

 virt_aa_helper_LDFLAGS = \
 		$(AM_LDFLAGS) \
@@ -2667,7 +2662,7 @@ virt_aa_helper_CFLAGS =						\
 		$(NULL)
 endif WITH_LIBVIRTD
 endif WITH_SECDRIVER_APPARMOR
-EXTRA_DIST += $(SECURITY_DRIVER_APPARMOR_HELPER_SOURCES)
+EXTRA_DIST += security/virt-aa-helper.c

 install-data-local: install-init install-systemd
 if WITH_LIBVIRTD
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150415/1c838751/attachment-0001.sig>


More information about the libvir-list mailing list