mirror of
git://sourceware.org/git/lvm2.git
synced 2025-12-28 04:23:49 +03:00
Compare commits
24 Commits
dm_v1_00_1
...
dm_v1_00_1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2ceecf95c | ||
|
|
9314c7c881 | ||
|
|
54abb2c572 | ||
|
|
8fa3bdd025 | ||
|
|
5e7a308528 | ||
|
|
7952177786 | ||
|
|
9afbe49c84 | ||
|
|
9f06ba2db3 | ||
|
|
fe55bfddcf | ||
|
|
c0842e6444 | ||
|
|
3fed20d06a | ||
|
|
5e8f2e2c04 | ||
|
|
e4df99ea84 | ||
|
|
b3276f5f11 | ||
|
|
32667ca256 | ||
|
|
bed122a170 | ||
|
|
14adc9b875 | ||
|
|
a8778bbc5a | ||
|
|
a54e641f44 | ||
|
|
5c99efe87a | ||
|
|
7da1d731ff | ||
|
|
af9828e819 | ||
|
|
7a27136142 | ||
|
|
012ad2d423 |
@@ -16,7 +16,7 @@ srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
SUBDIRS = include man
|
||||
SUBDIRS = doc include man
|
||||
|
||||
ifeq ("@INTL@", "yes")
|
||||
SUBDIRS += po
|
||||
|
||||
33
WHATS_NEW
33
WHATS_NEW
@@ -1,3 +1,36 @@
|
||||
Version 2.00.15 - 19 Apr 2004
|
||||
=============================
|
||||
configure --with-owner= --with-group= to avoid -o and -g args to 'install'
|
||||
|
||||
Version 2.00.14 - 16 Apr 2004
|
||||
=============================
|
||||
Use 64-bit file functions by default.
|
||||
|
||||
Version 2.00.13 - 16 Apr 2004
|
||||
=============================
|
||||
Set devices/md_component_detection = 1 to ignore devices containing md
|
||||
superblocks. [Luca Berra]
|
||||
Ignore error setting selinux file context if fs doesn't support it.
|
||||
|
||||
Version 2.00.12 - 14 Apr 2004
|
||||
=============================
|
||||
Install a default lvm.conf into /etc/lvm if there isn't one already.
|
||||
Allow different installation dir for lvm.static (configure --staticdir=)
|
||||
Fix inverted selinux error check.
|
||||
Recognise power2 in /proc/devices.
|
||||
Fix counting in lvs_in_vg_opened. [It ignored devices open more than once.]
|
||||
|
||||
Version 2.00.11 - 8 Apr 2004
|
||||
============================
|
||||
Set fallback_to_lvm1 in lvm.conf (or configure --enable-lvm1_fallback)
|
||||
to run lvm1 binaries if running a 2.4 kernel without device-mapper.
|
||||
|
||||
Version 2.00.10 - 7 Apr 2004
|
||||
============================
|
||||
More fixes for static build.
|
||||
Add basic selinux support.
|
||||
Fix sysfs detection.
|
||||
|
||||
Version 2.00.09 - 31 Mar 2004
|
||||
=============================
|
||||
Update copyright notices for Red Hat.
|
||||
|
||||
25
WHATS_NEW_DM
25
WHATS_NEW_DM
@@ -1,9 +1,30 @@
|
||||
Version 1.00.17 - 17 Apr 2004
|
||||
=============================
|
||||
configure --with-owner= --with-group= to avoid -o and -g args to 'install'
|
||||
Fix library selinux linking.
|
||||
|
||||
Version 1.00.16 - 16 Apr 2004
|
||||
=============================
|
||||
Ignore error setting selinux file context if fs doesn't support it.
|
||||
|
||||
Version 1.00.15 - 7 Apr 2004
|
||||
============================
|
||||
Fix status overflow check in kernel patches.
|
||||
|
||||
Version 1.00.14 - 6 Apr 2004
|
||||
============================
|
||||
Fix static selinux build.
|
||||
|
||||
Version 1.00.13 - 6 Apr 2004
|
||||
============================
|
||||
Add some basic selinux support.
|
||||
|
||||
Version 1.00.12 - 6 Apr 2004
|
||||
===========================
|
||||
============================
|
||||
Fix dmsetup.static install.
|
||||
|
||||
Version 1.00.11 - 5 Apr 2004
|
||||
===========================
|
||||
============================
|
||||
configure --enable-static_link does static build in addition to dynamic.
|
||||
Moved Makefile library targets definition into template.
|
||||
|
||||
|
||||
135
configure
vendored
135
configure
vendored
@@ -309,7 +309,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 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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os MSGFMT JOBS STATIC_LINK LVM1 OWNER GROUP CLDFLAGS CLDWHOLEARCHIVE CLDNOWHOLEARCHIVE LD_DEPS LD_FLAGS SOFLAG LVM_VERSION DEBUG DEVMAPPER HAVE_LIBDL CMDLIB LOCALEDIR INTL_PACKAGE INTL LIBOBJS 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 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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os MSGFMT JOBS STATIC_LINK LVM1 OWNER GROUP CLDFLAGS CLDWHOLEARCHIVE CLDNOWHOLEARCHIVE LD_DEPS LD_FLAGS SOFLAG LVM_VERSION LVM1_FALLBACK DEBUG DEVMAPPER HAVE_LIBDL HAVE_SELINUX CMDLIB LOCALEDIR CONFDIR STATICDIR INTL_PACKAGE INTL LIBOBJS LTLIBOBJS'
|
||||
ac_subst_files=''
|
||||
|
||||
# Initialize some variables set by options.
|
||||
@@ -845,6 +845,8 @@ if test -n "$ac_init_help"; then
|
||||
Optional Features:
|
||||
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
|
||||
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
||||
--enable-lvm1_fallback Use this to fall back and use LVM1 binaries if
|
||||
device-mapper is missing from the kernel
|
||||
--enable-jobs=NUM Number of jobs to run simultaneously
|
||||
--enable-static_link Use this to link the tools to their libraries
|
||||
statically. Default is dynamic linking
|
||||
@@ -863,6 +865,8 @@ Optional Packages:
|
||||
--with-lvm1=TYPE LVM1 metadata support: internal/shared/none
|
||||
TYPE=internal
|
||||
--with-localedir=DIR Translation files in DIR PREFIX/share/locale
|
||||
--with-confdir=DIR Configuration files in DIR /etc
|
||||
--with-staticdir=DIR Static binary in DIR EXEC_PREFIX/sbin
|
||||
|
||||
Some influential environment variables:
|
||||
CC C compiler command
|
||||
@@ -3903,24 +3907,43 @@ esac
|
||||
|
||||
|
||||
|
||||
OWNER="root"
|
||||
GROUP="root"
|
||||
|
||||
|
||||
# Check whether --with-user or --without-user was given.
|
||||
if test "${with_user+set}" = set; then
|
||||
withval="$with_user"
|
||||
OWNER="$withval"
|
||||
else
|
||||
OWNER="root"
|
||||
fi;
|
||||
|
||||
if test x$OWNER != x; then
|
||||
OWNER="-o $OWNER"
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --with-group or --without-group was given.
|
||||
if test "${with_group+set}" = set; then
|
||||
withval="$with_group"
|
||||
GROUP="$withval"
|
||||
else
|
||||
GROUP="root"
|
||||
fi;
|
||||
|
||||
if test x$GROUP != x; then
|
||||
GROUP="-g $GROUP"
|
||||
fi
|
||||
|
||||
# Check whether --enable-lvm1_fallback or --disable-lvm1_fallback was given.
|
||||
if test "${enable_lvm1_fallback+set}" = set; then
|
||||
enableval="$enable_lvm1_fallback"
|
||||
LVM1_FALLBACK=$enableval
|
||||
else
|
||||
LVM1_FALLBACK=no
|
||||
fi;
|
||||
|
||||
if test x$LVM1_FALLBACK = xyes; then
|
||||
CFLAGS="$CFLAGS -DLVM1_FALLBACK"
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --with-lvm1 or --without-lvm1 was given.
|
||||
if test "${with_lvm1+set}" = set; then
|
||||
@@ -4592,13 +4615,79 @@ else
|
||||
fi
|
||||
|
||||
if [ "x$LVM1" = xshared -a "x$STATIC_LINK" = xyes ];
|
||||
then { { echo "$as_me:$LINENO: error: Features cannot be \"shared\" when building statically
|
||||
then { { echo "$as_me:$LINENO: error: Features cannot be 'shared' when building statically
|
||||
" >&5
|
||||
echo "$as_me: error: Features cannot be \"shared\" when building statically
|
||||
echo "$as_me: error: Features cannot be 'shared' when building statically
|
||||
" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
exit
|
||||
fi;
|
||||
fi
|
||||
|
||||
echo "$as_me:$LINENO: checking for is_selinux_enabled in -lselinux" >&5
|
||||
echo $ECHO_N "checking for is_selinux_enabled in -lselinux... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_selinux_is_selinux_enabled+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lselinux $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char is_selinux_enabled ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
is_selinux_enabled ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_lib_selinux_is_selinux_enabled=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_selinux_is_selinux_enabled=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_lib_selinux_is_selinux_enabled" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_selinux_is_selinux_enabled" >&6
|
||||
if test $ac_cv_lib_selinux_is_selinux_enabled = yes; then
|
||||
HAVE_SELINUX=yes
|
||||
else
|
||||
HAVE_SELINUX=no
|
||||
fi
|
||||
|
||||
|
||||
if test x$HAVE_SELINUX = xyes; then
|
||||
CFLAGS="$CFLAGS -DHAVE_SELINUX"
|
||||
LIBS="-lselinux $LIBS"
|
||||
fi
|
||||
|
||||
|
||||
for ac_header in getopt.h
|
||||
@@ -4976,6 +5065,25 @@ else
|
||||
fi;
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --with-confdir or --without-confdir was given.
|
||||
if test "${with_confdir+set}" = set; then
|
||||
withval="$with_confdir"
|
||||
CONFDIR="$withval"
|
||||
else
|
||||
CONFDIR='/etc'
|
||||
fi;
|
||||
|
||||
|
||||
# Check whether --with-staticdir or --without-staticdir was given.
|
||||
if test "${with_staticdir+set}" = set; then
|
||||
withval="$with_staticdir"
|
||||
STATICDIR="$withval"
|
||||
else
|
||||
STATICDIR='${exec_prefix}/sbin'
|
||||
fi;
|
||||
|
||||
|
||||
if test "-f VERSION"; then
|
||||
LVM_VERSION="\"`cat VERSION`\""
|
||||
else
|
||||
@@ -5005,7 +5113,11 @@ fi
|
||||
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files Makefile make.tmpl include/Makefile lib/Makefile lib/format1/Makefile man/Makefile po/Makefile tools/Makefile tools/version.h test/mm/Makefile test/device/Makefile test/format1/Makefile test/regex/Makefile test/filters/Makefile"
|
||||
|
||||
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files Makefile make.tmpl doc/Makefile include/Makefile lib/Makefile lib/format1/Makefile man/Makefile po/Makefile tools/Makefile tools/version.h test/mm/Makefile test/device/Makefile test/format1/Makefile test/regex/Makefile test/filters/Makefile"
|
||||
cat >confcache <<\_ACEOF
|
||||
# This file is a shell script that caches the results of configure
|
||||
# tests run on this system so they can be shared between configure
|
||||
@@ -5558,6 +5670,7 @@ do
|
||||
# Handling of arguments.
|
||||
"Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
||||
"make.tmpl" ) CONFIG_FILES="$CONFIG_FILES make.tmpl" ;;
|
||||
"doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
|
||||
"include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
|
||||
"lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
|
||||
"lib/format1/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/format1/Makefile" ;;
|
||||
@@ -5695,11 +5808,15 @@ s,@LD_DEPS@,$LD_DEPS,;t t
|
||||
s,@LD_FLAGS@,$LD_FLAGS,;t t
|
||||
s,@SOFLAG@,$SOFLAG,;t t
|
||||
s,@LVM_VERSION@,$LVM_VERSION,;t t
|
||||
s,@LVM1_FALLBACK@,$LVM1_FALLBACK,;t t
|
||||
s,@DEBUG@,$DEBUG,;t t
|
||||
s,@DEVMAPPER@,$DEVMAPPER,;t t
|
||||
s,@HAVE_LIBDL@,$HAVE_LIBDL,;t t
|
||||
s,@HAVE_SELINUX@,$HAVE_SELINUX,;t t
|
||||
s,@CMDLIB@,$CMDLIB,;t t
|
||||
s,@LOCALEDIR@,$LOCALEDIR,;t t
|
||||
s,@CONFDIR@,$CONFDIR,;t t
|
||||
s,@STATICDIR@,$STATICDIR,;t t
|
||||
s,@INTL_PACKAGE@,$INTL_PACKAGE,;t t
|
||||
s,@INTL@,$INTL,;t t
|
||||
s,@LIBOBJS@,$LIBOBJS,;t t
|
||||
|
||||
53
configure.in
53
configure.in
@@ -74,17 +74,34 @@ esac
|
||||
dnl -- prefix is /usr by default, the exec_prefix default is setup later
|
||||
AC_PREFIX_DEFAULT(/usr)
|
||||
|
||||
OWNER="root"
|
||||
GROUP="root"
|
||||
|
||||
dnl -- setup the ownership of the files
|
||||
AC_ARG_WITH(user,
|
||||
[ --with-user=USER Set the owner of installed files ],
|
||||
[ OWNER="$withval" ],
|
||||
[ OWNER="root" ])
|
||||
[ OWNER="$withval" ])
|
||||
|
||||
if test x$OWNER != x; then
|
||||
OWNER="-o $OWNER"
|
||||
fi
|
||||
|
||||
dnl -- setup the group ownership of the files
|
||||
AC_ARG_WITH(group,
|
||||
[ --with-group=GROUP Set the group owner of installed files ],
|
||||
[ GROUP="$withval" ],
|
||||
[ GROUP="root" ])
|
||||
[ GROUP="$withval" ])
|
||||
|
||||
if test x$GROUP != x; then
|
||||
GROUP="-g $GROUP"
|
||||
fi
|
||||
|
||||
dnl -- LVM1 tool fallback option
|
||||
AC_ARG_ENABLE(lvm1_fallback, [ --enable-lvm1_fallback Use this to fall back and use LVM1 binaries if
|
||||
device-mapper is missing from the kernel], LVM1_FALLBACK=$enableval, LVM1_FALLBACK=no)
|
||||
|
||||
if test x$LVM1_FALLBACK = xyes; then
|
||||
CFLAGS="$CFLAGS -DLVM1_FALLBACK"
|
||||
fi
|
||||
|
||||
dnl -- format1 inclusion type
|
||||
AC_ARG_WITH(lvm1,
|
||||
@@ -195,10 +212,18 @@ fi
|
||||
dnl Check for shared/static conflicts
|
||||
if [[ "x$LVM1" = xshared -a "x$STATIC_LINK" = xyes ]];
|
||||
then AC_MSG_ERROR(
|
||||
Features cannot be \"shared\" when building statically
|
||||
Features cannot be 'shared' when building statically
|
||||
)
|
||||
exit
|
||||
fi;
|
||||
fi
|
||||
|
||||
dnl Check for is_selinux_enabled
|
||||
AC_CHECK_LIB(selinux, is_selinux_enabled, HAVE_SELINUX=yes, HAVE_SELINUX=no)
|
||||
|
||||
if test x$HAVE_SELINUX = xyes; then
|
||||
CFLAGS="$CFLAGS -DHAVE_SELINUX"
|
||||
LIBS="-lselinux $LIBS"
|
||||
fi
|
||||
|
||||
dnl Check for getopt
|
||||
AC_CHECK_HEADERS(getopt.h, CFLAGS="$CFLAGS -DHAVE_GETOPTLONG")
|
||||
@@ -242,6 +267,17 @@ if test x$INTL = xyes; then
|
||||
[ LOCALEDIR='${prefix}/share/locale' ])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(confdir,
|
||||
[ --with-confdir=DIR Configuration files in DIR [/etc]],
|
||||
[ CONFDIR="$withval" ],
|
||||
[ CONFDIR='/etc' ])
|
||||
|
||||
AC_ARG_WITH(staticdir,
|
||||
[ --with-staticdir=DIR Static binary in DIR [EXEC_PREFIX/sbin]],
|
||||
[ STATICDIR="$withval" ],
|
||||
[ STATICDIR='${exec_prefix}/sbin' ])
|
||||
|
||||
|
||||
if test "-f VERSION"; then
|
||||
LVM_VERSION="\"`cat VERSION`\""
|
||||
else
|
||||
@@ -262,12 +298,16 @@ AC_SUBST(LD_FLAGS)
|
||||
AC_SUBST(SOFLAG)
|
||||
AC_SUBST(LIBS)
|
||||
AC_SUBST(LVM_VERSION)
|
||||
AC_SUBST(LVM1_FALLBACK)
|
||||
AC_SUBST(DEBUG)
|
||||
AC_SUBST(DEVMAPPER)
|
||||
AC_SUBST(HAVE_LIBDL)
|
||||
AC_SUBST(HAVE_SELINUX)
|
||||
AC_SUBST(CMDLIB)
|
||||
AC_SUBST(MSGFMT)
|
||||
AC_SUBST(LOCALEDIR)
|
||||
AC_SUBST(CONFDIR)
|
||||
AC_SUBST(STATICDIR)
|
||||
AC_SUBST(INTL_PACKAGE)
|
||||
AC_SUBST(INTL)
|
||||
|
||||
@@ -276,6 +316,7 @@ dnl keep utility scripts running properly
|
||||
AC_OUTPUT( \
|
||||
Makefile \
|
||||
make.tmpl \
|
||||
doc/Makefile \
|
||||
include/Makefile \
|
||||
lib/Makefile \
|
||||
lib/format1/Makefile \
|
||||
|
||||
29
doc/Makefile.in
Normal file
29
doc/Makefile.in
Normal file
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# Copyright (C) 2004 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This file is part of the 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
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
CONFSRC=example.conf
|
||||
CONFDEST=lvm.conf
|
||||
|
||||
include ../make.tmpl
|
||||
|
||||
install:
|
||||
@if [ ! -e $(confdir)/$(CONFDEST) ]; then \
|
||||
echo "Installing $(CONFSRC) as $(confdir)/$(CONFDEST)"; \
|
||||
@INSTALL@ -D $(OWNER) $(GROUP) -m 644 $(CONFSRC) \
|
||||
$(confdir)/$(CONFDEST); \
|
||||
fi
|
||||
|
||||
@@ -27,9 +27,6 @@ devices {
|
||||
# the device will be accepted or rejected (ignored). Devices that
|
||||
# don't match any patterns are accepted.
|
||||
|
||||
# If using RAID md devices as physical volumes, you should
|
||||
# set up a filter here to reject the constituent devices.
|
||||
|
||||
# Remember to run vgscan after you change this parameter to ensure
|
||||
# that the cache file gets regenerated (see below).
|
||||
|
||||
@@ -57,14 +54,21 @@ devices {
|
||||
# You can turn off writing this cache file by setting this to 0.
|
||||
write_cache_state = 1
|
||||
|
||||
# An advanced setting.
|
||||
# Advanced settings.
|
||||
|
||||
# List of pairs of additional acceptable block device types found
|
||||
# in /proc/devices with maximum (non-zero) number of partitions.
|
||||
# types = [ "fd", 16 ]
|
||||
|
||||
# If sysfs is mounted (2.6 kernels) restrict device scanning to
|
||||
# the block devices it believes are valid.
|
||||
# 1 enables; 0 disables.
|
||||
sysfs_scan = 1
|
||||
|
||||
# By default, LVM2 will ignore devices used as components of
|
||||
# software RAID (md) devices by looking for md superblocks.
|
||||
# 1 enables; 0 disables.
|
||||
md_component_detection = 1
|
||||
}
|
||||
|
||||
# This section that allows you to configure the nature of the
|
||||
@@ -175,6 +179,16 @@ global {
|
||||
# setting this to 0 should suppress the error messages.
|
||||
activation = 1
|
||||
|
||||
# If we can't communicate with device-mapper, should we try running
|
||||
# the LVM1 tools?
|
||||
# This option only applies to 2.4 kernels and is provided to help you
|
||||
# switch between device-mapper kernels and LVM1 kernels.
|
||||
# The LVM1 tools need to be installed with .lvm1 suffices
|
||||
# e.g. vgscan.lvm1 and they will stop working after you start using
|
||||
# the new lvm2 on-disk metadata format.
|
||||
# The default value is set when the tools are built.
|
||||
# fallback_to_lvm1 = 0
|
||||
|
||||
# The default metadata format that commands should use - "lvm1" or "lvm2".
|
||||
# The command line override is -M1 or -M2.
|
||||
# Defaults to "lvm1" if compiled in, else "lvm2".
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
../lib/device/device.h
|
||||
../lib/display/display.h
|
||||
../lib/filters/filter-composite.h
|
||||
../lib/filters/filter-md.h
|
||||
../lib/filters/filter-persistent.h
|
||||
../lib/filters/filter-regex.h
|
||||
../lib/filters/filter-sysfs.h
|
||||
@@ -34,6 +35,7 @@
|
||||
../lib/misc/lib.h
|
||||
../lib/misc/lvm-file.h
|
||||
../lib/misc/lvm-string.h
|
||||
../lib/misc/selinux.h
|
||||
../lib/misc/sharedlib.h
|
||||
../lib/regex/matcher.h
|
||||
../lib/report/report.h
|
||||
|
||||
@@ -37,6 +37,7 @@ SOURCES =\
|
||||
filters/filter-persistent.c \
|
||||
filters/filter-regex.c \
|
||||
filters/filter-sysfs.c \
|
||||
filters/filter-md.c \
|
||||
filters/filter.c \
|
||||
format_text/archive.c \
|
||||
format_text/export.c \
|
||||
@@ -95,6 +96,10 @@ ifeq ("@HAVE_LIBDL@", "yes")
|
||||
misc/sharedlib.c
|
||||
endif
|
||||
|
||||
ifeq ("@HAVE_SELINUX@", "yes")
|
||||
SOURCES += misc/selinux.c
|
||||
endif
|
||||
|
||||
LIB_STATIC = liblvm.a
|
||||
|
||||
$(SUBDIRS): $(LIB_STATIC)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "memlock.h"
|
||||
#include "display.h"
|
||||
#include "fs.h"
|
||||
#include "lvm-file.h"
|
||||
#include "lvm-string.h"
|
||||
#include "pool.h"
|
||||
#include "toolcontext.h"
|
||||
@@ -31,6 +32,22 @@
|
||||
|
||||
#define _skip(fmt, args...) log_very_verbose("Skipping: " fmt , ## args)
|
||||
|
||||
int lvm1_present(struct cmd_context *cmd)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
|
||||
if (lvm_snprintf(path, sizeof(path), "%s/lvm/global", cmd->proc_dir)
|
||||
< 0) {
|
||||
log_error("LVM1 proc global snprintf failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (path_exists(path))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef DEVMAPPER_SUPPORT
|
||||
void set_activation(int act)
|
||||
{
|
||||
@@ -523,7 +540,7 @@ int lvs_in_vg_opened(struct volume_group *vg)
|
||||
|
||||
list_iterate(lvh, &vg->lvs) {
|
||||
lv = list_item(lvh, struct lv_list)->lv;
|
||||
count += (_lv_open_count(lv) == 1);
|
||||
count += (_lv_open_count(lv) > 0);
|
||||
}
|
||||
|
||||
return count;
|
||||
|
||||
@@ -36,6 +36,7 @@ int activation(void);
|
||||
|
||||
int driver_version(char *version, size_t size);
|
||||
int library_version(char *version, size_t size);
|
||||
int lvm1_present(struct cmd_context *cmd);
|
||||
|
||||
int target_present(const char *target_name);
|
||||
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
#include "lvm-file.h"
|
||||
#include "memlock.h"
|
||||
|
||||
#ifdef HAVE_SELINUX
|
||||
# include "selinux.h"
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
@@ -175,6 +179,13 @@ static int _mk_link(const char *dev_dir, const char *vg_name,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SELINUX
|
||||
if (!set_selinux_context(lv_path)) {
|
||||
log_sys_error("set_selinux_context", lv_path);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "activate.h"
|
||||
#include "filter.h"
|
||||
#include "filter-composite.h"
|
||||
#include "filter-md.h"
|
||||
#include "filter-persistent.h"
|
||||
#include "filter-regex.h"
|
||||
#include "filter-sysfs.h"
|
||||
@@ -275,7 +276,7 @@ static int _init_dev_cache(struct cmd_context *cmd)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define MAX_FILTERS 3
|
||||
#define MAX_FILTERS 4
|
||||
|
||||
static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
|
||||
{
|
||||
@@ -285,14 +286,24 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
|
||||
|
||||
memset(filters, 0, sizeof(filters));
|
||||
|
||||
/* sysfs filter */
|
||||
/*
|
||||
* Filters listed in order: top one gets applied first.
|
||||
* Failure to initialise some filters is not fatal.
|
||||
* Update MAX_FILTERS definition above when adding new filters.
|
||||
*/
|
||||
|
||||
/*
|
||||
* sysfs filter. Only available on 2.6 kernels. Non-critical.
|
||||
* Listed first because it's very efficient at eliminating
|
||||
* unavailable devices.
|
||||
*/
|
||||
if (find_config_bool(cmd->cft->root, "devices/sysfs_scan",
|
||||
DEFAULT_SYSFS_SCAN)) {
|
||||
if ((filters[nr_filt] = sysfs_filter_create(cmd->proc_dir)))
|
||||
nr_filt++;
|
||||
}
|
||||
|
||||
/* regex filter */
|
||||
/* regex filter. Optional. */
|
||||
if (!(cn = find_config_node(cmd->cft->root, "devices/filter")))
|
||||
log_debug("devices/filter not found in config file: no regex "
|
||||
"filter installed");
|
||||
@@ -302,14 +313,21 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* device type filter */
|
||||
/* device type filter. Required. */
|
||||
cn = find_config_node(cmd->cft->root, "devices/types");
|
||||
if (!(filters[nr_filt++] = lvm_type_filter_create(cmd->proc_dir, cn))) {
|
||||
log_error("Failed to create lvm type filter");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* only build a composite filter if we really need it */
|
||||
/* md component filter. Optional, non-critical. */
|
||||
if (find_config_bool(cmd->cft->root, "devices/md_component_detection",
|
||||
DEFAULT_MD_COMPONENT_DETECTION)) {
|
||||
if ((filters[nr_filt] = md_filter_create()))
|
||||
nr_filt++;
|
||||
}
|
||||
|
||||
/* Only build a composite filter if we really need it. */
|
||||
return (nr_filt == 1) ?
|
||||
filters[0] : composite_filter_create(nr_filt, filters);
|
||||
}
|
||||
@@ -450,6 +468,11 @@ static int _init_hostname(struct cmd_context *cmd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(cmd->kernel_vsn = pool_strdup(cmd->libmem, uts.release))) {
|
||||
log_error("_init_hostname: pool_strdup kernel_vsn failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ struct cmd_context {
|
||||
|
||||
struct list formats; /* Available formats */
|
||||
const char *hostname;
|
||||
const char *kernel_vsn;
|
||||
|
||||
char *cmd_line;
|
||||
struct command *command;
|
||||
|
||||
@@ -29,12 +29,19 @@
|
||||
#define DEFAULT_DEV_DIR "/dev"
|
||||
#define DEFAULT_PROC_DIR "/proc"
|
||||
#define DEFAULT_SYSFS_SCAN 1
|
||||
#define DEFAULT_MD_COMPONENT_DETECTION 1
|
||||
|
||||
#define DEFAULT_LOCK_DIR "/var/lock/lvm"
|
||||
#define DEFAULT_LOCKING_LIB "lvm2_locking.so"
|
||||
|
||||
#define DEFAULT_UMASK 0077
|
||||
|
||||
#ifdef LVM1_FALLBACK
|
||||
# define DEFAULT_FALLBACK_TO_LVM1 1
|
||||
#else
|
||||
# define DEFAULT_FALLBACK_TO_LVM1 0
|
||||
#endif
|
||||
|
||||
#ifdef LVM1_SUPPORT
|
||||
# define DEFAULT_FORMAT "lvm1"
|
||||
#else
|
||||
|
||||
@@ -51,12 +51,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* FIXME Use _llseek for 64-bit
|
||||
_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, loff_t *, res, uint, wh);
|
||||
if (_llseek((unsigned) fd, (ulong) (offset >> 32), (ulong) (offset & 0xFFFFFFFF), &pos, SEEK_SET) < 0) {
|
||||
*/
|
||||
|
||||
static LIST_INIT(_open_devices);
|
||||
|
||||
/*-----------------------------------------------------------------
|
||||
|
||||
98
lib/filters/filter-md.c
Normal file
98
lib/filters/filter-md.c
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (C) 2004 Luca Berra
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "lib.h"
|
||||
#include "filter-md.h"
|
||||
#include "metadata.h"
|
||||
|
||||
#ifdef linux
|
||||
|
||||
/* Lifted from <linux/raid/md_p.h> because of difficulty including it */
|
||||
|
||||
#define MD_SB_MAGIC 0xa92b4efc
|
||||
#define MD_RESERVED_BYTES (64 * 1024)
|
||||
#define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512)
|
||||
#define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) \
|
||||
- MD_RESERVED_SECTORS)
|
||||
|
||||
static int _ignore_md(struct dev_filter *f, struct device *dev)
|
||||
{
|
||||
uint64_t size, sector;
|
||||
uint32_t md_magic;
|
||||
|
||||
if (!dev_get_size(dev, &size)) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (size < MD_RESERVED_SECTORS * 2)
|
||||
/*
|
||||
* We could ignore it since it is obviously too
|
||||
* small, but that's not our job.
|
||||
*/
|
||||
return 1;
|
||||
|
||||
if (!dev_open(dev)) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
|
||||
sector = MD_NEW_SIZE_SECTORS(size);
|
||||
|
||||
/* Check if it is an md component device. */
|
||||
if (dev_read(dev, sector << SECTOR_SHIFT, sizeof(uint32_t), &md_magic)) {
|
||||
if (md_magic == MD_SB_MAGIC) {
|
||||
log_debug("%s: Skipping md component device",
|
||||
dev_name(dev));
|
||||
if (!dev_close(dev))
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!dev_close(dev))
|
||||
stack;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void _destroy(struct dev_filter *f)
|
||||
{
|
||||
dbg_free(f);
|
||||
}
|
||||
|
||||
struct dev_filter *md_filter_create(void)
|
||||
{
|
||||
struct dev_filter *f;
|
||||
|
||||
if (!(f = dbg_malloc(sizeof(*f)))) {
|
||||
log_error("md filter allocation failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
f->passes_filter = _ignore_md;
|
||||
f->destroy = _destroy;
|
||||
f->private = NULL;
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
struct dev_filter *md_filter_create(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
23
lib/filters/filter-md.h
Normal file
23
lib/filters/filter-md.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2004 Luca Berra
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _LVM_FILTER_MD_H
|
||||
#define _LVM_FILTER_MD_H
|
||||
|
||||
#include "dev-cache.h"
|
||||
|
||||
struct dev_filter *md_filter_create(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,7 +26,7 @@ static int _locate_sysfs_blocks(const char *proc, char *path, size_t len)
|
||||
char proc_mounts[PATH_MAX];
|
||||
int r = 0;
|
||||
FILE *fp;
|
||||
char *split[2], buffer[PATH_MAX + 16];
|
||||
char *split[4], buffer[PATH_MAX + 16];
|
||||
|
||||
if (!*proc) {
|
||||
log_verbose("No proc filesystem found: skipping sysfs filter");
|
||||
@@ -45,8 +45,8 @@ static int _locate_sysfs_blocks(const char *proc, char *path, size_t len)
|
||||
}
|
||||
|
||||
while (fgets(buffer, sizeof(buffer), fp)) {
|
||||
if (split_words(buffer, 2, split) == 2 &&
|
||||
!strcmp(split[0], "sysfs")) {
|
||||
if (split_words(buffer, 4, split) == 4 &&
|
||||
!strcmp(split[2], "sysfs")) {
|
||||
if (lvm_snprintf(path, len, "%s/%s", split[1],
|
||||
"block") >= 0) {
|
||||
r = 1;
|
||||
|
||||
@@ -53,6 +53,7 @@ static const device_info_t device_info[] = {
|
||||
{"ubd", 16}, /* User-mode virtual block device */
|
||||
{"ataraid", 16}, /* ATA Raid */
|
||||
{"drbd", 16}, /* Distributed Replicated Block Device */
|
||||
{"power2", 16}, /* EMC Powerpath */
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ include ../../make.tmpl
|
||||
.PHONY: install
|
||||
|
||||
install: liblvm2format1.so
|
||||
$(INSTALL) -D -o $(OWNER) -g $(GROUP) -m 555 $(STRIP) $< \
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
|
||||
$(libdir)/liblvm2format1.so.$(LIB_VERSION)
|
||||
$(LN_S) -f liblvm2format1.so.$(LIB_VERSION) $(libdir)/liblvm2format1.so
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#define _REENTRANT
|
||||
#define _GNU_SOURCE
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
#include "log.h"
|
||||
#include "dbg_malloc.h"
|
||||
|
||||
42
lib/misc/selinux.c
Normal file
42
lib/misc/selinux.c
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 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 "selinux.h"
|
||||
|
||||
#include <selinux/selinux.h>
|
||||
|
||||
int set_selinux_context(const char *path)
|
||||
{
|
||||
security_context_t scontext;
|
||||
|
||||
log_very_verbose("Setting SELinux context for %s", path);
|
||||
if (is_selinux_enabled() <= 0)
|
||||
return 0;
|
||||
|
||||
if (matchpathcon(path, 0, &scontext) < 0) {
|
||||
log_sys_error("matchpathcon", path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((lsetfilecon(path, scontext) < 0) && (errno != ENOTSUP)) {
|
||||
log_sys_error("lsetfilecon", path);
|
||||
free(scontext);
|
||||
return 0;
|
||||
}
|
||||
|
||||
free(scontext);
|
||||
return 1;
|
||||
}
|
||||
20
lib/misc/selinux.h
Normal file
20
lib/misc/selinux.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2004 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
|
||||
*/
|
||||
|
||||
#ifndef _LVM_SELINUX_H
|
||||
#define _LVM_SELINUX_H
|
||||
|
||||
int set_selinux_context(const char * path);
|
||||
|
||||
#endif
|
||||
@@ -39,24 +39,24 @@ install: $(INSTALL_TYPE)
|
||||
|
||||
install_dynamic: install_@interface@
|
||||
$(LN_S) -f libdevmapper.so.$(LIB_VERSION) $(libdir)/libdevmapper.so
|
||||
$(INSTALL) -D -o $(OWNER) -g $(GROUP) -m 444 libdevmapper.h \
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 444 libdevmapper.h \
|
||||
$(includedir)/libdevmapper.h
|
||||
|
||||
install_static: install_@interface@_static
|
||||
$(LN_S) -f libdevmapper.a.$(LIB_VERSION) $(libdir)/libdevmapper.a
|
||||
$(INSTALL) -D -o $(OWNER) -g $(GROUP) -m 444 libdevmapper.h \
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 444 libdevmapper.h \
|
||||
$(includedir)/libdevmapper.h
|
||||
|
||||
install_fs: fs/libdevmapper.so
|
||||
$(INSTALL) -D -o $(OWNER) -g $(GROUP) -m 555 $(STRIP) $< \
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
|
||||
$(libdir)/libdevmapper.so.$(LIB_VERSION)
|
||||
|
||||
install_ioctl: ioctl/libdevmapper.so
|
||||
$(INSTALL) -D -o $(OWNER) -g $(GROUP) -m 555 $(STRIP) $< \
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
|
||||
$(libdir)/libdevmapper.so.$(LIB_VERSION)
|
||||
|
||||
install_ioctl_static: ioctl/libdevmapper.a
|
||||
$(INSTALL) -D -o $(OWNER) -g $(GROUP) -m 555 $(STRIP) $< \
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
|
||||
$(libdir)/libdevmapper.a.$(LIB_VERSION)
|
||||
|
||||
.PHONY: distclean_lib distclean
|
||||
|
||||
@@ -29,6 +29,10 @@
|
||||
#include <linux/dm-ioctl.h>
|
||||
#include <linux/kdev_t.h>
|
||||
|
||||
#ifdef HAVE_SELINUX
|
||||
# include <selinux/selinux.h>
|
||||
#endif
|
||||
|
||||
#define DEV_DIR "/dev/"
|
||||
|
||||
static char _dm_dir[PATH_MAX] = DEV_DIR DM_DIR;
|
||||
@@ -197,6 +201,31 @@ int dm_task_add_target(struct dm_task *dmt, uint64_t start, uint64_t size,
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SELINUX
|
||||
static int _set_selinux_context(const char *path)
|
||||
{
|
||||
security_context_t scontext;
|
||||
|
||||
log_debug("Setting SELinux context for %s", path);
|
||||
if (is_selinux_enabled() <= 0)
|
||||
return 0;
|
||||
|
||||
if (matchpathcon(path, 0, &scontext) < 0) {
|
||||
log_error("%s: matchpathcon failed: %s", path, strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((lsetfilecon(path, scontext) < 0) && (errno != ENOTSUP)) {
|
||||
log_error("%s: lsetfilecon failed: %s", path, strerror(errno));
|
||||
free(scontext);
|
||||
return 0;
|
||||
}
|
||||
|
||||
free(scontext);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int _add_dev_node(const char *dev_name, uint32_t major, uint32_t minor)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
@@ -226,6 +255,10 @@ static int _add_dev_node(const char *dev_name, uint32_t major, uint32_t minor)
|
||||
log_error("Unable to make device node for '%s'", dev_name);
|
||||
return 0;
|
||||
}
|
||||
#ifdef HAVE_SELINUX
|
||||
if (!_set_selinux_context(path))
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
14
make.tmpl.in
14
make.tmpl.in
@@ -36,12 +36,14 @@ SOFLAG += @SOFLAG@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = $(DESTDIR)@bindir@
|
||||
confdir = $(DESTDIR)@CONFDIR@/lvm
|
||||
includedir = $(DESTDIR)@includedir@
|
||||
libdir = $(DESTDIR)@libdir@
|
||||
sbindir = $(DESTDIR)@sbindir@
|
||||
infodir = $(DESTDIR)@infodir@
|
||||
mandir = $(DESTDIR)@mandir@
|
||||
localedir = $(DESTDIR)@LOCALEDIR@
|
||||
staticdir = $(DESTDIR)@STATICDIR@
|
||||
|
||||
# setup misc variables
|
||||
# define the ownership variables for the binaries and man pages
|
||||
@@ -72,10 +74,6 @@ endif
|
||||
|
||||
LD_FLAGS += -L$(top_srcdir)/lib -L$(libdir)
|
||||
|
||||
ifeq ("@STATIC_LINK@", "yes")
|
||||
LD_FLAGS += -static
|
||||
endif
|
||||
|
||||
#CFLAGS += -DDEBUG_POOL
|
||||
#CFLAGS += -DBOUNDS_CHECK
|
||||
|
||||
@@ -140,16 +138,14 @@ $(TARGETS): $(OBJECTS)
|
||||
%.o: %.c
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
|
||||
|
||||
%.pot: %.c
|
||||
%.pot: %.c Makefile
|
||||
$(CC) -E $(INCLUDES) -include $(top_srcdir)/include/pogen.h \
|
||||
$(CFLAGS) $< > $@
|
||||
|
||||
%.pot: Makefile
|
||||
|
||||
%.so: %.o
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) %< -o $@
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
|
||||
|
||||
%.so: $(OBJECTS) $(LD_DEPS)
|
||||
$(LIB_SHARED): $(OBJECTS) $(LD_DEPS)
|
||||
$(CC) $(SOFLAG) -Wl,-soname,$(notdir $@).$(LIB_VERSION) \
|
||||
$(CLDFLAGS) $(OBJECTS) -o $@
|
||||
|
||||
|
||||
@@ -34,12 +34,12 @@ install:
|
||||
@for f in $(MAN8); \
|
||||
do \
|
||||
$(RM) $(MAN8DIR)/$$f; \
|
||||
@INSTALL@ -D -o $(OWNER) -g $(GROUP) -m 444 $$f $(MAN8DIR)/$$f; \
|
||||
@INSTALL@ -D $(OWNER) $(GROUP) -m 444 $$f $(MAN8DIR)/$$f; \
|
||||
done
|
||||
|
||||
@echo "Installing $(MAN5) in $(MAN5DIR)"
|
||||
@for f in $(MAN5); \
|
||||
do \
|
||||
$(RM) $(MAN5DIR)/$$f; \
|
||||
@INSTALL@ -D -o $(OWNER) -g $(GROUP) -m 444 $$f $(MAN5DIR)/$$f; \
|
||||
@INSTALL@ -D $(OWNER) $(GROUP) -m 444 $$f $(MAN5DIR)/$$f; \
|
||||
done
|
||||
|
||||
@@ -25,7 +25,7 @@ install: $(TARGETS)
|
||||
@echo Installing translation files in $(localedir)
|
||||
@( \
|
||||
for lang in $(LANGS); do \
|
||||
$(INSTALL) -D -o $(OWNER) -g $(GROUP) -m 444 $$lang.mo \
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 444 $$lang.mo \
|
||||
$(localedir)/$$lang/LC_MESSAGES/@INTL_PACKAGE@.mo;\
|
||||
done; \
|
||||
)
|
||||
|
||||
@@ -16,7 +16,7 @@ srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
SOURCES=\
|
||||
SOURCES =\
|
||||
archiver.c \
|
||||
dumpconfig.c \
|
||||
lvchange.c \
|
||||
@@ -57,20 +57,26 @@ SOURCES=\
|
||||
vgscan.c \
|
||||
vgsplit.c
|
||||
|
||||
TARGETS=\
|
||||
TARGETS =\
|
||||
.commands \
|
||||
lvm
|
||||
|
||||
LVMLIBS=-llvm
|
||||
INSTALL_TARGETS = install_tools_dynamic
|
||||
INSTALL_CMDLIB_TARGETS = install_cmdlib_dynamic
|
||||
|
||||
INSTALL_TARGETS=\
|
||||
install_lvm_tools
|
||||
ifeq ("@STATIC_LINK@", "yes")
|
||||
TARGETS += lvm.static
|
||||
INSTALL_TARGETS += install_tools_static
|
||||
INSTALL_CMDLIB_TARGETS += install_cmdlib_static
|
||||
endif
|
||||
|
||||
CLEAN_TARGETS = liblvm2cmd.so liblvm2cmd.a
|
||||
LVMLIBS = -llvm
|
||||
|
||||
CLEAN_TARGETS = liblvm2cmd.so liblvm2cmd.a lvm lvm.static
|
||||
|
||||
ifeq ("@CMDLIB@", "yes")
|
||||
TARGETS += liblvm2cmd.so
|
||||
INSTALL_TARGETS += install_cmdlib
|
||||
INSTALL_TARGETS += $(INSTALL_CMDLIB_TARGETS)
|
||||
endif
|
||||
|
||||
ifeq ("@DEVMAPPER@", "yes")
|
||||
@@ -80,7 +86,11 @@ endif
|
||||
include ../make.tmpl
|
||||
|
||||
lvm: $(OBJECTS) lvm.o $(top_srcdir)/lib/liblvm.a
|
||||
$(CC) -o lvm $(OBJECTS) lvm.o $(LD_FLAGS) $(LVMLIBS) $(LIBS)
|
||||
$(CC) -o $@ $(OBJECTS) lvm.o $(LD_FLAGS) $(LVMLIBS) $(LIBS) -rdynamic
|
||||
|
||||
lvm.static: $(OBJECTS) lvm.o $(top_srcdir)/lib/liblvm.a
|
||||
$(CC) -o $@ $(OBJECTS) lvm.o -static $(LD_FLAGS) $(LVMLIBS) $(LIBS) \
|
||||
-rdynamic
|
||||
|
||||
liblvm2cmd.a: $(top_srcdir)/lib/liblvm.a $(OBJECTS)
|
||||
cat $(top_srcdir)/lib/liblvm.a > $@
|
||||
@@ -94,17 +104,25 @@ liblvm2cmd.so: liblvm2cmd.a $(LD_DEPS)
|
||||
$(CC) -E -P cmdnames.h 2> /dev/null | \
|
||||
egrep -v '^ *(|#.*|dumpconfig|help|pvdata|version) *$$' > .commands
|
||||
|
||||
.PHONY: install_lvm_tools install_cmdlib
|
||||
.PHONY: install_cmdlib_dynamic install_cmdlib_static \
|
||||
install_tools_dynamic install_tools_static
|
||||
|
||||
install_cmdlib: $(TARGETS)
|
||||
$(INSTALL) -D -o $(OWNER) -g $(GROUP) -m 555 $(STRIP) liblvm2cmd.so \
|
||||
install_cmdlib_dynamic: liblvm2cmd.so
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) liblvm2cmd.so \
|
||||
$(libdir)/liblvm2cmd.so.$(LIB_VERSION)
|
||||
$(LN_S) -f liblvm2cmd.so.$(LIB_VERSION) $(libdir)/liblvm2cmd.so
|
||||
$(INSTALL) -D -o $(OWNER) -g $(GROUP) -m 444 lvm2cmd.h \
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 444 lvm2cmd.h \
|
||||
$(includedir)/lvm2cmd.h
|
||||
|
||||
install_lvm_tools: $(TARGETS)
|
||||
$(INSTALL) -D -o $(OWNER) -g $(GROUP) -m 555 $(STRIP) lvm \
|
||||
install_cmdlib_static: liblvm2cmd.a
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) liblvm2cmd.a \
|
||||
$(libdir)/liblvm2cmd.a.$(LIB_VERSION)
|
||||
$(LN_S) -f liblvm2cmd.a.$(LIB_VERSION) $(libdir)/liblvm2cmd.a
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 444 lvm2cmd.h \
|
||||
$(includedir)/lvm2cmd.h
|
||||
|
||||
install_tools_dynamic: lvm .commands
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) lvm \
|
||||
$(sbindir)/lvm
|
||||
@echo Creating symbolic links for individual commands in $(sbindir)
|
||||
@( \
|
||||
@@ -114,5 +132,9 @@ install_lvm_tools: $(TARGETS)
|
||||
done; \
|
||||
)
|
||||
|
||||
install_tools_static: lvm.static
|
||||
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) lvm.static \
|
||||
$(staticdir)/lvm.static
|
||||
|
||||
install: $(INSTALL_TARGETS)
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2001 Sistina Software (UK) Limited.
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2001 Sistina Software (UK) Limited.
|
||||
*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 Red Hat, Inc. All rights reserved.
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use,
|
||||
@@ -1054,7 +1054,7 @@ static char *_list_args(const char *text, int state)
|
||||
char c;
|
||||
if (!(c = (the_args +
|
||||
com->valid_args[match_no++])->short_arg))
|
||||
continue;
|
||||
continue;
|
||||
|
||||
sprintf(s, "-%c", c);
|
||||
if (!strncmp(text, s, len))
|
||||
@@ -1285,6 +1285,42 @@ void lvm2_exit(void *handle)
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Determine whether we should fall back and exec the equivalent LVM1 tool
|
||||
*/
|
||||
static int _lvm1_fallback(struct cmd_context *cmd)
|
||||
{
|
||||
char vsn[80];
|
||||
int dm_present;
|
||||
|
||||
if (!find_config_int(cmd->cft->root, "global/fallback_to_lvm1",
|
||||
DEFAULT_FALLBACK_TO_LVM1) ||
|
||||
strncmp(cmd->kernel_vsn, "2.4.", 4))
|
||||
return 0;
|
||||
|
||||
log_suppress(1);
|
||||
dm_present = driver_version(vsn, sizeof(vsn));
|
||||
log_suppress(0);
|
||||
|
||||
if (dm_present || !lvm1_present(cmd))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void _exec_lvm1_command(struct cmd_context *cmd, int argc, char **argv)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
|
||||
if (lvm_snprintf(path, sizeof(path), "%s.lvm1", argv[0]) < 0) {
|
||||
log_error("Failed to create LVM1 tool pathname");
|
||||
return;
|
||||
}
|
||||
|
||||
execvp(path, argv);
|
||||
log_sys_error("execvp", path);
|
||||
}
|
||||
|
||||
int lvm2_main(int argc, char **argv)
|
||||
{
|
||||
char *namebase, *base;
|
||||
@@ -1305,6 +1341,21 @@ int lvm2_main(int argc, char **argv)
|
||||
|
||||
_register_commands();
|
||||
|
||||
if (_lvm1_fallback(cmd)) {
|
||||
/* Attempt to run equivalent LVM1 tool instead */
|
||||
if (!alias) {
|
||||
argv++;
|
||||
argc--;
|
||||
alias = 0;
|
||||
}
|
||||
if (!argc) {
|
||||
log_error("Falling back to LVM1 tools, but no "
|
||||
"command specified.");
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
_exec_lvm1_command(cmd, argc, argv);
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
#ifdef READLINE_SUPPORT
|
||||
if (!alias && argc == 1) {
|
||||
ret = _shell(cmd);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#define _LVM_TOOLS_H
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user