]> sourceware.org Git - lvm2.git/commitdiff
dmsetup: move to libdm/dm-tools/dmsetup
authorJoe Thornber <ejt@redhat.com>
Thu, 14 Jun 2018 12:08:33 +0000 (13:08 +0100)
committerJoe Thornber <ejt@redhat.com>
Thu, 14 Jun 2018 12:10:17 +0000 (13:10 +0100)
links against libdevmapper again.
no longer includes code from lvm.

configure
configure.ac
libdm/Makefile.in
libdm/dm-tools/.gitignore [new file with mode: 0644]
libdm/dm-tools/Makefile.in [new file with mode: 0644]
libdm/dm-tools/dmsetup.c [moved from tools/dmsetup.c with 99% similarity]
libdm/dm-tools/util.h [new file with mode: 0644]
tools/Makefile.in

index 323ab4a8efdf01dd0d5d679fdadf5d870d65899f..ed3a3156c9b3551e0ca05b02e5a85f96b18a332f 100755 (executable)
--- a/configure
+++ b/configure
@@ -11527,7 +11527,7 @@ if ${am_cv_pathless_PYTHON+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
-       for am_cv_pathless_PYTHON in python python2 python3  python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3  python3.2 python3.1 python3.0  python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1  python2.0 none; do
+       for am_cv_pathless_PYTHON in python python2 python3 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7  python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 none; do
          test "$am_cv_pathless_PYTHON" = none && break
          prog="import sys
 # split strings by '.' and convert to numeric.  Append some zeros
@@ -13611,7 +13611,7 @@ _ACEOF
 
 
 ################################################################################
-ac_config_files="$ac_config_files Makefile make.tmpl libdm/make.tmpl daemons/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/lvm2/Makefile daemons/dmeventd/plugins/raid/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/dmfilemapd/Makefile daemons/lvmdbusd/Makefile daemons/lvmdbusd/lvmdbusd daemons/lvmdbusd/lvmdb.py daemons/lvmdbusd/lvm_shell_proxy.py daemons/lvmdbusd/path.py daemons/lvmetad/Makefile daemons/lvmpolld/Makefile daemons/lvmlockd/Makefile conf/Makefile conf/example.conf conf/lvmlocal.conf conf/command_profile_template.profile conf/metadata_profile_template.profile include/Makefile lib/Makefile include/lvm-version.h libdaemon/Makefile libdaemon/client/Makefile libdaemon/server/Makefile libdm/Makefile libdm/libdevmapper.pc man/Makefile po/Makefile scripts/blkdeactivate.sh scripts/blk_availability_init_red_hat scripts/blk_availability_systemd_red_hat.service scripts/cmirrord_init_red_hat scripts/com.redhat.lvmdbus1.service scripts/dm_event_systemd_red_hat.service scripts/dm_event_systemd_red_hat.socket scripts/lvm2_cmirrord_systemd_red_hat.service scripts/lvm2_lvmdbusd_systemd_red_hat.service scripts/lvm2_lvmetad_init_red_hat scripts/lvm2_lvmetad_systemd_red_hat.service scripts/lvm2_lvmetad_systemd_red_hat.socket scripts/lvm2_lvmpolld_init_red_hat scripts/lvm2_lvmpolld_systemd_red_hat.service scripts/lvm2_lvmpolld_systemd_red_hat.socket scripts/lvm2_lvmlockd_systemd_red_hat.service scripts/lvm2_lvmlocking_systemd_red_hat.service scripts/lvm2_monitoring_init_red_hat scripts/lvm2_monitoring_systemd_red_hat.service scripts/lvm2_pvscan_systemd_red_hat@.service scripts/lvm2_tmpfiles_red_hat.conf scripts/lvmdump.sh scripts/Makefile test/Makefile tools/Makefile udev/Makefile"
+ac_config_files="$ac_config_files Makefile make.tmpl libdm/make.tmpl daemons/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/lvm2/Makefile daemons/dmeventd/plugins/raid/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/dmfilemapd/Makefile daemons/lvmdbusd/Makefile daemons/lvmdbusd/lvmdbusd daemons/lvmdbusd/lvmdb.py daemons/lvmdbusd/lvm_shell_proxy.py daemons/lvmdbusd/path.py daemons/lvmetad/Makefile daemons/lvmpolld/Makefile daemons/lvmlockd/Makefile conf/Makefile conf/example.conf conf/lvmlocal.conf conf/command_profile_template.profile conf/metadata_profile_template.profile include/Makefile lib/Makefile include/lvm-version.h libdaemon/Makefile libdaemon/client/Makefile libdaemon/server/Makefile libdm/Makefile libdm/dm-tools/Makefile libdm/libdevmapper.pc man/Makefile po/Makefile scripts/blkdeactivate.sh scripts/blk_availability_init_red_hat scripts/blk_availability_systemd_red_hat.service scripts/cmirrord_init_red_hat scripts/com.redhat.lvmdbus1.service scripts/dm_event_systemd_red_hat.service scripts/dm_event_systemd_red_hat.socket scripts/lvm2_cmirrord_systemd_red_hat.service scripts/lvm2_lvmdbusd_systemd_red_hat.service scripts/lvm2_lvmetad_init_red_hat scripts/lvm2_lvmetad_systemd_red_hat.service scripts/lvm2_lvmetad_systemd_red_hat.socket scripts/lvm2_lvmpolld_init_red_hat scripts/lvm2_lvmpolld_systemd_red_hat.service scripts/lvm2_lvmpolld_systemd_red_hat.socket scripts/lvm2_lvmlockd_systemd_red_hat.service scripts/lvm2_monitoring_init_red_hat scripts/lvm2_monitoring_systemd_red_hat.service scripts/lvm2_pvscan_systemd_red_hat@.service scripts/lvm2_tmpfiles_red_hat.conf scripts/lvmdump.sh scripts/Makefile test/Makefile tools/Makefile udev/Makefile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -14340,6 +14340,7 @@ do
     "libdaemon/client/Makefile") CONFIG_FILES="$CONFIG_FILES libdaemon/client/Makefile" ;;
     "libdaemon/server/Makefile") CONFIG_FILES="$CONFIG_FILES libdaemon/server/Makefile" ;;
     "libdm/Makefile") CONFIG_FILES="$CONFIG_FILES libdm/Makefile" ;;
