A bunch of code is wrapped in #if WITH_LIBVIRTD in order to enable the virStateDriver to be disabled when libvirtd is not built. Disabling this code doesn't have any real functional benefit beyond removing 1 pointer from the virConnectPtr struct, while having a cost of many more conditionals. Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx> --- src/Makefile.am | 6 ------ src/driver.h | 6 +----- src/libvirt.c | 4 ---- src/libvirt_daemon.syms | 15 --------------- src/libvirt_internal.h | 2 -- src/libvirt_private.syms | 5 +++++ src/remote/remote_driver.c | 6 ------ 7 files changed, 6 insertions(+), 38 deletions(-) delete mode 100644 src/libvirt_daemon.syms diff --git a/src/Makefile.am b/src/Makefile.am index 4bba536..1e21279 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1949,12 +1949,6 @@ else ! WITH_ESX SYM_FILES += $(srcdir)/libvirt_esx.syms endif ! WITH_ESX -if WITH_LIBVIRTD -USED_SYM_FILES += $(srcdir)/libvirt_daemon.syms -else ! WITH_LIBVIRTD -SYM_FILES += $(srcdir)/libvirt_daemon.syms -endif ! WITH_LIBVIRTD - if WITH_REMOTE USED_SYM_FILES += $(srcdir)/libvirt_remote.syms else ! WITH_REMOTE diff --git a/src/driver.h b/src/driver.h index f7e10a1..5b7862b 100644 --- a/src/driver.h +++ b/src/driver.h @@ -91,9 +91,7 @@ typedef enum { # include "driver-nodedev.h" # include "driver-nwfilter.h" # include "driver-secret.h" -# ifdef WITH_LIBVIRTD -# include "driver-state.h" -# endif +# include "driver-state.h" # include "driver-stream.h" # include "driver-storage.h" @@ -106,9 +104,7 @@ int virRegisterNetworkDriver(virNetworkDriverPtr) ATTRIBUTE_RETURN_CHECK; int virRegisterNodeDeviceDriver(virNodeDeviceDriverPtr) ATTRIBUTE_RETURN_CHECK; int virRegisterNWFilterDriver(virNWFilterDriverPtr) ATTRIBUTE_RETURN_CHECK; int virRegisterSecretDriver(virSecretDriverPtr) ATTRIBUTE_RETURN_CHECK; -# ifdef WITH_LIBVIRTD int virRegisterStateDriver(virStateDriverPtr) ATTRIBUTE_RETURN_CHECK; -# endif int virRegisterStorageDriver(virStorageDriverPtr) ATTRIBUTE_RETURN_CHECK; void *virDriverLoadModule(const char *name); diff --git a/src/libvirt.c b/src/libvirt.c index d51c014..43eb95c 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -135,10 +135,8 @@ static virSecretDriverPtr virSecretDriverTab[MAX_DRIVERS]; static int virSecretDriverTabCount; static virNWFilterDriverPtr virNWFilterDriverTab[MAX_DRIVERS]; static int virNWFilterDriverTabCount; -#ifdef WITH_LIBVIRTD static virStateDriverPtr virStateDriverTab[MAX_DRIVERS]; static int virStateDriverTabCount; -#endif #if defined(POLKIT_AUTH) @@ -691,7 +689,6 @@ virRegisterHypervisorDriver(virHypervisorDriverPtr driver) } -#ifdef WITH_LIBVIRTD /** * virRegisterStateDriver: * @driver: pointer to a driver block @@ -826,7 +823,6 @@ virStateStop(void) } return ret; } -#endif /* WITH_LIBVIRTD */ /** diff --git a/src/libvirt_daemon.syms b/src/libvirt_daemon.syms deleted file mode 100644 index 2855f00..0000000 --- a/src/libvirt_daemon.syms +++ /dev/null @@ -1,15 +0,0 @@ -# -# These symbols are dependent upon --with-libvirtd via WITH_LIBVIRTD. -# - -# libvirt_internal.h -virRegisterStateDriver; -virStateCleanup; -virStateInitialize; -virStateReload; -virStateStop; - -# Let emacs know we want case-insensitive sorting -# Local Variables: -# sort-fold-case: t -# End: diff --git a/src/libvirt_internal.h b/src/libvirt_internal.h index 304d90f..1313b58 100644 --- a/src/libvirt_internal.h +++ b/src/libvirt_internal.h @@ -30,14 +30,12 @@ typedef void (*virStateInhibitCallback)(bool inhibit, void *opaque); -# ifdef WITH_LIBVIRTD int virStateInitialize(bool privileged, virStateInhibitCallback inhibit, void *opaque); int virStateCleanup(void); int virStateReload(void); int virStateStop(void); -# endif /* Feature detection. This is a libvirt-private interface for determining * what features are supported by the driver. diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a2eec83..7df5972 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -889,7 +889,12 @@ virRegisterNetworkDriver; virRegisterNodeDeviceDriver; virRegisterNWFilterDriver; virRegisterSecretDriver; +virRegisterStateDriver; virRegisterStorageDriver; +virStateCleanup; +virStateInitialize; +virStateReload; +virStateStop; # locking/domain_lock.h diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 3cc603f..0ad0531 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -164,7 +164,6 @@ static void make_nonnull_domain_snapshot(remote_nonnull_domain_snapshot *snapsho /* Helper functions for remoteOpen. */ static char *get_transport_from_scheme(char *scheme); -#ifdef WITH_LIBVIRTD static int remoteStateInitialize(bool privileged ATTRIBUTE_UNUSED, virStateInhibitCallback callback ATTRIBUTE_UNUSED, @@ -176,7 +175,6 @@ remoteStateInitialize(bool privileged ATTRIBUTE_UNUSED, inside_daemon = true; return 0; } -#endif static void @@ -8433,12 +8431,10 @@ static virNWFilterDriver nwfilter_driver = { }; -#ifdef WITH_LIBVIRTD static virStateDriver state_driver = { .name = "Remote", .stateInitialize = remoteStateInitialize, }; -#endif /** remoteRegister: @@ -8464,10 +8460,8 @@ remoteRegister(void) return -1; if (virRegisterNWFilterDriver(&nwfilter_driver) < 0) return -1; -#ifdef WITH_LIBVIRTD if (virRegisterStateDriver(&state_driver) < 0) return -1; -#endif return 0; } -- 2.1.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list