summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WHATS_NEW1
-rwxr-xr-xconfigure50
-rw-r--r--configure.in9
-rw-r--r--lib/misc/lvm-exec.c64
-rw-r--r--lib/misc/lvm-exec.h19
-rw-r--r--lib/snapshot/snapshot.c2
-rw-r--r--tools/polldaemon.c7
-rw-r--r--tools/toollib.c44
-rw-r--r--tools/toollib.h3
-rw-r--r--tools/tools.h1
10 files changed, 143 insertions, 57 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 5c630f12..a35e9806 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.00 -
===================================
+ Attempt to load missing targets using modprobe.
Add -a to lvscan.
Move mknodes into libdevmapper.
Move bitset, hash, pool and dbg_malloc into libdevmapper.
diff --git a/configure b/configure
index 7a6cff5d..53eb5cc2 100755
--- a/configure
+++ b/configure
@@ -310,7 +310,7 @@ ac_includes_default="\
#endif"
ac_default_prefix=/usr
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os AWK CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SET_MAKE RANLIB ac_ct_RANLIB CPP EGREP ALLOCA LIBOBJS POW_LIB MSGFMT JOBS STATIC_LINK LVM1 POOL SNAPSHOTS MIRRORS OWNER GROUP COPTIMISE_FLAG CLDFLAGS CLDWHOLEARCHIVE CLDNOWHOLEARCHIVE LDDEPS SOFLAG LVM_VERSION LVM1_FALLBACK DEBUG DEVMAPPER HAVE_LIBDL HAVE_SELINUX CMDLIB LOCALEDIR CONFDIR STATICDIR INTL_PACKAGE INTL CLVMD CLUSTER FSADM LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os AWK CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SET_MAKE RANLIB ac_ct_RANLIB CPP EGREP ALLOCA LIBOBJS POW_LIB MSGFMT MODPROBE_CMD JOBS STATIC_LINK LVM1 POOL SNAPSHOTS MIRRORS OWNER GROUP COPTIMISE_FLAG CLDFLAGS CLDWHOLEARCHIVE CLDNOWHOLEARCHIVE LDDEPS SOFLAG LVM_VERSION LVM1_FALLBACK DEBUG DEVMAPPER HAVE_LIBDL HAVE_SELINUX CMDLIB LOCALEDIR CONFDIR STATICDIR INTL_PACKAGE INTL CLVMD CLUSTER FSADM LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -1465,7 +1465,7 @@ case "$host_os" in
LDDEPS="$LDDEPS"
LDFLAGS="$LDFLAGS"
SOFLAG="-dynamiclib"
- DEVMAPPER=no
+ DEVMAPPER=yes
ODIRECT=no
SELINUX=no
CLUSTER=none
@@ -10769,6 +10769,51 @@ done
fi
################################################################################
+# Extract the first word of "modprobe", so it can be a program name with args.
+set dummy modprobe; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_MODPROBE_CMD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $MODPROBE_CMD in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_MODPROBE_CMD="$MODPROBE_CMD" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_MODPROBE_CMD="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ ;;
+esac
+fi
+MODPROBE_CMD=$ac_cv_path_MODPROBE_CMD
+
+if test -n "$MODPROBE_CMD"; then
+ echo "$as_me:$LINENO: result: $MODPROBE_CMD" >&5
+echo "${ECHO_T}$MODPROBE_CMD" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+if test x$MODPROBE_CMD != x; then
+ CFLAGS="$CFLAGS -DMODPROBE_CMD=\\\"$MODPROBE_CMD\\\""
+fi
+
+################################################################################
if test "-f VERSION"; then
LVM_VERSION="\"`cat VERSION`\""
else
@@ -11501,6 +11546,7 @@ s,@ALLOCA@,$ALLOCA,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@POW_LIB@,$POW_LIB,;t t
s,@MSGFMT@,$MSGFMT,;t t
+s,@MODPROBE_CMD@,$MODPROBE_CMD,;t t
s,@JOBS@,$JOBS,;t t
s,@STATIC_LINK@,$STATIC_LINK,;t t
s,@LVM1@,$LVM1,;t t
diff --git a/configure.in b/configure.in
index 02ae9b89..684d03c7 100644
--- a/configure.in
+++ b/configure.in
@@ -50,7 +50,7 @@ case "$host_os" in
LDDEPS="$LDDEPS"
LDFLAGS="$LDFLAGS"
SOFLAG="-dynamiclib"
- DEVMAPPER=no
+ DEVMAPPER=yes
ODIRECT=no
SELINUX=no
CLUSTER=none
@@ -516,6 +516,13 @@ if test x$HAVE_SELINUX = xyes; then
fi
################################################################################
+AC_PATH_PROG(MODPROBE_CMD, modprobe)
+
+if test x$MODPROBE_CMD != x; then
+ CFLAGS="$CFLAGS -DMODPROBE_CMD=\\\"$MODPROBE_CMD\\\""
+fi
+
+################################################################################
if test "-f VERSION"; then
LVM_VERSION="\"`cat VERSION`\""
else
diff --git a/lib/misc/lvm-exec.c b/lib/misc/lvm-exec.c
new file mode 100644
index 00000000..209a2cc5
--- /dev/null
+++ b/lib/misc/lvm-exec.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
+ * Copyright (C) 2004-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "lib.h"
+#include "lvm-exec.h"
+
+#include <unistd.h>
+#include <sys/wait.h>
+
+/*
+ * Execute and wait for external command
+ */
+int exec_cmd(const char *command, const char *fscmd, const char *lv_path,
+ const char *size)
+{
+ pid_t pid;
+ int status;
+
+ log_verbose("Executing: %s %s %s %s", command, fscmd, lv_path, size);
+
+ if ((pid = fork()) == -1) {
+ log_error("fork failed: %s", strerror(errno));
+ return 0;
+ }
+
+ if (!pid) {
+ /* Child */
+ /* FIXME Use execve directly */
+ execlp(command, command, fscmd, lv_path, size, NULL);
+ log_sys_error("execlp", command);
+ exit(errno);
+ }
+
+ /* Parent */
+ if (wait4(pid, &status, 0, NULL) != pid) {
+ log_error("wait4 child process %u failed: %s", pid,
+ strerror(errno));
+ return 0;
+ }
+
+ if (!WIFEXITED(status)) {
+ log_error("Child %u exited abnormally", pid);
+ return 0;
+ }
+
+ if (WEXITSTATUS(status)) {
+ log_error("%s failed: %u", command, WEXITSTATUS(status));
+ return 0;
+ }
+
+ return 1;
+}
diff --git a/lib/misc/lvm-exec.h b/lib/misc/lvm-exec.h
new file mode 100644
index 00000000..9fbcdfec
--- /dev/null
+++ b/lib/misc/lvm-exec.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
+ * Copyright (C) 2004-2005 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "lib.h"
+
+int exec_cmd(const char *command, const char *fscmd, const char *lv_path,
+ const char *size);
diff --git a/lib/snapshot/snapshot.c b/lib/snapshot/snapshot.c
index 7f0b718a..a19d6794 100644
--- a/lib/snapshot/snapshot.c
+++ b/lib/snapshot/snapshot.c
@@ -27,7 +27,7 @@ static const char *_name(const struct lv_segment *seg)
}
static int _text_import(struct lv_segment *seg, const struct config_node *sn,
- struct hash_table *pv_hash)
+ struct dm_hash_table *pv_hash)
{
uint32_t chunk_size;
const char *org_name, *cow_name;
diff --git a/tools/polldaemon.c b/tools/polldaemon.c
index 39c43a16..34cc90cb 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -72,8 +72,6 @@ static int _check_mirror_status(struct cmd_context *cmd,
float segment_percent = 0.0, overall_percent = 0.0;
uint32_t event_nr = 0;
-void *x;
-
/* By default, caller should not retry */
*finished = 1;
@@ -87,7 +85,7 @@ void *x;
return 0;
}
- if (!lv_mirror_percent(lv_mirr, !parms->interval, &segment_percent,
+ if (!lv_mirror_percent(cmd, lv_mirr, !parms->interval, &segment_percent,
&event_nr)) {
log_error("ABORTING: Mirror percentage check failed.");
return 0;
@@ -99,9 +97,6 @@ void *x;
else
log_verbose("%s: Moved: %.1f%%", name, overall_percent);
-x = dm_pool_alloc(cmd->mem, 1);
-dm_pool_free(cmd->mem, x);
-
if (segment_percent < 100.0) {
/* The only case the caller *should* try again later */
*finished = 0;
diff --git a/tools/toollib.c b/tools/toollib.c
index c07a42bb..aa15cd43 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -969,50 +969,6 @@ struct volume_group *recover_vg(struct cmd_context *cmd, const char *vgname,
return vg_read(cmd, vgname, &consistent);
}
-/*
- * Execute and wait for external command
- */
-int exec_cmd(const char *command, const char *fscmd, const char *lv_path,
- const char *size)
-{
- pid_t pid;
- int status;
-
- log_verbose("Executing: %s %s %s %s", command, fscmd, lv_path, size);
-
- if ((pid = fork()) == -1) {
- log_error("fork failed: %s", strerror(errno));
- return 0;
- }
-
- if (!pid) {
- /* Child */
- /* FIXME Use execve directly */
- execlp(command, command, fscmd, lv_path, size, NULL);
- log_sys_error("execlp", command);
- exit(errno);
- }
-
- /* Parent */
- if (wait4(pid, &status, 0, NULL) != pid) {
- log_error("wait4 child process %u failed: %s", pid,
- strerror(errno));
- return 0;
- }
-
- if (!WIFEXITED(status)) {
- log_error("Child %u exited abnormally", pid);
- return 0;
- }
-
- if (WEXITSTATUS(status)) {
- log_error("%s failed: %u", command, WEXITSTATUS(status));
- return 0;
- }
-
- return 1;
-}
-
int apply_lvname_restrictions(const char *name)
{
if (!strncmp(name, "snapshot", 8)) {
diff --git a/tools/toollib.h b/tools/toollib.h
index 00b69bd1..9e8b3f33 100644
--- a/tools/toollib.h
+++ b/tools/toollib.h
@@ -86,9 +86,6 @@ struct list *create_pv_list(struct dm_pool *mem, struct volume_group *vg, int ar
struct list *clone_pv_list(struct dm_pool *mem, struct list *pvs);
-int exec_cmd(const char *command, const char *fscmd, const char *lv_path,
- const char *size);
-
int apply_lvname_restrictions(const char *name);
int validate_vg_name(struct cmd_context *cmd, const char *vg_name);
diff --git a/tools/tools.h b/tools/tools.h
index a074bb12..4d143af7 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -41,6 +41,7 @@
#include "metadata.h"
#include "list.h"
#include "locking.h"
+#include "lvm-exec.h"
#include "lvm-file.h"
#include "lvm-string.h"
#include "segtype.h"