+    "libdm/dm-tools/Makefile") CONFIG_FILES="$CONFIG_FILES libdm/dm-tools/Makefile" ;;
     "libdm/libdevmapper.pc") CONFIG_FILES="$CONFIG_FILES libdm/libdevmapper.pc" ;;
     "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
     "po/Makefile") CONFIG_FILES="$CONFIG_FILES po/Makefile" ;;
@@ -14359,7 +14360,6 @@ do
     "scripts/lvm2_lvmpolld_systemd_red_hat.service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmpolld_systemd_red_hat.service" ;;
     "scripts/lvm2_lvmpolld_systemd_red_hat.socket") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmpolld_systemd_red_hat.socket" ;;
     "scripts/lvm2_lvmlockd_systemd_red_hat.service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmlockd_systemd_red_hat.service" ;;
-    "scripts/lvm2_lvmlocking_systemd_red_hat.service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmlocking_systemd_red_hat.service" ;;
     "scripts/lvm2_monitoring_init_red_hat") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_monitoring_init_red_hat" ;;
     "scripts/lvm2_monitoring_systemd_red_hat.service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_monitoring_systemd_red_hat.service" ;;
     "scripts/lvm2_pvscan_systemd_red_hat@.service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_pvscan_systemd_red_hat@.service" ;;
