Skip to contentSkip to conversation

master - lvm: drop usage of dl library

PATCH Zdenek Kabelac 1 participant 1 message Dec 17, 2018 Library code

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=701ecff0ff2c1a3d194a6d94b16b9ce6f0a2ba22
Commit:        701ecff0ff2c1a3d194a6d94b16b9ce6f0a2ba22
Parent:        8bf445b2deed25f101e2861656ee19151ea7e335
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Fri Dec 14 21:51:11 2018 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Mon Dec 17 10:36:52 2018 +0100

lvm: drop usage of dl library

Since lvm no longer supports any dlopen-able plugins (which in practice was never really usable) drop linking with -ldl.

---
 lib/Makefile.in            |   11 +-----
 lib/commands/toolcontext.c |   93 --------------------------------------------
 lib/misc/sharedlib.c       |   30 +--------------
 lib/misc/sharedlib.h       |    3 -
 make.tmpl.in               |    2 +-
 test/unit/Makefile         |    2 +-
 6 files changed, 4 insertions(+), 137 deletions(-)
lib/Makefile.in +1 -10
index 722e954..bde66f9 100644
@@ -91,6 +91,7 @@ SOURCES =\
 	misc/lvm-string.c \
 	misc/lvm-wrappers.c \
 	misc/lvm-percent.c \
+	misc/sharedlib.c \
 	mm/memlock.c \
 	notify/lvmnotify.c \
 	properties/prop_common.c \
@@ -109,10 +110,6 @@ ifeq ("@DEVMAPPER@", "yes")
 	activate/fs.c
 endif
 
-ifeq ("@HAVE_LIBDL@", "yes")
-  SOURCES += misc/sharedlib.c
-endif
-
 ifeq ("@BUILD_LVMPOLLD@", "yes")
   SOURCES +=\
 	lvmpolld/lvmpolld-client.c
@@ -130,12 +127,6 @@ endif
 LIB_NAME = liblvm-internal
 LIB_STATIC = $(LIB_NAME).a
 
-ifeq ($(MAKECMDGOALS),distclean)
-  SUBDIRS =\
-	notify \
-	locking
-endif
-
 CFLOW_LIST = $(SOURCES)
 CFLOW_LIST_TARGET = $(LIB_NAME).cflow
 
lib/commands/toolcontext.c +0 -93

128 lines not on this page · raw message

lib/misc/sharedlib.c +1 -29
index 4c2d5d9..544bb5f 100644
@@ -14,8 +14,8 @@
  */
 
 #include "lib/misc/lib.h"
+#include "sharedlib.h"
 #include "lib/config/config.h"
-#include "lib/misc/sharedlib.h"
 #include "lib/commands/toolcontext.h"
 
 #include <limits.h>
@@ -40,31 +40,3 @@ void get_shared_library_path(struct cmd_context *cmd, const char *libname,
 		(void) dm_strncpy(path, libname, path_len);
 	}
 }
-
-void *load_shared_library(struct cmd_context *cmd, const char *libname,
-			  const char *desc, int silent)
-{
-	char path[PATH_MAX];
-	void *library;
-
-	if (is_static()) {
-		log_error("Not loading shared %s library %s in static mode.",
-			  desc, libname);
-		return NULL;
-	}
-
-	get_shared_library_path(cmd, libname, path, sizeof(path));
-
-	log_very_verbose("Opening shared %s library %s", desc, path);
-
-	if (!(library = dlopen(path, RTLD_LAZY | RTLD_GLOBAL))) {
-		if (silent)
-			log_verbose("Unable to open external %s library %s: %s",
-				    desc, path, dlerror());
-		else
-			log_error("Unable to open external %s library %s: %s",
-				  desc, path, dlerror());
-	}
-
-	return library;
-}
lib/misc/sharedlib.h +0 -3
index 5ff2dcb..23f2acc 100644
@@ -21,7 +21,4 @@
 
 void get_shared_library_path(struct cmd_context *cmd, const char *libname,
 			     char *path, size_t path_len);
-void *load_shared_library(struct cmd_context *cmd, const char *libname,
-			  const char *what, int silent);
-
 #endif
make.tmpl.in +1 -1
index 1a101fc..13f9afc 100644
@@ -75,7 +75,7 @@ LDDEPS += @LDDEPS@
 LIB_SUFFIX = @LIB_SUFFIX@
 LVMINTERNAL_LIBS=\
 	-llvm-internal \
-	$(DMEVENT_LIBS) $(DAEMON_LIBS) $(SYSTEMD_LIBS) $(UDEV_LIBS) $(DL_LIBS) $(BLKID_LIBS)
+	$(DAEMON_LIBS) $(DMEVENT_LIBS) $(SYSTEMD_LIBS) $(UDEV_LIBS) $(BLKID_LIBS)
 DL_LIBS = @DL_LIBS@
 RT_LIBS = @RT_LIBS@
 M_LIBS = @M_LIBS@
test/unit/Makefile +1 -1
index 0ba98ee..fa6acb6 100644
@@ -41,7 +41,7 @@ CLEAN_TARGETS += $(UNIT_DEPENDS) $(UNIT_OBJECTS) \
 test/unit/unit-test: $(UNIT_OBJECTS) lib/liblvm-internal.a libdaemon/client/libdaemonclient.a $(INTERNAL_LIBS)
 	@echo "    [LD] $@"
 	$(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) \
-	      -o $@ $+ $(DMEVENT_LIBS) $(SYSTEMD_LIBS) $(LIBS) -ldl -laio
+	      -o $@ $+ $(DMEVENT_LIBS) $(SYSTEMD_LIBS) $(LIBS) -laio
 
 .PHONEY: run-unit-test unit-test
 unit-test: test/unit/unit-test