[libvirt] [PATCH v4 08/23] tpm: Move virtpm.c from utils dir to own tpm dir

Daniel P. Berrangé berrange at redhat.com
Fri Jul 12 09:39:37 UTC 2019


On Thu, Jul 11, 2019 at 03:41:36PM -0400, Stefan Berger wrote:
> Move virtpm.c from utils dir to its own tpm dir. This change
> is mostly driven by the later introduction of virtpm_conf.c where
> the define function like XYZTypeFromString() that we cannot
> include from utils dir.

Apart from the enum helpers what else is needed ?  If it is just
the enums, then simpy declare them in the util files instead of
in the config file.

> 
> Signed-off-by: Stefan Berger <stefanb at linux.ibm.com>
> Reviewed-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> ---
>  po/POTFILES                  |  2 +-
>  src/Makefile.am              |  1 +
>  src/conf/Makefile.inc.am     |  1 +
>  src/libvirt_private.syms     |  8 ++++----
>  src/qemu/Makefile.inc.am     |  1 +
>  src/security/Makefile.inc.am |  1 +
>  src/tpm/Makefile.inc.am      | 17 +++++++++++++++++
>  src/{util => tpm}/virtpm.c   |  0
>  src/{util => tpm}/virtpm.h   |  0
>  src/util/Makefile.inc.am     |  2 --
>  tests/Makefile.am            |  1 +
>  11 files changed, 27 insertions(+), 7 deletions(-)
>  create mode 100644 src/tpm/Makefile.inc.am
>  rename src/{util => tpm}/virtpm.c (100%)
>  rename src/{util => tpm}/virtpm.h (100%)
> 
> diff --git a/po/POTFILES b/po/POTFILES
> index 8017712ff4..e3c1a8edae 100644
> --- a/po/POTFILES
> +++ b/po/POTFILES
> @@ -188,6 +188,7 @@ src/storage/storage_backend_zfs.c
>  src/storage/storage_driver.c
>  src/storage/storage_util.c
>  src/test/test_driver.c
> +src/tpm/virtpm.c
>  src/util/iohelper.c
>  src/util/viralloc.c
>  src/util/virarptable.c
> @@ -266,7 +267,6 @@ src/util/virsysinfo.c
>  src/util/virthreadjob.c
>  src/util/virthreadpool.c
>  src/util/virtime.c
> -src/util/virtpm.c
>  src/util/virtypedparam.c
>  src/util/viruri.c
>  src/util/virusb.c
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 0b562dc250..5f7c9001fe 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -122,6 +122,7 @@ include node_device/Makefile.inc.am
>  include secret/Makefile.inc.am
>  include storage/Makefile.inc.am
>  include remote/Makefile.inc.am
> +include tpm/Makefile.inc.am
>  
>  
>  THREAD_LIBS = $(LIB_PTHREAD) $(LTLIBMULTITHREAD)
> diff --git a/src/conf/Makefile.inc.am b/src/conf/Makefile.inc.am
> index 6b52ba674b..08c7c9da7f 100644
> --- a/src/conf/Makefile.inc.am
> +++ b/src/conf/Makefile.inc.am
> @@ -178,6 +178,7 @@ libvirt_la_BUILT_LIBADD += libvirt_conf.la
>  libvirt_conf_la_SOURCES = $(CONF_SOURCES)
>  libvirt_conf_la_CFLAGS = \
>  	-I$(srcdir)/conf \
> +	-I$(srcdir)/tpm \
>  	$(AM_CFLAGS) \
>  	$(NULL)
>  libvirt_conf_la_LDFLAGS = $(AM_LDFLAGS)
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index 34937adc5d..e29007cab1 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -1445,6 +1445,10 @@ virSecurityManagerTransactionStart;
>  virSecurityManagerVerify;
>  
>  
> +# tpm/virtpm.h
> +virTPMCreateCancelPath;
> +
> +
>  # util/viralloc.h
>  virAlloc;
>  virAllocN;
> @@ -3175,10 +3179,6 @@ virTimeStringThen;
>  virTimeStringThenRaw;
>  
>  
> -# util/virtpm.h
> -virTPMCreateCancelPath;
> -
> -
>  # util/virtypedparam.h
>  virTypedParameterAssign;
>  virTypedParameterAssignFromStr;
> diff --git a/src/qemu/Makefile.inc.am b/src/qemu/Makefile.inc.am
> index 254ba07dc0..72b28e731d 100644
> --- a/src/qemu/Makefile.inc.am
> +++ b/src/qemu/Makefile.inc.am
> @@ -84,6 +84,7 @@ libvirt_driver_qemu_impl_la_CFLAGS = \
>  	-I$(srcdir)/access \
>  	-I$(srcdir)/conf \
>  	-I$(srcdir)/secret \
> +	-I$(srcdir)/tpm \
>  	$(AM_CFLAGS) \
>  	$(NULL)
>  libvirt_driver_qemu_impl_la_LDFLAGS = $(AM_LDFLAGS)
> diff --git a/src/security/Makefile.inc.am b/src/security/Makefile.inc.am
> index 64e0f46857..3e110596dc 100644
> --- a/src/security/Makefile.inc.am
> +++ b/src/security/Makefile.inc.am
> @@ -47,6 +47,7 @@ noinst_LTLIBRARIES += libvirt_security_manager.la
>  libvirt_la_BUILT_LIBADD += libvirt_security_manager.la
>  libvirt_security_manager_la_CFLAGS = \
>  	-I$(srcdir)/conf \
> +	-I$(srcdir)/tpm \
>  	$(AM_CFLAGS) \
>  	$(NULL)
>  libvirt_security_manager_la_LDFLAGS = $(AM_LDFLAGS)
> diff --git a/src/tpm/Makefile.inc.am b/src/tpm/Makefile.inc.am
> new file mode 100644
> index 0000000000..1f5131bf34
> --- /dev/null
> +++ b/src/tpm/Makefile.inc.am
> @@ -0,0 +1,17 @@
> +# vim: filetype=automake
> +
> +TPM_UTIL_SOURCES = \
> +	tpm/virtpm.h \
> +	tpm/virtpm.c \
> +	$(NULL)
> +
> +
> +EXTRA_DIST += \
> +	$(TPM_UTIL_SOURCES) \
> +	$(NULL)
> +
> +noinst_LTLIBRARIES += libvirt_tpm.la
> +libvirt_la_BUILT_LIBADD += libvirt_tpm.la
> +libvirt_tpm_la_CFLAGS = $(AM_CFLAGS)
> +libvirt_tpm_la_LDFLAGS = $(AM_LDFLAGS)
> +libvirt_tpm_la_SOURCES = $(TPM_UTIL_SOURCES)
> diff --git a/src/util/virtpm.c b/src/tpm/virtpm.c
> similarity index 100%
> rename from src/util/virtpm.c
> rename to src/tpm/virtpm.c
> diff --git a/src/util/virtpm.h b/src/tpm/virtpm.h
> similarity index 100%
> rename from src/util/virtpm.h
> rename to src/tpm/virtpm.h
> diff --git a/src/util/Makefile.inc.am b/src/util/Makefile.inc.am
> index c757f5a6ae..8b2ff6be6b 100644
> --- a/src/util/Makefile.inc.am
> +++ b/src/util/Makefile.inc.am
> @@ -205,8 +205,6 @@ UTIL_SOURCES = \
>  	util/virthreadpool.h \
>  	util/virtime.c \
>  	util/virtime.h \
> -	util/virtpm.c \
> -	util/virtpm.h \
>  	util/virtypedparam.c \
>  	util/virtypedparam.h \
>  	util/virusb.c \
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 115afa1c1a..ffc9f7f92e 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -25,6 +25,7 @@ AM_CPPFLAGS = \
>  	-I$(top_builddir)/src -I$(top_srcdir)/src \
>  	-I$(top_srcdir)/src/util \
>  	-I$(top_srcdir)/src/conf \
> +	-I$(top_srcdir)/src/tpm \
>  	$(NULL)
>  
>  WARN_CFLAGS += $(RELAXED_FRAME_LIMIT_CFLAGS)
> -- 
> 2.20.1
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list