index 4c431e4b3095462c12d6d814daae267d8aaf2c24..42f19fd6e17cccef0d1c0d276ce61c7a837345b5 100644 (file)
@@ -1785,6 +1785,7 @@ libdaemon/Makefile
 libdaemon/client/Makefile
 libdaemon/server/Makefile
 libdm/Makefile
+libdm/dm-tools/Makefile
 libdm/libdevmapper.pc
 man/Makefile
 po/Makefile
index eeef0801dab28cabad620a666528ff0da5d60fd6..6472da74c5e513c3cf24dd6a7124b6714b754b37 100644 (file)
@@ -16,6 +16,8 @@ srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 top_builddir = @top_builddir@
 
+SUBDIRS=dm-tools
+
 SOURCES =\
        datastruct/bitset.c \
        datastruct/hash.c \
diff --git a/libdm/dm-tools/.gitignore b/libdm/dm-tools/.gitignore
new file mode 100644 (file)
index 0000000..c42a5e0
--- /dev/null
@@ -0,0 +1 @@
+dmsetup
diff --git a/libdm/dm-tools/Makefile.in b/libdm/dm-tools/Makefile.in
new file mode 100644 (file)
index 0000000..b8d83ac
--- /dev/null
@@ -0,0 +1,69 @@
+#
+# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
+# Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
+#
+# This file is part of LVM2.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
+
+SOURCES=\
+
+SOURCES2=\
+       dmsetup.c
+
+TARGETS_DM = dmsetup
+
+INSTALL_DMSETUP_TARGETS = install_dmsetup_dynamic
+
+ifeq ("@STATIC_LINK@", "yes")
+  TARGETS_DM += dmsetup.static
+  INSTALL_DMSETUP_TARGETS += install_dmsetup_static
+endif
+
+CLEAN_TARGETS = $(TARGETS_DM) \
+       dmsetup.static \
+       $(LDDEPS) .exported_symbols_generated
+
+include $(top_builddir)/libdm/make.tmpl
+
+device-mapper: $(TARGETS_DM)
+
+CFLAGS_dmsetup.o += $(UDEV_CFLAGS) $(EXTRA_EXEC_CFLAGS)
+
+dmsetup: dmsetup.o
+       @echo "    [CC] $@"
+       $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) \
+             -o $@ $+ $(LIBS) -L$(top_builddir)/libdm -ldevmapper -lm
+
+dmsetup.static: dmsetup.o $(INTERNAL_LIBS)
+       @echo "    [CC] $@"
+       $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) \
+             -o $@ $+ $(M_LIBS) $(PTHREAD_LIBS) $(STATIC_LIBS) $(LIBS)
+
+all: device-mapper
+
+.PHONY: install_dmsetup_dynamic install_dmsetup_static
+
+install_dmsetup_dynamic: dmsetup
+       @echo "    [INSTALL] $<"
+       $(Q) $(INSTALL_PROGRAM) -D $< $(sbindir)/$(<F)
+       $(Q) $(LN_S) -f $(<F) $(sbindir)/dmstats
+
+install_dmsetup_static: dmsetup.static
+       @echo "    [INSTALL] $<"
+       $(Q) $(INSTALL_PROGRAM) -D $< $(staticdir)/$(<F)
+       $(Q) $(LN_S) -f $(<F) $(staticdir)/dmstats
+
+install_device-mapper: $(INSTALL_DMSETUP_TARGETS)
+
+install: install_device-mapper
similarity index 99%
rename from tools/dmsetup.c
rename to libdm/dm-tools/dmsetup.c
index 7c5a2b3236093926d599fc7ed0e81dd51279a4af..83786f44de8ca53d6e96e3eb9fa2ceab17997e6c 100644 (file)
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#include "tools/tool.h"
 
-#include "base/memory/zalloc.h"
-#include "device_mapper/misc/dm-logging.h"
+// For canonicalize_file_name()
+#define _GNU_SOURCE
+#include <stdlib.h>
+
+#include "libdm/misc/dm-logging.h"
+#include "libdm/dm-tools/util.h"
+#include "configure.h"
 
 #include <ctype.h>
 #include <dirent.h>
-#include <sys/wait.h>
-#include <sys/param.h>
-#include <locale.h>
-#include <langinfo.h>
-#include <time.h>
-
 #include <fcntl.h>
+#include <langinfo.h>
+#include <locale.h>
+#include <stdlib.h>
+#include <sys/param.h>
 #include <sys/stat.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
 
 #ifdef UDEV_SYNC_SUPPORT
 #  include <sys/types.h>
@@ -64,8 +69,6 @@
 #else
 struct option {
 };
-extern int optind;
-extern char *optarg;
 #  define GETOPTLONG_FN(a, b, c, d, e) getopt((a), (b), (c))
 #  define OPTIND_INIT 1
 #endif
@@ -1530,7 +1533,7 @@ static int _message(CMD_ARGS)
        for (i = 0; i < argc; i++)
                sz += strlen(argv[i]) + 1;
 
-       if (!(str = zalloc(sz))) {
+       if (!(str = dm_zalloc(sz))) {
                log_error("Message string allocation failed.");
                goto out;
        }
diff --git a/libdm/dm-tools/util.h b/libdm/dm-tools/util.h
new file mode 100644 (file)
index 0000000..730b903
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2007 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _LVM_UTIL_H
+#define _LVM_UTIL_H
+
+#include <inttypes.h>
+
+#define min(a, b) ({ typeof(a) _a = (a); \
+                    typeof(b) _b = (b); \
+                    (void) (&_a == &_b); \
+                    _a < _b ? _a : _b; })
+
+#define max(a, b) ({ typeof(a) _a = (a); \
+                    typeof(b) _b = (b); \
+                    (void) (&_a == &_b); \
+                    _a > _b ? _a : _b; })
+
+#define is_power_of_2(n) ((n) && !((n) & ((n) - 1)))
+
+#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
+#define uninitialized_var(x) x
+#else
+#define uninitialized_var(x) x = x
+#endif
+
+#define KERNEL_VERSION(major, minor, release) (((major) << 16) + ((minor) << 8) + (release))
+
+/* Define some portable printing types */
+#define PRIsize_t "zu"
+#define PRIssize_t "zd"
+#define PRIptrdiff_t "td"
+#define PRIpid_t PRId32
+
+/* For convenience */
+#define FMTsize_t "%" PRIsize_t
+#define FMTssize_t "%" PRIssize_t
+#define FMTptrdiff_t "%" PRIptrdiff_t
+#define FMTpid_t "%" PRIpid_t
+
+#define FMTd8  "%" PRId8
+#define FMTd16 "%" PRId16
+#define FMTd32 "%" PRId32
+#define FMTd64 "%" PRId64
+
+#define FMTi8  "%" PRIi8
+#define FMTi16 "%" PRIi16
+#define FMTi32 "%" PRIi32
+#define FMTi64 "%" PRIi64
+
+#define FMTo8  "%" PRIo8
+#define FMTo16 "%" PRIo16
+#define FMTo32 "%" PRIo32
+#define FMTo64 "%" PRIo64
+
+#define FMTu8  "%" PRIu8
+#define FMTu16 "%" PRIu16
+#define FMTu32 "%" PRIu32
+#define FMTu64 "%" PRIu64
+
+#define FMTx8  "%" PRIx8
+#define FMTx16 "%" PRIx16
+#define FMTx32 "%" PRIx32
+#define FMTx64 "%" PRIx64
+
+#define FMTVGID "%." DM_TO_STRING(ID_LEN) "s"
+
+#endif
index 3785b508d1b3a1d207d7e0003762d6b48da4d249..7d9dd93daf1f09ef7297ef5944886d6f64364e28 100644 (file)
@@ -67,7 +67,6 @@ SOURCES =\
        vgsplit.c
 
 SOURCES2 =\
-       dmsetup.c \
        lvm.c \
        lvm2cmd-static.c \
        lvm2cmd.c \
@@ -80,17 +79,13 @@ TARGETS =\
        lvm \
        man-generator
 
-TARGETS_DM = dmsetup
-
 INSTALL_LVM_TARGETS = install_tools_dynamic
-INSTALL_DMSETUP_TARGETS = install_dmsetup_dynamic
+INSTALL_DMSETUP_TARGETS =
 INSTALL_CMDLIB_TARGETS = install_cmdlib_dynamic install_cmdlib_include 
 
 ifeq ("@STATIC_LINK@", "yes")
   TARGETS += lvm.static
-  TARGETS_DM += dmsetup.static
   INSTALL_LVM_TARGETS += install_tools_static
-  INSTALL_DMSETUP_TARGETS += install_dmsetup_static
   INSTALL_CMDLIB_TARGETS += install_cmdlib_static
 endif
 
@@ -99,7 +94,7 @@ LIB_VERSION = $(LIB_VERSION_LVM)
 
 CLEAN_TARGETS = liblvm2cmd.$(LIB_SUFFIX) $(TARGETS_DM) \
        liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION) lvm-static.o \
-       liblvm2cmd-static.a dmsetup.static lvm.static \
+       liblvm2cmd-static.a lvm.static \
        $(LDDEPS) .exported_symbols_generated \
        cmds.h command-lines-input.h command-count.h man-generator.c
 
@@ -117,19 +112,7 @@ CFLOW_TARGET = lvm
 
 include $(top_builddir)/make.tmpl
 
-device-mapper: $(TARGETS_DM)
-
-CFLAGS_dmsetup.o += $(UDEV_CFLAGS) $(EXTRA_EXEC_CFLAGS)
-
-dmsetup: dmsetup.o $(INTERNAL_LIBS)
-       @echo "    [CC] $@"
-       $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) \
-             -o $@ $+ $(LIBS) -lm
-
-dmsetup.static: dmsetup.o $(INTERNAL_LIBS)
-       @echo "    [CC] $@"
-       $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) \
-             -o $@ $+ $(M_LIBS) $(PTHREAD_LIBS) $(STATIC_LIBS) $(LIBS)
+device-mapper:
 
 all: device-mapper
 
@@ -225,8 +208,7 @@ CFLOW_SOURCES = $(addprefix $(srcdir)/, $(SOURCES))
 endif
 
 .PHONY: install_cmdlib_dynamic install_cmdlib_static install_cmdlib_include \
-       install_tools_dynamic install_tools_static \
-       install_dmsetup_dynamic install_dmsetup_static
+       install_tools_dynamic install_tools_static
 
 install_cmdlib_include: $(srcdir)/lvm2cmd.h
        @echo "    [INSTALL] $<"
@@ -255,18 +237,6 @@ install_tools_static: lvm.static
        @echo "    [INSTALL] $<"
        $(Q) $(INSTALL_PROGRAM) -D $< $(staticdir)/$(<F)
 
-install_dmsetup_dynamic: dmsetup
-       @echo "    [INSTALL] $<"
-       $(Q) $(INSTALL_PROGRAM) -D $< $(sbindir)/$(<F)
-       $(Q) $(LN_S) -f $(<F) $(sbindir)/dmstats
-
-install_dmsetup_static: dmsetup.static
-       @echo "    [INSTALL] $<"
-       $(Q) $(INSTALL_PROGRAM) -D $< $(staticdir)/$(<F)
-       $(Q) $(LN_S) -f $(<F) $(staticdir)/dmstats
-
-install_device-mapper: $(INSTALL_DMSETUP_TARGETS)
-
 install_lvm2: $(INSTALL_LVM_TARGETS)
 
-install: install_lvm2 install_device-mapper
+install: install_lvm2
This page took 0.062867 seconds and 5 git commands to generate.