mirror of
				git://sourceware.org/git/lvm2.git
				synced 2025-11-03 08:23:48 +03:00 
			
		
		
		
	Compare commits
	
		
			3 Commits
		
	
	
		
			dev-dct-pv
			...
			dev-dct-ac
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					582c759929 | ||
| 
						 | 
					64dd17e539 | ||
| 
						 | 
					240db28214 | 
@@ -126,7 +126,7 @@ devices {
 | 
			
		||||
	# be used, regardless of this setting, when the --devicesfile
 | 
			
		||||
	# option is set to a specific file name.
 | 
			
		||||
	# This configuration option has an automatic default value.
 | 
			
		||||
	# use_devicesfile = 0
 | 
			
		||||
	# use_devicesfile = 1
 | 
			
		||||
 | 
			
		||||
	# Configuration option devices/devicesfile.
 | 
			
		||||
	# The name of the system devices file, listing devices that LVM should use.
 | 
			
		||||
@@ -236,6 +236,12 @@ devices {
 | 
			
		||||
	# This configuration option has an automatic default value.
 | 
			
		||||
	# multipath_wwids_file = "/etc/multipath/wwids"
 | 
			
		||||
 | 
			
		||||
	# Configuration option devices/multipath_wwids_file.
 | 
			
		||||
	# The path to the multipath wwids file used for multipath component detection.
 | 
			
		||||
	# Set this to an empty string to disable the use of the multipath wwids file.
 | 
			
		||||
	# This configuration option has an automatic default value.
 | 
			
		||||
	# multipath_wwids_file = "/etc/multipath/wwids"
 | 
			
		||||
 | 
			
		||||
	# Configuration option devices/md_component_detection.
 | 
			
		||||
	# Enable detection and exclusion of MD component devices.
 | 
			
		||||
	# An MD component device is a block device that MD uses as part
 | 
			
		||||
@@ -836,7 +842,7 @@ log {
 | 
			
		||||
	# Configuration option log/syslog.
 | 
			
		||||
	# Send log messages through syslog.
 | 
			
		||||
	# This configuration option has an automatic default value.
 | 
			
		||||
	# syslog = 0
 | 
			
		||||
	# syslog = 1
 | 
			
		||||
 | 
			
		||||
	# Configuration option log/file.
 | 
			
		||||
	# Write error and debug log messages to a file specified here.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										471
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										471
									
								
								configure
									
									
									
									
										vendored
									
									
								
							@@ -668,6 +668,7 @@ SALCK_CFLAGS
 | 
			
		||||
SACKPT_LIBS
 | 
			
		||||
SACKPT_CFLAGS
 | 
			
		||||
REPLICATORS
 | 
			
		||||
READLINE_LIBS
 | 
			
		||||
RT_LIBS
 | 
			
		||||
QUORUM_LIBS
 | 
			
		||||
QUORUM_CFLAGS
 | 
			
		||||
@@ -754,8 +755,6 @@ BUILD_LVMDBUSD
 | 
			
		||||
BUILD_DMEVENTD
 | 
			
		||||
BUILD_CMIRRORD
 | 
			
		||||
BLKID_PC
 | 
			
		||||
READLINE_LIBS
 | 
			
		||||
READLINE_CFLAGS
 | 
			
		||||
MODPROBE_CMD
 | 
			
		||||
MSGFMT
 | 
			
		||||
EDITLINE_LIBS
 | 
			
		||||
@@ -777,6 +776,12 @@ SYSTEMD_LIBS
 | 
			
		||||
SYSTEMD_CFLAGS
 | 
			
		||||
BLKID_LIBS
 | 
			
		||||
BLKID_CFLAGS
 | 
			
		||||
APP_MACHINEID_LIBS
 | 
			
		||||
APP_MACHINEID_CFLAGS
 | 
			
		||||
NOTIFY_DBUS_LIBS
 | 
			
		||||
NOTIFY_DBUS_CFLAGS
 | 
			
		||||
BLKID_LIBS
 | 
			
		||||
BLKID_CFLAGS
 | 
			
		||||
LOCKD_IDM_LIBS
 | 
			
		||||
LOCKD_IDM_CFLAGS
 | 
			
		||||
LOCKD_DLM_CONTROL_LIBS
 | 
			
		||||
@@ -907,7 +912,6 @@ with_device_uid
 | 
			
		||||
with_device_gid
 | 
			
		||||
with_device_mode
 | 
			
		||||
with_device_nodes_on
 | 
			
		||||
with_default_use_devices_file
 | 
			
		||||
with_default_name_mangling
 | 
			
		||||
with_snapshots
 | 
			
		||||
with_mirrors
 | 
			
		||||
@@ -957,7 +961,6 @@ enable_use_lvmpolld
 | 
			
		||||
with_lvmpolld_pidfile
 | 
			
		||||
enable_dmfilemapd
 | 
			
		||||
enable_notify_dbus
 | 
			
		||||
enable_systemd_journal
 | 
			
		||||
enable_app_machineid
 | 
			
		||||
enable_blkid_wiping
 | 
			
		||||
enable_udev_systemd_background_jobs
 | 
			
		||||
@@ -1029,17 +1032,21 @@ LOCKD_DLM_CONTROL_CFLAGS
 | 
			
		||||
LOCKD_DLM_CONTROL_LIBS
 | 
			
		||||
LOCKD_IDM_CFLAGS
 | 
			
		||||
LOCKD_IDM_LIBS
 | 
			
		||||
NOTIFY_DBUS_CFLAGS
 | 
			
		||||
NOTIFY_DBUS_LIBS
 | 
			
		||||
APP_MACHINEID_CFLAGS
 | 
			
		||||
APP_MACHINEID_LIBS
 | 
			
		||||
BLKID_CFLAGS
 | 
			
		||||
BLKID_LIBS
 | 
			
		||||
NOTIFY_DBUS_CFLAGS
 | 
			
		||||
NOTIFY_DBUS_LIBS
 | 
			
		||||
SYSTEMD_CFLAGS
 | 
			
		||||
SYSTEMD_LIBS
 | 
			
		||||
UDEV_CFLAGS
 | 
			
		||||
UDEV_LIBS
 | 
			
		||||
PYTHON
 | 
			
		||||
EDITLINE_CFLAGS
 | 
			
		||||
EDITLINE_LIBS
 | 
			
		||||
READLINE_CFLAGS
 | 
			
		||||
READLINE_LIBS'
 | 
			
		||||
EDITLINE_LIBS'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Initialize some variables set by options.
 | 
			
		||||
@@ -1693,9 +1700,7 @@ Optional Features:
 | 
			
		||||
  --disable-use-lvmpolld  disable usage of LVM Poll Daemon
 | 
			
		||||
  --enable-dmfilemapd     enable the dmstats filemap daemon
 | 
			
		||||
  --enable-notify-dbus    enable LVM notification using dbus
 | 
			
		||||
  --disable-systemd-journal
 | 
			
		||||
                          disable LVM systemd journaling
 | 
			
		||||
  --disable-app-machineid disable LVM system ID using app-specific machine-id
 | 
			
		||||
  --enable-app-machineid  enable LVM system ID using app-specific machine-id
 | 
			
		||||
  --disable-blkid_wiping  disable libblkid detection of signatures when wiping
 | 
			
		||||
                          and use native code instead
 | 
			
		||||
  --disable-udev-systemd-background-jobs
 | 
			
		||||
@@ -1732,8 +1737,6 @@ Optional Packages:
 | 
			
		||||
  --with-device-mode=MODE set the mode used for new device nodes [MODE=0600]
 | 
			
		||||
  --with-device-nodes-on=ON
 | 
			
		||||
                          create nodes on resume or create [ON=resume]
 | 
			
		||||
  --with-default-use-devices-file
 | 
			
		||||
                          default for lvm.conf devices/use_devicesfile = [0]
 | 
			
		||||
  --with-default-name-mangling=MANGLING
 | 
			
		||||
                          default name mangling: auto/none/hex [auto]
 | 
			
		||||
  --with-snapshots=TYPE   snapshot support: internal/none [internal]
 | 
			
		||||
@@ -1856,6 +1859,17 @@ Some influential environment variables:
 | 
			
		||||
  BLKID_CFLAGS
 | 
			
		||||
              C compiler flags for BLKID, overriding pkg-config
 | 
			
		||||
  BLKID_LIBS  linker flags for BLKID, overriding pkg-config
 | 
			
		||||
  NOTIFY_DBUS_CFLAGS
 | 
			
		||||
              C compiler flags for NOTIFY_DBUS, overriding pkg-config
 | 
			
		||||
  NOTIFY_DBUS_LIBS
 | 
			
		||||
              linker flags for NOTIFY_DBUS, overriding pkg-config
 | 
			
		||||
  APP_MACHINEID_CFLAGS
 | 
			
		||||
              C compiler flags for APP_MACHINEID, overriding pkg-config
 | 
			
		||||
  APP_MACHINEID_LIBS
 | 
			
		||||
              linker flags for APP_MACHINEID, overriding pkg-config
 | 
			
		||||
  BLKID_CFLAGS
 | 
			
		||||
              C compiler flags for BLKID, overriding pkg-config
 | 
			
		||||
  BLKID_LIBS  linker flags for BLKID, overriding pkg-config
 | 
			
		||||
  SYSTEMD_CFLAGS
 | 
			
		||||
              C compiler flags for SYSTEMD, overriding pkg-config
 | 
			
		||||
  SYSTEMD_LIBS
 | 
			
		||||
@@ -1867,10 +1881,6 @@ Some influential environment variables:
 | 
			
		||||
              C compiler flags for EDITLINE, overriding pkg-config
 | 
			
		||||
  EDITLINE_LIBS
 | 
			
		||||
              linker flags for EDITLINE, overriding pkg-config
 | 
			
		||||
  READLINE_CFLAGS
 | 
			
		||||
              C compiler flags for readline
 | 
			
		||||
  READLINE_LIBS
 | 
			
		||||
              linker flags for readline
 | 
			
		||||
 | 
			
		||||
Use these variables to override the choices made by `configure' or to help
 | 
			
		||||
it to find libraries and programs with nonstandard names/locations.
 | 
			
		||||
@@ -6708,17 +6718,18 @@ fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_ffs" >&5
 | 
			
		||||
$as_echo_n "checking for __builtin_ffs... " >&6; }
 | 
			
		||||
if ${ax_cv_have___builtin_ffs+:} false; then :
 | 
			
		||||
  $as_echo_n "(cached) " >&6
 | 
			
		||||
else
 | 
			
		||||
    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __builtin_ffs" >&5
 | 
			
		||||
printf %s "checking for __builtin_ffs... " >&6; }
 | 
			
		||||
if test ${ax_cv_have___builtin_ffs+y}
 | 
			
		||||
then :
 | 
			
		||||
  printf %s "(cached) " >&6
 | 
			
		||||
else $as_nop
 | 
			
		||||
 | 
			
		||||
        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 | 
			
		||||
/* end confdefs.h.  */
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
main ()
 | 
			
		||||
main (void)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
            __builtin_ffs(0)
 | 
			
		||||
@@ -6727,31 +6738,26 @@ main ()
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
_ACEOF
 | 
			
		||||
if ac_fn_c_try_link "$LINENO"; then :
 | 
			
		||||
if ac_fn_c_try_link "$LINENO"
 | 
			
		||||
then :
 | 
			
		||||
  ax_cv_have___builtin_ffs=yes
 | 
			
		||||
else
 | 
			
		||||
else $as_nop
 | 
			
		||||
  ax_cv_have___builtin_ffs=no
 | 
			
		||||
fi
 | 
			
		||||
rm -f core conftest.err conftest.$ac_objext \
 | 
			
		||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
 | 
			
		||||
    conftest$ac_exeext conftest.$ac_ext
 | 
			
		||||
 | 
			
		||||
fi
 | 
			
		||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_have___builtin_ffs" >&5
 | 
			
		||||
$as_echo "$ax_cv_have___builtin_ffs" >&6; }
 | 
			
		||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_have___builtin_ffs" >&5
 | 
			
		||||
printf "%s\n" "$ax_cv_have___builtin_ffs" >&6; }
 | 
			
		||||
 | 
			
		||||
    if test yes = $ax_cv_have___builtin_ffs; then :
 | 
			
		||||
    if test yes = $ax_cv_have___builtin_ffs
 | 
			
		||||
then :
 | 
			
		||||
 | 
			
		||||
cat >>confdefs.h <<_ACEOF
 | 
			
		||||
#define HAVE___BUILTIN_FFS 1
 | 
			
		||||
_ACEOF
 | 
			
		||||
printf "%s\n" "#define HAVE___BUILTIN_FFS 1" >>confdefs.h
 | 
			
		||||
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
$as_echo "#define _GNU_SOURCE 1" >>confdefs.h
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -6777,17 +6783,25 @@ else
 | 
			
		||||
fi
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
for ac_func in ffs prlimit versionsort
 | 
			
		||||
do :
 | 
			
		||||
  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 | 
			
		||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
 | 
			
		||||
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
 | 
			
		||||
  cat >>confdefs.h <<_ACEOF
 | 
			
		||||
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 | 
			
		||||
_ACEOF
 | 
			
		||||
ac_fn_c_check_func "$LINENO" "ffs" "ac_cv_func_ffs"
 | 
			
		||||
if test "x$ac_cv_func_ffs" = xyes
 | 
			
		||||
then :
 | 
			
		||||
  printf "%s\n" "#define HAVE_FFS 1" >>confdefs.h
 | 
			
		||||
 | 
			
		||||
fi
 | 
			
		||||
done
 | 
			
		||||
ac_fn_c_check_func "$LINENO" "prlimit" "ac_cv_func_prlimit"
 | 
			
		||||
if test "x$ac_cv_func_prlimit" = xyes
 | 
			
		||||
then :
 | 
			
		||||
  printf "%s\n" "#define HAVE_PRLIMIT 1" >>confdefs.h
 | 
			
		||||
 | 
			
		||||
fi
 | 
			
		||||
ac_fn_c_check_func "$LINENO" "versionsort" "ac_cv_func_versionsort"
 | 
			
		||||
if test "x$ac_cv_func_versionsort" = xyes
 | 
			
		||||
then :
 | 
			
		||||
  printf "%s\n" "#define HAVE_VERSIONSORT 1" >>confdefs.h
 | 
			
		||||
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 | 
			
		||||
# for constant arguments.  Useless!
 | 
			
		||||
@@ -8352,6 +8366,7 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
 | 
			
		||||
# Let make expand exec_prefix.
 | 
			
		||||
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking file owner" >&5
 | 
			
		||||
$as_echo_n "checking file owner... " >&6; }
 | 
			
		||||
@@ -8461,29 +8476,6 @@ cat >>confdefs.h <<_ACEOF
 | 
			
		||||
_ACEOF
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking default for use_devicesfile" >&5
 | 
			
		||||
$as_echo_n "checking default for use_devicesfile... " >&6; }
 | 
			
		||||
 | 
			
		||||
# Check whether --with-default-use-devices-file was given.
 | 
			
		||||
if test "${with_default_use_devices_file+set}" = set; then :
 | 
			
		||||
  withval=$with_default_use_devices_file; DEFAULT_USE_DEVICES_FILE=$enableval
 | 
			
		||||
else
 | 
			
		||||
  DEFAULT_USE_DEVICES_FILE=0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
case "$DEFAULT_USE_DEVICES_FILE" in
 | 
			
		||||
 0|1);;
 | 
			
		||||
 *) as_fn_error $? "--with-default-use-devices-file parameter invalid" "$LINENO" 5;;
 | 
			
		||||
esac
 | 
			
		||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEFAULT_USE_DEVICES_FILE" >&5
 | 
			
		||||
$as_echo "$DEFAULT_USE_DEVICES_FILE" >&6; }
 | 
			
		||||
 | 
			
		||||
cat >>confdefs.h <<_ACEOF
 | 
			
		||||
#define DEFAULT_USE_DEVICES_FILE $DEFAULT_USE_DEVICES_FILE
 | 
			
		||||
_ACEOF
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking default name mangling" >&5
 | 
			
		||||
$as_echo_n "checking default name mangling... " >&6; }
 | 
			
		||||
 | 
			
		||||
@@ -8780,7 +8772,7 @@ $as_echo "$as_me: WARNING: thin_check not found in path $PATH" >&2;}
 | 
			
		||||
			THIN_CONFIGURE_WARN=y
 | 
			
		||||
		fi
 | 
			
		||||
	fi
 | 
			
		||||
	if test "$THIN_CHECK_NEEDS_CHECK" = yes && test "$THIN_CONFIGURE_WARN" != y ; then
 | 
			
		||||
	if test "$THIN_CHECK_NEEDS_CHECK" = yes; then
 | 
			
		||||
		THIN_CHECK_VSN=`"$THIN_CHECK_CMD" -V 2>/dev/null`
 | 
			
		||||
		THIN_CHECK_VSN_MAJOR=`echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $1}'`
 | 
			
		||||
		THIN_CHECK_VSN_MINOR=`echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $2}'`
 | 
			
		||||
@@ -9328,7 +9320,7 @@ $as_echo "$as_me: WARNING: cache_check not found in path $PATH" >&2;}
 | 
			
		||||
			CACHE_CONFIGURE_WARN=y
 | 
			
		||||
		fi
 | 
			
		||||
	fi
 | 
			
		||||
	if test "$CACHE_CHECK_NEEDS_CHECK" = yes && test "$CACHE_CONFIGURE_WARN" != y ; then
 | 
			
		||||
	if test "$CACHE_CHECK_NEEDS_CHECK" = yes; then
 | 
			
		||||
		$CACHE_CHECK_CMD -V 2>/dev/null >conftest.tmp
 | 
			
		||||
		read -r CACHE_CHECK_VSN < conftest.tmp
 | 
			
		||||
		IFS=.- read -r CACHE_CHECK_VSN_MAJOR CACHE_CHECK_VSN_MINOR CACHE_CHECK_VSN_PATCH LEFTOVER < conftest.tmp
 | 
			
		||||
@@ -9864,13 +9856,13 @@ _ACEOF
 | 
			
		||||
# Do we want to link lvm2 with a big library for vdoformating ?
 | 
			
		||||
#
 | 
			
		||||
#AC_ARG_WITH(vdo-include,
 | 
			
		||||
#	    AS_HELP_STRING([--with-vdo-include=PATH],
 | 
			
		||||
#	    AC_HELP_STRING([--with-vdo-include=PATH],
 | 
			
		||||
#			   [vdo support: Path to utils headers: [/usr/include/vdo/utils]]),
 | 
			
		||||
#			   VDO_INCLUDE=$withval, VDO_INCLUDE="/usr/include/vdo/utils")
 | 
			
		||||
#AC_MSG_RESULT($VDO_INCLUDE)
 | 
			
		||||
#
 | 
			
		||||
#AC_ARG_WITH(vdo-lib,
 | 
			
		||||
#            AS_HELP_STRING([--with-vdo-lib=PATH],
 | 
			
		||||
#            AC_HELP_STRING([--with-vdo-lib=PATH],
 | 
			
		||||
#                           [vdo support: Path to utils lib: [/usr/lib]]),
 | 
			
		||||
#                           VDO_LIB=$withval, VDO_LIB="/usr/lib")
 | 
			
		||||
#AC_MSG_RESULT($VDO_LIB)
 | 
			
		||||
@@ -11567,34 +11559,12 @@ fi
 | 
			
		||||
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
SYSTEMD_MIN_VERSION=0
 | 
			
		||||
pkg_config_init
 | 
			
		||||
if test -n "$PKG_CONFIG" && \
 | 
			
		||||
    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= 205\""; } >&5
 | 
			
		||||
  ($PKG_CONFIG --exists --print-errors "systemd >= 205") 2>&5
 | 
			
		||||
  ac_status=$?
 | 
			
		||||
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
 | 
			
		||||
  test $ac_status = 0; }; then
 | 
			
		||||
  SYSTEMD_MIN_VERSION=205
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
if test -n "$PKG_CONFIG" && \
 | 
			
		||||
    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= 221\""; } >&5
 | 
			
		||||
  ($PKG_CONFIG --exists --print-errors "systemd >= 221") 2>&5
 | 
			
		||||
  ac_status=$?
 | 
			
		||||
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
 | 
			
		||||
  test $ac_status = 0; }; then
 | 
			
		||||
  SYSTEMD_MIN_VERSION=221
 | 
			
		||||
fi
 | 
			
		||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build notifydbus" >&5
 | 
			
		||||
$as_echo_n "checking whether to build notifydbus... " >&6; }
 | 
			
		||||
# Check whether --enable-notify-dbus was given.
 | 
			
		||||
if test "${enable_notify_dbus+set}" = set; then :
 | 
			
		||||
  enableval=$enable_notify_dbus; if test "$enableval" = yes && test "$SYSTEMD_MIN_VERSION" -lt 221; then :
 | 
			
		||||
  as_fn_error $? "Enabling notify-dbus requires systemd >= 221" "$LINENO" 5
 | 
			
		||||
fi
 | 
			
		||||
	      NOTIFYDBUS_SUPPORT=$enableval
 | 
			
		||||
  enableval=$enable_notify_dbus; NOTIFYDBUS_SUPPORT=$enableval
 | 
			
		||||
else
 | 
			
		||||
  NOTIFYDBUS_SUPPORT=no
 | 
			
		||||
fi
 | 
			
		||||
@@ -11602,105 +11572,30 @@ fi
 | 
			
		||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $NOTIFYDBUS_SUPPORT" >&5
 | 
			
		||||
$as_echo "$NOTIFYDBUS_SUPPORT" >&6; }
 | 
			
		||||
 | 
			
		||||
if test "$NOTIFYDBUS_SUPPORT" = yes; then :
 | 
			
		||||
if test "$NOTIFYDBUS_SUPPORT" = yes; then
 | 
			
		||||
 | 
			
		||||
$as_echo "#define NOTIFYDBUS_SUPPORT 1" >>confdefs.h
 | 
			
		||||
 | 
			
		||||
	SYSTEMD_LIBS="-lsystemd"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
if test "$SYSTEMD_MIN_VERSION" -ge 221; then :
 | 
			
		||||
  SYSTEMD_JOURNAL_SUPPORT=maybe
 | 
			
		||||
else
 | 
			
		||||
  SYSTEMD_JOURNAL_SUPPORT=no
 | 
			
		||||
fi
 | 
			
		||||
ac_fn_c_check_header_mongrel "$LINENO" "systemd/sd-journal.h" "ac_cv_header_systemd_sd_journal_h" "$ac_includes_default"
 | 
			
		||||
if test "x$ac_cv_header_systemd_sd_journal_h" = xyes; then :
 | 
			
		||||
  if test "$SYSTEMD_JOURNAL_SUPPORT" != no; then :
 | 
			
		||||
  SYSTEMD_JOURNAL_SUPPORT=yes
 | 
			
		||||
fi
 | 
			
		||||
else
 | 
			
		||||
  SYSTEMD_JOURNAL_SUPPORT=no
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to log to systemd journal" >&5
 | 
			
		||||
$as_echo_n "checking whether to log to systemd journal... " >&6; }
 | 
			
		||||
# Check whether --enable-systemd-journal was given.
 | 
			
		||||
if test "${enable_systemd_journal+set}" = set; then :
 | 
			
		||||
  enableval=$enable_systemd_journal; if test "$enableval" = yes && test "$SYSTEMD_JOURNAL_SUPPORT" = no; then :
 | 
			
		||||
  as_fn_error $? "Enabling systemd journal requires systemd/sd-journal.h and systemd >= 221." "$LINENO" 5
 | 
			
		||||
fi
 | 
			
		||||
	      SYSTEMD_JOURNAL_SUPPORT=$enableval
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SYSTEMD_JOURNAL_SUPPORT" >&5
 | 
			
		||||
$as_echo "$SYSTEMD_JOURNAL_SUPPORT" >&6; }
 | 
			
		||||
 | 
			
		||||
if test "$SYSTEMD_JOURNAL_SUPPORT" = yes; then :
 | 
			
		||||
 | 
			
		||||
$as_echo "#define SYSTEMD_JOURNAL_SUPPORT 1" >>confdefs.h
 | 
			
		||||
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
if test -n "$PKG_CONFIG" && \
 | 
			
		||||
    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= 234\""; } >&5
 | 
			
		||||
  ($PKG_CONFIG --exists --print-errors "systemd >= 234") 2>&5
 | 
			
		||||
  ac_status=$?
 | 
			
		||||
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
 | 
			
		||||
  test $ac_status = 0; }; then
 | 
			
		||||
  SYSTEMD_MIN_VERSION=234  APP_MACHINEID_SUPPORT=maybe
 | 
			
		||||
else
 | 
			
		||||
  APP_MACHINEID_SUPPORT=no
 | 
			
		||||
fi
 | 
			
		||||
ac_fn_c_check_header_mongrel "$LINENO" "systemd/sd-id128.h" "ac_cv_header_systemd_sd_id128_h" "$ac_includes_default"
 | 
			
		||||
if test "x$ac_cv_header_systemd_sd_id128_h" = xyes; then :
 | 
			
		||||
  if test "$APP_MACHINEID_SUPPORT" != no; then :
 | 
			
		||||
  APP_MACHINEID_SUPPORT=yes
 | 
			
		||||
fi
 | 
			
		||||
else
 | 
			
		||||
  APP_MACHINEID_SUPPORT=no
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to support systemd appmachineid" >&5
 | 
			
		||||
$as_echo_n "checking whether to support systemd appmachineid... " >&6; }
 | 
			
		||||
# Check whether --enable-app-machineid was given.
 | 
			
		||||
if test "${enable_app_machineid+set}" = set; then :
 | 
			
		||||
  enableval=$enable_app_machineid; if test "$enableval" = yes && test "$APP_MACHINEID_SUPPORT" = no; then :
 | 
			
		||||
  as_fn_error $? "Enabling app machineid requires systemd/sd-id128.h and systemd >= 234." "$LINENO" 5
 | 
			
		||||
fi
 | 
			
		||||
	      APP_MACHINEID_SUPPORT=$enableval
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $APP_MACHINEID_SUPPORT" >&5
 | 
			
		||||
$as_echo "$APP_MACHINEID_SUPPORT" >&6; }
 | 
			
		||||
 | 
			
		||||
if test "$APP_MACHINEID_SUPPORT" = yes; then :
 | 
			
		||||
 | 
			
		||||
$as_echo "#define APP_MACHINEID_SUPPORT 1" >>confdefs.h
 | 
			
		||||
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if test "$NOTIFYDBUS_SUPPORT" = yes || test "$SYSTEMD_JOURNAL_SUPPORT" = yes || test "$APP_MACHINEID_SUPPORT" = yes  ; then :
 | 
			
		||||
 | 
			
		||||
      pkg_config_init
 | 
			
		||||
if test "$NOTIFYDBUS_SUPPORT" = yes; then
 | 
			
		||||
 | 
			
		||||
pkg_failed=no
 | 
			
		||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SYSTEMD" >&5
 | 
			
		||||
$as_echo_n "checking for SYSTEMD... " >&6; }
 | 
			
		||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for NOTIFY_DBUS" >&5
 | 
			
		||||
$as_echo_n "checking for NOTIFY_DBUS... " >&6; }
 | 
			
		||||
 | 
			
		||||
if test -n "$SYSTEMD_CFLAGS"; then
 | 
			
		||||
    pkg_cv_SYSTEMD_CFLAGS="$SYSTEMD_CFLAGS"
 | 
			
		||||
if test -n "$NOTIFY_DBUS_CFLAGS"; then
 | 
			
		||||
    pkg_cv_NOTIFY_DBUS_CFLAGS="$NOTIFY_DBUS_CFLAGS"
 | 
			
		||||
 elif test -n "$PKG_CONFIG"; then
 | 
			
		||||
    if test -n "$PKG_CONFIG" && \
 | 
			
		||||
    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd\""; } >&5
 | 
			
		||||
  ($PKG_CONFIG --exists --print-errors "systemd") 2>&5
 | 
			
		||||
    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= 221\""; } >&5
 | 
			
		||||
  ($PKG_CONFIG --exists --print-errors "systemd >= 221") 2>&5
 | 
			
		||||
  ac_status=$?
 | 
			
		||||
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
 | 
			
		||||
  test $ac_status = 0; }; then
 | 
			
		||||
  pkg_cv_SYSTEMD_CFLAGS=`$PKG_CONFIG --cflags "systemd" 2>/dev/null`
 | 
			
		||||
  pkg_cv_NOTIFY_DBUS_CFLAGS=`$PKG_CONFIG --cflags "systemd >= 221" 2>/dev/null`
 | 
			
		||||
		      test "x$?" != "x0" && pkg_failed=yes
 | 
			
		||||
else
 | 
			
		||||
  pkg_failed=yes
 | 
			
		||||
@@ -11708,16 +11603,16 @@ fi
 | 
			
		||||
 else
 | 
			
		||||
    pkg_failed=untried
 | 
			
		||||
fi
 | 
			
		||||
if test -n "$SYSTEMD_LIBS"; then
 | 
			
		||||
    pkg_cv_SYSTEMD_LIBS="$SYSTEMD_LIBS"
 | 
			
		||||
if test -n "$NOTIFY_DBUS_LIBS"; then
 | 
			
		||||
    pkg_cv_NOTIFY_DBUS_LIBS="$NOTIFY_DBUS_LIBS"
 | 
			
		||||
 elif test -n "$PKG_CONFIG"; then
 | 
			
		||||
    if test -n "$PKG_CONFIG" && \
 | 
			
		||||
    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd\""; } >&5
 | 
			
		||||
  ($PKG_CONFIG --exists --print-errors "systemd") 2>&5
 | 
			
		||||
    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= 221\""; } >&5
 | 
			
		||||
  ($PKG_CONFIG --exists --print-errors "systemd >= 221") 2>&5
 | 
			
		||||
  ac_status=$?
 | 
			
		||||
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
 | 
			
		||||
  test $ac_status = 0; }; then
 | 
			
		||||
  pkg_cv_SYSTEMD_LIBS=`$PKG_CONFIG --libs "systemd" 2>/dev/null`
 | 
			
		||||
  pkg_cv_NOTIFY_DBUS_LIBS=`$PKG_CONFIG --libs "systemd >= 221" 2>/dev/null`
 | 
			
		||||
		      test "x$?" != "x0" && pkg_failed=yes
 | 
			
		||||
else
 | 
			
		||||
  pkg_failed=yes
 | 
			
		||||
@@ -11738,12 +11633,12 @@ else
 | 
			
		||||
        _pkg_short_errors_supported=no
 | 
			
		||||
fi
 | 
			
		||||
        if test $_pkg_short_errors_supported = yes; then
 | 
			
		||||
	        SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "systemd" 2>&1`
 | 
			
		||||
	        NOTIFY_DBUS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "systemd >= 221" 2>&1`
 | 
			
		||||
        else
 | 
			
		||||
	        SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "systemd" 2>&1`
 | 
			
		||||
	        NOTIFY_DBUS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "systemd >= 221" 2>&1`
 | 
			
		||||
        fi
 | 
			
		||||
	# Put the nasty error message in config.log where it belongs
 | 
			
		||||
	echo "$SYSTEMD_PKG_ERRORS" >&5
 | 
			
		||||
	echo "$NOTIFY_DBUS_PKG_ERRORS" >&5
 | 
			
		||||
 | 
			
		||||
	$bailout
 | 
			
		||||
elif test $pkg_failed = untried; then
 | 
			
		||||
@@ -11751,12 +11646,107 @@ elif test $pkg_failed = untried; then
 | 
			
		||||
$as_echo "no" >&6; }
 | 
			
		||||
	$bailout
 | 
			
		||||
else
 | 
			
		||||
	SYSTEMD_CFLAGS=$pkg_cv_SYSTEMD_CFLAGS
 | 
			
		||||
	SYSTEMD_LIBS=$pkg_cv_SYSTEMD_LIBS
 | 
			
		||||
	NOTIFY_DBUS_CFLAGS=$pkg_cv_NOTIFY_DBUS_CFLAGS
 | 
			
		||||
	NOTIFY_DBUS_LIBS=$pkg_cv_NOTIFY_DBUS_LIBS
 | 
			
		||||
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 | 
			
		||||
$as_echo "yes" >&6; }
 | 
			
		||||
	HAVE_NOTIFY_DBUS=yes
 | 
			
		||||
fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build appmachineid" >&5
 | 
			
		||||
$as_echo_n "checking whether to build appmachineid... " >&6; }
 | 
			
		||||
# Check whether --enable-app-machineid was given.
 | 
			
		||||
if test "${enable_app_machineid+set}" = set; then :
 | 
			
		||||
  enableval=$enable_app_machineid; APP_MACHINEID_SUPPORT=$enableval
 | 
			
		||||
else
 | 
			
		||||
  APP_MACHINEID_SUPPORT=no
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $APP_MACHINEID_SUPPORT" >&5
 | 
			
		||||
$as_echo "$APP_MACHINEID_SUPPORT" >&6; }
 | 
			
		||||
 | 
			
		||||
if test "$APP_MACHINEID_SUPPORT" = yes; then
 | 
			
		||||
 | 
			
		||||
$as_echo "#define APP_MACHINEID_SUPPORT 1" >>confdefs.h
 | 
			
		||||
 | 
			
		||||
	SYSTEMD_LIBS="-lsystemd"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
if test "$APP_MACHINEID_SUPPORT" = yes; then
 | 
			
		||||
 | 
			
		||||
pkg_failed=no
 | 
			
		||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for APP_MACHINEID" >&5
 | 
			
		||||
$as_echo_n "checking for APP_MACHINEID... " >&6; }
 | 
			
		||||
 | 
			
		||||
if test -n "$APP_MACHINEID_CFLAGS"; then
 | 
			
		||||
    pkg_cv_APP_MACHINEID_CFLAGS="$APP_MACHINEID_CFLAGS"
 | 
			
		||||
 elif test -n "$PKG_CONFIG"; then
 | 
			
		||||
    if test -n "$PKG_CONFIG" && \
 | 
			
		||||
    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= 234\""; } >&5
 | 
			
		||||
  ($PKG_CONFIG --exists --print-errors "systemd >= 234") 2>&5
 | 
			
		||||
  ac_status=$?
 | 
			
		||||
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
 | 
			
		||||
  test $ac_status = 0; }; then
 | 
			
		||||
  pkg_cv_APP_MACHINEID_CFLAGS=`$PKG_CONFIG --cflags "systemd >= 234" 2>/dev/null`
 | 
			
		||||
		      test "x$?" != "x0" && pkg_failed=yes
 | 
			
		||||
else
 | 
			
		||||
  pkg_failed=yes
 | 
			
		||||
fi
 | 
			
		||||
 else
 | 
			
		||||
    pkg_failed=untried
 | 
			
		||||
fi
 | 
			
		||||
if test -n "$APP_MACHINEID_LIBS"; then
 | 
			
		||||
    pkg_cv_APP_MACHINEID_LIBS="$APP_MACHINEID_LIBS"
 | 
			
		||||
 elif test -n "$PKG_CONFIG"; then
 | 
			
		||||
    if test -n "$PKG_CONFIG" && \
 | 
			
		||||
    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= 234\""; } >&5
 | 
			
		||||
  ($PKG_CONFIG --exists --print-errors "systemd >= 234") 2>&5
 | 
			
		||||
  ac_status=$?
 | 
			
		||||
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
 | 
			
		||||
  test $ac_status = 0; }; then
 | 
			
		||||
  pkg_cv_APP_MACHINEID_LIBS=`$PKG_CONFIG --libs "systemd >= 234" 2>/dev/null`
 | 
			
		||||
		      test "x$?" != "x0" && pkg_failed=yes
 | 
			
		||||
else
 | 
			
		||||
  pkg_failed=yes
 | 
			
		||||
fi
 | 
			
		||||
 else
 | 
			
		||||
    pkg_failed=untried
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if test $pkg_failed = yes; then
 | 
			
		||||
   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 | 
			
		||||
$as_echo "no" >&6; }
 | 
			
		||||
 | 
			
		||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
 | 
			
		||||
        _pkg_short_errors_supported=yes
 | 
			
		||||
else
 | 
			
		||||
        _pkg_short_errors_supported=no
 | 
			
		||||
fi
 | 
			
		||||
        if test $_pkg_short_errors_supported = yes; then
 | 
			
		||||
	        APP_MACHINEID_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "systemd >= 234" 2>&1`
 | 
			
		||||
        else
 | 
			
		||||
	        APP_MACHINEID_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "systemd >= 234" 2>&1`
 | 
			
		||||
        fi
 | 
			
		||||
	# Put the nasty error message in config.log where it belongs
 | 
			
		||||
	echo "$APP_MACHINEID_PKG_ERRORS" >&5
 | 
			
		||||
 | 
			
		||||
	$bailout
 | 
			
		||||
elif test $pkg_failed = untried; then
 | 
			
		||||
     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 | 
			
		||||
$as_echo "no" >&6; }
 | 
			
		||||
	$bailout
 | 
			
		||||
else
 | 
			
		||||
	APP_MACHINEID_CFLAGS=$pkg_cv_APP_MACHINEID_CFLAGS
 | 
			
		||||
	APP_MACHINEID_LIBS=$pkg_cv_APP_MACHINEID_LIBS
 | 
			
		||||
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 | 
			
		||||
$as_echo "yes" >&6; }
 | 
			
		||||
	HAVE_APP_MACHINEID=yes
 | 
			
		||||
fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
@@ -11878,14 +11868,85 @@ fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if test "$UDEV_SYSTEMD_BACKGROUND_JOBS" != no; then
 | 
			
		||||
	if test "$SYSTEMD_MIN_VERSION" -ge 205; then :
 | 
			
		||||
  UDEV_SYSTEMD_BACKGROUND_JOBS=yes
 | 
			
		||||
	pkg_config_init
 | 
			
		||||
 | 
			
		||||
pkg_failed=no
 | 
			
		||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SYSTEMD" >&5
 | 
			
		||||
$as_echo_n "checking for SYSTEMD... " >&6; }
 | 
			
		||||
 | 
			
		||||
if test -n "$SYSTEMD_CFLAGS"; then
 | 
			
		||||
    pkg_cv_SYSTEMD_CFLAGS="$SYSTEMD_CFLAGS"
 | 
			
		||||
 elif test -n "$PKG_CONFIG"; then
 | 
			
		||||
    if test -n "$PKG_CONFIG" && \
 | 
			
		||||
    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= 205\""; } >&5
 | 
			
		||||
  ($PKG_CONFIG --exists --print-errors "systemd >= 205") 2>&5
 | 
			
		||||
  ac_status=$?
 | 
			
		||||
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
 | 
			
		||||
  test $ac_status = 0; }; then
 | 
			
		||||
  pkg_cv_SYSTEMD_CFLAGS=`$PKG_CONFIG --cflags "systemd >= 205" 2>/dev/null`
 | 
			
		||||
		      test "x$?" != "x0" && pkg_failed=yes
 | 
			
		||||
else
 | 
			
		||||
  if test "$UDEV_SYSTEMD_BACKGROUND_JOBS" = maybe; then :
 | 
			
		||||
  UDEV_SYSTEMD_BACKGROUND_JOBS=no
 | 
			
		||||
else
 | 
			
		||||
  as_fn_error $? "bailing out... systemd >= 205 is required" "$LINENO" 5
 | 
			
		||||
  pkg_failed=yes
 | 
			
		||||
fi
 | 
			
		||||
 else
 | 
			
		||||
    pkg_failed=untried
 | 
			
		||||
fi
 | 
			
		||||
if test -n "$SYSTEMD_LIBS"; then
 | 
			
		||||
    pkg_cv_SYSTEMD_LIBS="$SYSTEMD_LIBS"
 | 
			
		||||
 elif test -n "$PKG_CONFIG"; then
 | 
			
		||||
    if test -n "$PKG_CONFIG" && \
 | 
			
		||||
    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"systemd >= 205\""; } >&5
 | 
			
		||||
  ($PKG_CONFIG --exists --print-errors "systemd >= 205") 2>&5
 | 
			
		||||
  ac_status=$?
 | 
			
		||||
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
 | 
			
		||||
  test $ac_status = 0; }; then
 | 
			
		||||
  pkg_cv_SYSTEMD_LIBS=`$PKG_CONFIG --libs "systemd >= 205" 2>/dev/null`
 | 
			
		||||
		      test "x$?" != "x0" && pkg_failed=yes
 | 
			
		||||
else
 | 
			
		||||
  pkg_failed=yes
 | 
			
		||||
fi
 | 
			
		||||
 else
 | 
			
		||||
    pkg_failed=untried
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if test $pkg_failed = yes; then
 | 
			
		||||
   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 | 
			
		||||
$as_echo "no" >&6; }
 | 
			
		||||
 | 
			
		||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
 | 
			
		||||
        _pkg_short_errors_supported=yes
 | 
			
		||||
else
 | 
			
		||||
        _pkg_short_errors_supported=no
 | 
			
		||||
fi
 | 
			
		||||
        if test $_pkg_short_errors_supported = yes; then
 | 
			
		||||
	        SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "systemd >= 205" 2>&1`
 | 
			
		||||
        else
 | 
			
		||||
	        SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "systemd >= 205" 2>&1`
 | 
			
		||||
        fi
 | 
			
		||||
	# Put the nasty error message in config.log where it belongs
 | 
			
		||||
	echo "$SYSTEMD_PKG_ERRORS" >&5
 | 
			
		||||
 | 
			
		||||
	if test "$UDEV_SYSTEMD_BACKGROUND_JOBS" = maybe; then
 | 
			
		||||
				UDEV_SYSTEMD_BACKGROUND_JOBS=no
 | 
			
		||||
			   else
 | 
			
		||||
				as_fn_error $? "bailing out... systemd >= 205 is required" "$LINENO" 5
 | 
			
		||||
			   fi
 | 
			
		||||
elif test $pkg_failed = untried; then
 | 
			
		||||
     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 | 
			
		||||
$as_echo "no" >&6; }
 | 
			
		||||
	if test "$UDEV_SYSTEMD_BACKGROUND_JOBS" = maybe; then
 | 
			
		||||
				UDEV_SYSTEMD_BACKGROUND_JOBS=no
 | 
			
		||||
			   else
 | 
			
		||||
				as_fn_error $? "bailing out... systemd >= 205 is required" "$LINENO" 5
 | 
			
		||||
			   fi
 | 
			
		||||
else
 | 
			
		||||
	SYSTEMD_CFLAGS=$pkg_cv_SYSTEMD_CFLAGS
 | 
			
		||||
	SYSTEMD_LIBS=$pkg_cv_SYSTEMD_LIBS
 | 
			
		||||
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 | 
			
		||||
$as_echo "yes" >&6; }
 | 
			
		||||
	UDEV_SYSTEMD_BACKGROUND_JOBS=yes
 | 
			
		||||
fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
@@ -14325,19 +14386,6 @@ cat >>confdefs.h <<_ACEOF
 | 
			
		||||
_ACEOF
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -14482,6 +14530,11 @@ _ACEOF
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										158
									
								
								configure.ac
									
									
									
									
									
								
							
							
						
						
									
										158
									
								
								configure.ac
									
									
									
									
									
								
							@@ -219,6 +219,7 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
 | 
			
		||||
# Let make expand exec_prefix.
 | 
			
		||||
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
dnl -- Setup the ownership of the files
 | 
			
		||||
AC_MSG_CHECKING(file owner)
 | 
			
		||||
@@ -285,20 +286,6 @@ esac
 | 
			
		||||
AC_MSG_RESULT(on $ADD_NODE)
 | 
			
		||||
AC_DEFINE_UNQUOTED([DEFAULT_DM_ADD_NODE], $add_on, [Define default node creation behavior with dmsetup create])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
dnl -- Default settings for lvm.conf { devices/use_devicesfile }
 | 
			
		||||
AC_MSG_CHECKING(default for use_devicesfile)
 | 
			
		||||
AC_ARG_WITH(default-use-devices-file,
 | 
			
		||||
	      AS_HELP_STRING([--with-default-use-devices-file], [default for lvm.conf devices/use_devicesfile = [0]]),
 | 
			
		||||
	      DEFAULT_USE_DEVICES_FILE=$enableval, DEFAULT_USE_DEVICES_FILE=0)
 | 
			
		||||
case "$DEFAULT_USE_DEVICES_FILE" in
 | 
			
		||||
 0|1);;
 | 
			
		||||
 *) AC_MSG_ERROR([--with-default-use-devices-file parameter invalid]);;
 | 
			
		||||
esac
 | 
			
		||||
AC_MSG_RESULT($DEFAULT_USE_DEVICES_FILE)
 | 
			
		||||
AC_DEFINE_UNQUOTED(DEFAULT_USE_DEVICES_FILE, [$DEFAULT_USE_DEVICES_FILE],
 | 
			
		||||
		   [Default for lvm.conf use_devicefile.])
 | 
			
		||||
 | 
			
		||||
AC_MSG_CHECKING(default name mangling)
 | 
			
		||||
AC_ARG_WITH(default-name-mangling,
 | 
			
		||||
	    AS_HELP_STRING([--with-default-name-mangling=MANGLING],
 | 
			
		||||
@@ -430,7 +417,7 @@ case "$THIN" in
 | 
			
		||||
			THIN_CONFIGURE_WARN=y
 | 
			
		||||
		fi
 | 
			
		||||
	fi
 | 
			
		||||
	if test "$THIN_CHECK_NEEDS_CHECK" = yes && test "$THIN_CONFIGURE_WARN" != y ; then
 | 
			
		||||
	if test "$THIN_CHECK_NEEDS_CHECK" = yes; then
 | 
			
		||||
		THIN_CHECK_VSN=`"$THIN_CHECK_CMD" -V 2>/dev/null`
 | 
			
		||||
		THIN_CHECK_VSN_MAJOR=`echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $1}'`
 | 
			
		||||
		THIN_CHECK_VSN_MINOR=`echo "$THIN_CHECK_VSN" | $AWK -F '.' '{print $2}'`
 | 
			
		||||
@@ -543,7 +530,7 @@ case "$CACHE" in
 | 
			
		||||
			CACHE_CONFIGURE_WARN=y
 | 
			
		||||
		fi
 | 
			
		||||
	fi
 | 
			
		||||
	if test "$CACHE_CHECK_NEEDS_CHECK" = yes && test "$CACHE_CONFIGURE_WARN" != y ; then
 | 
			
		||||
	if test "$CACHE_CHECK_NEEDS_CHECK" = yes; then
 | 
			
		||||
		$CACHE_CHECK_CMD -V 2>/dev/null >conftest.tmp
 | 
			
		||||
		read -r CACHE_CHECK_VSN < conftest.tmp
 | 
			
		||||
		IFS=.- read -r CACHE_CHECK_VSN_MAJOR CACHE_CHECK_VSN_MINOR CACHE_CHECK_VSN_PATCH LEFTOVER < conftest.tmp
 | 
			
		||||
@@ -785,6 +772,39 @@ AC_ARG_WITH(default-run-dir,
 | 
			
		||||
AC_DEFINE_UNQUOTED(DEFAULT_RUN_DIR, ["$DEFAULT_RUN_DIR"],
 | 
			
		||||
		   [Default LVM run directory.])
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
dnl -- Build cluster mirror log daemon
 | 
			
		||||
AC_MSG_CHECKING(whether to build cluster mirror log daemon)
 | 
			
		||||
AC_ARG_ENABLE(cmirrord,
 | 
			
		||||
	      AS_HELP_STRING([--enable-cmirrord],
 | 
			
		||||
			     [enable the cluster mirror log daemon]),
 | 
			
		||||
	      CMIRRORD=$enableval, CMIRRORD=no)
 | 
			
		||||
AC_MSG_RESULT($CMIRRORD)
 | 
			
		||||
 | 
			
		||||
BUILD_CMIRRORD=$CMIRRORD
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
dnl -- cmirrord pidfile
 | 
			
		||||
if test "$BUILD_CMIRRORD" = yes; then
 | 
			
		||||
	AC_ARG_WITH(cmirrord-pidfile,
 | 
			
		||||
		    AS_HELP_STRING([--with-cmirrord-pidfile=PATH],
 | 
			
		||||
				   [cmirrord pidfile [PID_DIR/cmirrord.pid]]),
 | 
			
		||||
		    CMIRRORD_PIDFILE=$withval,
 | 
			
		||||
		    CMIRRORD_PIDFILE="$DEFAULT_PID_DIR/cmirrord.pid")
 | 
			
		||||
	AC_DEFINE_UNQUOTED(CMIRRORD_PIDFILE, ["$CMIRRORD_PIDFILE"],
 | 
			
		||||
			   [Path to cmirrord pidfile.])
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
dnl -- Look for corosync libraries if required.
 | 
			
		||||
if [[ "$BUILD_CMIRRORD" = yes ]]; then
 | 
			
		||||
	pkg_config_init
 | 
			
		||||
 | 
			
		||||
	if test "$HAVE_CPG" != yes; then
 | 
			
		||||
		PKG_CHECK_MODULES(CPG, libcpg)
 | 
			
		||||
	fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
dnl -- Enable debugging
 | 
			
		||||
AC_MSG_CHECKING(whether to enable debugging)
 | 
			
		||||
@@ -1065,65 +1085,45 @@ if test "$BUILD_DMFILEMAPD" = yes; then
 | 
			
		||||
   AC_CHECK_HEADER([linux/fiemap.h], , [AC_MSG_ERROR(--enable-dmfilemapd requires fiemap.h)])
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
SYSTEMD_MIN_VERSION=0
 | 
			
		||||
pkg_config_init
 | 
			
		||||
PKG_CHECK_EXISTS(systemd >= 205, [SYSTEMD_MIN_VERSION=205], [])
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
dnl -- Build notifydbus
 | 
			
		||||
PKG_CHECK_EXISTS(systemd >= 221, [SYSTEMD_MIN_VERSION=221], [])
 | 
			
		||||
AC_MSG_CHECKING(whether to build notifydbus)
 | 
			
		||||
AC_ARG_ENABLE(notify-dbus,
 | 
			
		||||
	      AS_HELP_STRING([--enable-notify-dbus],
 | 
			
		||||
			     [enable LVM notification using dbus]),
 | 
			
		||||
	      AS_IF([test "$enableval" = yes && test "$SYSTEMD_MIN_VERSION" -lt 221],
 | 
			
		||||
		    AC_MSG_ERROR([Enabling notify-dbus requires systemd >= 221]))
 | 
			
		||||
	      NOTIFYDBUS_SUPPORT=$enableval, NOTIFYDBUS_SUPPORT=no)
 | 
			
		||||
AC_MSG_RESULT($NOTIFYDBUS_SUPPORT)
 | 
			
		||||
 | 
			
		||||
AS_IF([test "$NOTIFYDBUS_SUPPORT" = yes],
 | 
			
		||||
      AC_DEFINE([NOTIFYDBUS_SUPPORT], 1, [Define to 1 to include code that uses dbus notification.]))
 | 
			
		||||
if test "$NOTIFYDBUS_SUPPORT" = yes; then
 | 
			
		||||
	AC_DEFINE([NOTIFYDBUS_SUPPORT], 1, [Define to 1 to include code that uses dbus notification.])
 | 
			
		||||
	SYSTEMD_LIBS="-lsystemd"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
dnl -- Build with systemd journaling when the header file is present
 | 
			
		||||
AS_IF([test "$SYSTEMD_MIN_VERSION" -ge 221], [SYSTEMD_JOURNAL_SUPPORT=maybe], [SYSTEMD_JOURNAL_SUPPORT=no])
 | 
			
		||||
AC_CHECK_HEADER([systemd/sd-journal.h],
 | 
			
		||||
		[AS_IF([test "$SYSTEMD_JOURNAL_SUPPORT" != no], [SYSTEMD_JOURNAL_SUPPORT=yes])],
 | 
			
		||||
                [SYSTEMD_JOURNAL_SUPPORT=no])
 | 
			
		||||
AC_MSG_CHECKING(whether to log to systemd journal)
 | 
			
		||||
AC_ARG_ENABLE(systemd-journal,
 | 
			
		||||
	      AS_HELP_STRING([--disable-systemd-journal],
 | 
			
		||||
			     [disable LVM systemd journaling]),
 | 
			
		||||
	      AS_IF([test "$enableval" = yes && test "$SYSTEMD_JOURNAL_SUPPORT" = no],
 | 
			
		||||
		    AC_MSG_ERROR([Enabling systemd journal requires systemd/sd-journal.h and systemd >= 221.]))
 | 
			
		||||
	      SYSTEMD_JOURNAL_SUPPORT=$enableval, [])
 | 
			
		||||
AC_MSG_RESULT($SYSTEMD_JOURNAL_SUPPORT)
 | 
			
		||||
 | 
			
		||||
AS_IF([test "$SYSTEMD_JOURNAL_SUPPORT" = yes],
 | 
			
		||||
      AC_DEFINE([SYSTEMD_JOURNAL_SUPPORT], 1, [Define to 1 to include code that uses systemd journal.]))
 | 
			
		||||
dnl -- Look for dbus libraries
 | 
			
		||||
if test "$NOTIFYDBUS_SUPPORT" = yes; then
 | 
			
		||||
	PKG_CHECK_MODULES(NOTIFY_DBUS, systemd >= 221, [HAVE_NOTIFY_DBUS=yes], $bailout)
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
dnl -- Build appmachineid when header file sd-id128.h is present
 | 
			
		||||
PKG_CHECK_EXISTS(systemd >= 234, [SYSTEMD_MIN_VERSION=234  APP_MACHINEID_SUPPORT=maybe], [APP_MACHINEID_SUPPORT=no])
 | 
			
		||||
AC_CHECK_HEADER([systemd/sd-id128.h],
 | 
			
		||||
		[AS_IF([test "$APP_MACHINEID_SUPPORT" != no], [APP_MACHINEID_SUPPORT=yes])],
 | 
			
		||||
		[APP_MACHINEID_SUPPORT=no])
 | 
			
		||||
AC_MSG_CHECKING(whether to support systemd appmachineid)
 | 
			
		||||
dnl -- Build appmachineid
 | 
			
		||||
AC_MSG_CHECKING(whether to build appmachineid)
 | 
			
		||||
AC_ARG_ENABLE(app-machineid,
 | 
			
		||||
	      AC_HELP_STRING([--disable-app-machineid],
 | 
			
		||||
			     [disable LVM system ID using app-specific machine-id]),
 | 
			
		||||
	      AS_IF([test "$enableval" = yes && test "$APP_MACHINEID_SUPPORT" = no],
 | 
			
		||||
		    AC_MSG_ERROR([Enabling app machineid requires systemd/sd-id128.h and systemd >= 234.]))
 | 
			
		||||
	      APP_MACHINEID_SUPPORT=$enableval, [])
 | 
			
		||||
	      AC_HELP_STRING([--enable-app-machineid],
 | 
			
		||||
			     [enable LVM system ID using app-specific machine-id]),
 | 
			
		||||
	      APP_MACHINEID_SUPPORT=$enableval, APP_MACHINEID_SUPPORT=no)
 | 
			
		||||
AC_MSG_RESULT($APP_MACHINEID_SUPPORT)
 | 
			
		||||
 | 
			
		||||
AS_IF([test "$APP_MACHINEID_SUPPORT" = yes],
 | 
			
		||||
      AC_DEFINE([APP_MACHINEID_SUPPORT], 1, [Define to 1 to include code that uses libsystemd machine-id apis.]))
 | 
			
		||||
if test "$APP_MACHINEID_SUPPORT" = yes; then
 | 
			
		||||
	AC_DEFINE([APP_MACHINEID_SUPPORT], 1, [Define to 1 to include code that uses libsystemd machine-id apis.])
 | 
			
		||||
	SYSTEMD_LIBS="-lsystemd"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
dnl -- Look for libsystemd libraries if needed
 | 
			
		||||
AS_IF([test "$NOTIFYDBUS_SUPPORT" = yes || test "$SYSTEMD_JOURNAL_SUPPORT" = yes || test "$APP_MACHINEID_SUPPORT" = yes ] ,[
 | 
			
		||||
      pkg_config_init
 | 
			
		||||
      PKG_CHECK_MODULES(SYSTEMD, [systemd], [SYSTEMD_LIBS="-lsystemd"], $bailout) ])
 | 
			
		||||
################################################################################
 | 
			
		||||
dnl -- Look for libsystemd libraries
 | 
			
		||||
if test "$APP_MACHINEID_SUPPORT" = yes; then
 | 
			
		||||
	PKG_CHECK_MODULES(APP_MACHINEID, systemd >= 234, [HAVE_APP_MACHINEID=yes], $bailout)
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
 | 
			
		||||
@@ -1162,11 +1162,14 @@ AC_ARG_ENABLE(udev-systemd-background-jobs,
 | 
			
		||||
	      UDEV_SYSTEMD_BACKGROUND_JOBS=maybe)
 | 
			
		||||
 | 
			
		||||
if test "$UDEV_SYSTEMD_BACKGROUND_JOBS" != no; then
 | 
			
		||||
	AS_IF([test "$SYSTEMD_MIN_VERSION" -ge 205],
 | 
			
		||||
	      UDEV_SYSTEMD_BACKGROUND_JOBS=yes,
 | 
			
		||||
	      AS_IF([test "$UDEV_SYSTEMD_BACKGROUND_JOBS" = maybe],
 | 
			
		||||
		     [UDEV_SYSTEMD_BACKGROUND_JOBS=no],
 | 
			
		||||
		     [AC_MSG_ERROR([bailing out... systemd >= 205 is required])]))
 | 
			
		||||
	pkg_config_init
 | 
			
		||||
	PKG_CHECK_MODULES(SYSTEMD, systemd >= 205,
 | 
			
		||||
			  [UDEV_SYSTEMD_BACKGROUND_JOBS=yes],
 | 
			
		||||
			  [if test "$UDEV_SYSTEMD_BACKGROUND_JOBS" = maybe; then
 | 
			
		||||
				UDEV_SYSTEMD_BACKGROUND_JOBS=no
 | 
			
		||||
			   else
 | 
			
		||||
				AC_MSG_ERROR([bailing out... systemd >= 205 is required])
 | 
			
		||||
			   fi])
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
AC_MSG_CHECKING(whether to use udev-systemd protocol for jobs in background)
 | 
			
		||||
@@ -1639,6 +1642,10 @@ fi
 | 
			
		||||
AC_MSG_CHECKING(whether to enable editline)
 | 
			
		||||
AC_MSG_RESULT($EDITLINE)
 | 
			
		||||
 | 
			
		||||
if test "$BUILD_CMIRRORD" = yes; then
 | 
			
		||||
	AC_CHECK_FUNCS(atexit,,hard_bailout)
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if test "$BUILD_LVMLOCKD" = yes; then
 | 
			
		||||
	AS_IF([test "$HAVE_REALTIME" != yes], [AC_MSG_ERROR([Realtime clock support is mandatory for lvmlockd.])])
 | 
			
		||||
	AC_CHECK_FUNCS(strtoull,,hard_bailout)
 | 
			
		||||
@@ -1798,22 +1805,10 @@ LVM_LIBAPI=`echo "$VER" | $AWK -F '[[()]]' '{print $2}'`
 | 
			
		||||
 | 
			
		||||
AC_DEFINE_UNQUOTED(LVM_CONFIGURE_LINE, "$CONFIGURE_LINE", [configure command line used])
 | 
			
		||||
 | 
			
		||||
AC_ARG_VAR([BLKID_CFLAGS], [C compiler flags for blkid])
 | 
			
		||||
AC_ARG_VAR([BLKID_LIBS], [linker flags for blkid])
 | 
			
		||||
AC_ARG_VAR([CPG_CFLAGS], [C compiler flags for cpg])
 | 
			
		||||
AC_ARG_VAR([CPG_LIBS], [linker flags for cpg])
 | 
			
		||||
AC_ARG_VAR([EDITLINE_CFLAGS], [C compiler flags for editline])
 | 
			
		||||
AC_ARG_VAR([EDITLINE_LIBS], [linker flags for editline])
 | 
			
		||||
AC_ARG_VAR([READLINE_CFLAGS], [C compiler flags for readline])
 | 
			
		||||
AC_ARG_VAR([READLINE_LIBS], [linker flags for readline])
 | 
			
		||||
AC_ARG_VAR([SYSTEMD_CFLAGS], [C compiler flags for systemd])
 | 
			
		||||
AC_ARG_VAR([SYSTEMD_LIBS], [linker flags for systemd])
 | 
			
		||||
AC_ARG_VAR([UDEV_CFLAGS], [C compiler flags for udev])
 | 
			
		||||
AC_ARG_VAR([UDEV_LIBS], [linker flags for udev])
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
AC_SUBST(AWK)
 | 
			
		||||
AC_SUBST(BLKID_PC)
 | 
			
		||||
AC_SUBST(BUILD_CMIRRORD)
 | 
			
		||||
AC_SUBST(BUILD_DMEVENTD)
 | 
			
		||||
AC_SUBST(BUILD_LVMDBUSD)
 | 
			
		||||
AC_SUBST(BUILD_LVMPOLLD)
 | 
			
		||||
@@ -1834,6 +1829,8 @@ AC_SUBST(CONFDB_CFLAGS)
 | 
			
		||||
AC_SUBST(CONFDB_LIBS)
 | 
			
		||||
AC_SUBST(CONFDIR)
 | 
			
		||||
AC_SUBST(COPTIMISE_FLAG)
 | 
			
		||||
AC_SUBST(CPG_CFLAGS)
 | 
			
		||||
AC_SUBST(CPG_LIBS)
 | 
			
		||||
AC_SUBST(CSCOPE_CMD)
 | 
			
		||||
AC_SUBST(DEBUG)
 | 
			
		||||
AC_SUBST(DEFAULT_ARCHIVE_SUBDIR)
 | 
			
		||||
@@ -1905,6 +1902,8 @@ AC_SUBST(PYTHON3DIR)
 | 
			
		||||
AC_SUBST(QUORUM_CFLAGS)
 | 
			
		||||
AC_SUBST(QUORUM_LIBS)
 | 
			
		||||
AC_SUBST(RT_LIBS)
 | 
			
		||||
AC_SUBST(READLINE_LIBS)
 | 
			
		||||
AC_SUBST(EDITLINE_LIBS)
 | 
			
		||||
AC_SUBST(REPLICATORS)
 | 
			
		||||
AC_SUBST(SACKPT_CFLAGS)
 | 
			
		||||
AC_SUBST(SACKPT_LIBS)
 | 
			
		||||
@@ -1914,6 +1913,7 @@ AC_SUBST(SBINDIR)
 | 
			
		||||
AC_SUBST(SELINUX_LIBS)
 | 
			
		||||
AC_SUBST(SELINUX_PC)
 | 
			
		||||
AC_SUBST(SYSCONFDIR)
 | 
			
		||||
AC_SUBST(SYSTEMD_LIBS)
 | 
			
		||||
AC_SUBST(SNAPSHOTS)
 | 
			
		||||
AC_SUBST(STATICDIR)
 | 
			
		||||
AC_SUBST(STATIC_LINK)
 | 
			
		||||
@@ -1946,6 +1946,7 @@ AC_SUBST(WRITE_INSTALL)
 | 
			
		||||
AC_SUBST(DMEVENTD_PIDFILE)
 | 
			
		||||
AC_SUBST(LVMPOLLD_PIDFILE)
 | 
			
		||||
AC_SUBST(LVMLOCKD_PIDFILE)
 | 
			
		||||
AC_SUBST(CMIRRORD_PIDFILE)
 | 
			
		||||
AC_SUBST(interface)
 | 
			
		||||
AC_SUBST(kerneldir)
 | 
			
		||||
AC_SUBST(missingkernel)
 | 
			
		||||
@@ -1967,6 +1968,7 @@ Makefile
 | 
			
		||||
make.tmpl
 | 
			
		||||
libdm/make.tmpl
 | 
			
		||||
daemons/Makefile
 | 
			
		||||
daemons/cmirrord/Makefile
 | 
			
		||||
daemons/dmeventd/Makefile
 | 
			
		||||
daemons/dmeventd/libdevmapper-event.pc
 | 
			
		||||
daemons/dmeventd/plugins/Makefile
 | 
			
		||||
@@ -2000,14 +2002,14 @@ libdm/libdevmapper.pc
 | 
			
		||||
man/Makefile
 | 
			
		||||
po/Makefile
 | 
			
		||||
scripts/lvm2-pvscan.service
 | 
			
		||||
scripts/lvm-activate-vgs-main.service
 | 
			
		||||
scripts/lvm-activate-vgs-last.service
 | 
			
		||||
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_lvmpolld_init_red_hat
 | 
			
		||||
scripts/lvm2_lvmpolld_systemd_red_hat.service
 | 
			
		||||
 
 | 
			
		||||
@@ -90,9 +90,6 @@
 | 
			
		||||
/* Use blkid wiping by default. */
 | 
			
		||||
#undef DEFAULT_USE_BLKID_WIPING
 | 
			
		||||
 | 
			
		||||
/* Default for lvm.conf use_devicefile. */
 | 
			
		||||
#undef DEFAULT_USE_DEVICES_FILE
 | 
			
		||||
 | 
			
		||||
/* Use lvmlockd by default. */
 | 
			
		||||
#undef DEFAULT_USE_LVMLOCKD
 | 
			
		||||
 | 
			
		||||
@@ -671,9 +668,6 @@
 | 
			
		||||
/* Define to 1 if strerror_r returns char *. */
 | 
			
		||||
#undef STRERROR_R_CHAR_P
 | 
			
		||||
 | 
			
		||||
/* Define to 1 to include code that uses systemd journal. */
 | 
			
		||||
#undef SYSTEMD_JOURNAL_SUPPORT
 | 
			
		||||
 | 
			
		||||
/* Path to testsuite data */
 | 
			
		||||
#undef TESTSUITE_DATA
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								lib/cache/lvmcache.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								lib/cache/lvmcache.c
									
									
									
									
										vendored
									
									
								
							@@ -1349,7 +1349,7 @@ int lvmcache_label_scan(struct cmd_context *cmd)
 | 
			
		||||
 | 
			
		||||
		dm_list_iterate_items(devl, &add_cache_devs) {
 | 
			
		||||
			log_debug_cache("Adding chosen duplicate %s", dev_name(devl->dev));
 | 
			
		||||
			label_scan_dev(cmd, devl->dev);
 | 
			
		||||
			label_scan_dev(devl->dev);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		dm_list_splice(&_unused_duplicates, &del_cache_devs);
 | 
			
		||||
@@ -2168,17 +2168,15 @@ struct lvmcache_info *lvmcache_add(struct cmd_context *cmd, struct labeller *lab
 | 
			
		||||
{
 | 
			
		||||
	const char *pvid = pvid_arg;
 | 
			
		||||
	const char *vgid = vgid_arg;
 | 
			
		||||
	char pvid_dashed[64] __attribute__((aligned(8)));
 | 
			
		||||
	struct lvmcache_vgsummary vgsummary = { 0 };
 | 
			
		||||
	struct lvmcache_info *info;
 | 
			
		||||
	struct lvmcache_info *info_lookup;
 | 
			
		||||
	struct device_list *devl;
 | 
			
		||||
	int created = 0;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Note: ensure that callers of lvmcache_add() pass null terminated
 | 
			
		||||
	 * pvid and vgid strings, and do not pass char* that is type cast
 | 
			
		||||
	 * from struct id.
 | 
			
		||||
	 */
 | 
			
		||||
	if (!id_write_format((const struct id *)&pvid, pvid_dashed, sizeof(pvid_dashed)))
 | 
			
		||||
		stack;
 | 
			
		||||
 | 
			
		||||
	log_debug_cache("Found PVID %s on %s", pvid, dev_name(dev));
 | 
			
		||||
 | 
			
		||||
@@ -2208,7 +2206,7 @@ struct lvmcache_info *lvmcache_add(struct cmd_context *cmd, struct labeller *lab
 | 
			
		||||
	if (!created) {
 | 
			
		||||
		if (info->dev != dev) {
 | 
			
		||||
			log_debug_cache("Saving initial duplicate device %s previously seen on %s with PVID %s.",
 | 
			
		||||
					dev_name(dev), dev_name(info->dev), pvid);
 | 
			
		||||
					dev_name(dev), dev_name(info->dev), pvid_dashed);
 | 
			
		||||
 | 
			
		||||
			memset(&dev->pvid, 0, sizeof(dev->pvid));
 | 
			
		||||
			memcpy(dev->pvid, pvid, ID_LEN);
 | 
			
		||||
 
 | 
			
		||||
@@ -377,11 +377,12 @@ static void _init_logging(struct cmd_context *cmd)
 | 
			
		||||
 | 
			
		||||
	/* Syslog */
 | 
			
		||||
	cmd->default_settings.syslog = find_config_tree_bool(cmd, log_syslog_CFG, NULL);
 | 
			
		||||
	if (cmd->default_settings.syslog)
 | 
			
		||||
		init_syslog(1, DEFAULT_LOG_FACILITY);
 | 
			
		||||
	else
 | 
			
		||||
	if (cmd->default_settings.syslog != 1)
 | 
			
		||||
		fin_syslog();
 | 
			
		||||
 | 
			
		||||
	if (cmd->default_settings.syslog > 1)
 | 
			
		||||
		init_syslog(cmd->default_settings.syslog);
 | 
			
		||||
 | 
			
		||||
	/* Debug level for log file output */
 | 
			
		||||
	cmd->default_settings.debug = find_config_tree_int(cmd, log_level_CFG, NULL);
 | 
			
		||||
	init_debug(cmd->default_settings.debug);
 | 
			
		||||
@@ -765,7 +766,6 @@ static int _process_config(struct cmd_context *cmd)
 | 
			
		||||
	init_pv_min_size((uint64_t)pv_min_kb * (1024 >> SECTOR_SHIFT));
 | 
			
		||||
 | 
			
		||||
	cmd->check_pv_dev_sizes = find_config_tree_bool(cmd, metadata_check_pv_device_sizes_CFG, NULL);
 | 
			
		||||
	cmd->event_activation = find_config_tree_bool(cmd, global_event_activation_CFG, NULL);
 | 
			
		||||
 | 
			
		||||
	if (!process_profilable_config(cmd))
 | 
			
		||||
		return_0;
 | 
			
		||||
@@ -1653,6 +1653,8 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd,
 | 
			
		||||
	bindtextdomain(INTL_PACKAGE, LOCALEDIR);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	init_syslog(DEFAULT_LOG_FACILITY);
 | 
			
		||||
 | 
			
		||||
	if (!(cmd = zalloc(sizeof(*cmd)))) {
 | 
			
		||||
		log_error("Failed to allocate command context");
 | 
			
		||||
		return NULL;
 | 
			
		||||
 
 | 
			
		||||
@@ -183,7 +183,6 @@ struct cmd_context {
 | 
			
		||||
	unsigned enable_hints:1;		/* hints are enabled for cmds in general */
 | 
			
		||||
	unsigned use_hints:1;			/* if hints are enabled this cmd can use them */
 | 
			
		||||
	unsigned pvscan_recreate_hints:1;	/* enable special case hint handling for pvscan --cache */
 | 
			
		||||
	unsigned hints_pvs_online:1;		/* hints="pvs_online" */
 | 
			
		||||
	unsigned scan_lvs:1;
 | 
			
		||||
	unsigned wipe_outdated_pvs:1;
 | 
			
		||||
	unsigned enable_devices_list:1;		/* command is using --devices option */
 | 
			
		||||
@@ -200,8 +199,6 @@ struct cmd_context {
 | 
			
		||||
	unsigned check_devs_used:1;		/* check devs used by LVs */
 | 
			
		||||
	unsigned print_device_id_not_found:1;	/* print devices file entries not found */
 | 
			
		||||
	unsigned ignore_device_name_mismatch:1; /* skip updating devices file names */
 | 
			
		||||
	unsigned backup_disabled:1;		/* skip repeated debug message */
 | 
			
		||||
	unsigned event_activation:1;		/* whether event_activation is set */
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Devices and filtering.
 | 
			
		||||
 
 | 
			
		||||
@@ -1130,18 +1130,6 @@ cfg(global_event_activation_CFG, "event_activation", global_CFG_SECTION, CFG_DEF
 | 
			
		||||
	"See the --setautoactivation option or the auto_activation_volume_list\n"
 | 
			
		||||
	"setting to configure autoactivation for specific VGs or LVs.\n")
 | 
			
		||||
 | 
			
		||||
cfg_array(global_event_activation_options_CFG, "event_activation_options", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_EVENT_ACTIVATION_OPTIONS, vsn(2, 3, 14), NULL, 0, NULL,
 | 
			
		||||
	"Set event activation options.\n"
 | 
			
		||||
	"service_to_event: begin with fixed activation services,\n"
 | 
			
		||||
	"then switch to event based activation.\n"
 | 
			
		||||
	"event_only: only use event based activation.\n"
 | 
			
		||||
	"service_only: only use fixed activation services.\n"
 | 
			
		||||
	"(This is equivalent to event_activation=0.)\n"
 | 
			
		||||
	"Autoactivation commands should set --eventactivation service|event\n"
 | 
			
		||||
	"to indicate if they are performing service or event activation.\n"
 | 
			
		||||
	"An autoactivation command may then be skipped according to the\n"
 | 
			
		||||
	"value of this setting.\n")
 | 
			
		||||
 | 
			
		||||
cfg(global_use_lvmetad_CFG, "use_lvmetad", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, 0, vsn(2, 2, 93), 0, vsn(2, 3, 0), NULL,
 | 
			
		||||
	NULL)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -221,7 +221,7 @@
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define DEFAULT_COMMAND_LOG_REPORT 0
 | 
			
		||||
#define DEFAULT_SYSLOG 0
 | 
			
		||||
#define DEFAULT_SYSLOG 1
 | 
			
		||||
#define DEFAULT_VERBOSE 0
 | 
			
		||||
#define DEFAULT_SILENT 0
 | 
			
		||||
#define DEFAULT_LOGLEVEL 0
 | 
			
		||||
@@ -322,17 +322,11 @@
 | 
			
		||||
 | 
			
		||||
#define DEFAULT_MD_COMPONENT_CHECKS "auto"
 | 
			
		||||
 | 
			
		||||
#define DEFAULT_USE_DEVICES_FILE 1
 | 
			
		||||
#define DEFAULT_DEVICES_FILE "system.devices"
 | 
			
		||||
 | 
			
		||||
#define DEFAULT_SEARCH_FOR_DEVNAMES "auto"
 | 
			
		||||
 | 
			
		||||
#define DEFAULT_WWIDS_FILE "/etc/multipath/wwids"
 | 
			
		||||
 | 
			
		||||
#define DEFAULT_EVENT_ACTIVATION_OPTION1 "service_to_event"
 | 
			
		||||
#define DEFAULT_EVENT_ACTIVATION_OPTIONS "#S" DEFAULT_EVENT_ACTIVATION_OPTION1
 | 
			
		||||
 | 
			
		||||
#define PVS_ONLINE_DIR DEFAULT_RUN_DIR "/pvs_online"
 | 
			
		||||
#define VGS_ONLINE_DIR DEFAULT_RUN_DIR "/vgs_online"
 | 
			
		||||
#define PVS_LOOKUP_DIR DEFAULT_RUN_DIR "/pvs_lookup"
 | 
			
		||||
 | 
			
		||||
#endif				/* _LVM_DEFAULTS_H */
 | 
			
		||||
 
 | 
			
		||||
@@ -1831,7 +1831,7 @@ int setup_devices_file(struct cmd_context *cmd)
 | 
			
		||||
 * Add all system devices to dev-cache, and attempt to
 | 
			
		||||
 * match all devices_file entries to dev-cache entries.
 | 
			
		||||
 */
 | 
			
		||||
int setup_devices(struct cmd_context *cmd)
 | 
			
		||||
static int _setup_devices(struct cmd_context *cmd, int no_file_match)
 | 
			
		||||
{
 | 
			
		||||
	int file_exists;
 | 
			
		||||
	int lock_mode = 0;
 | 
			
		||||
@@ -1958,6 +1958,13 @@ int setup_devices(struct cmd_context *cmd)
 | 
			
		||||
	 */
 | 
			
		||||
	dev_cache_scan(cmd);
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * The caller uses "no_file_match" if it wants to match specific devs
 | 
			
		||||
	 * itself, instead of matching everything in device_ids_match.
 | 
			
		||||
	 */
 | 
			
		||||
	if (no_file_match && cmd->enable_devices_file)
 | 
			
		||||
		return 1;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Match entries from cmd->use_devices with device structs in dev-cache.
 | 
			
		||||
	 */
 | 
			
		||||
@@ -1966,6 +1973,16 @@ int setup_devices(struct cmd_context *cmd)
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int setup_devices(struct cmd_context *cmd)
 | 
			
		||||
{
 | 
			
		||||
	return _setup_devices(cmd, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int setup_devices_no_file_match(struct cmd_context *cmd)
 | 
			
		||||
{
 | 
			
		||||
	return _setup_devices(cmd, 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * The alternative to setup_devices() when the command is interested
 | 
			
		||||
 * in using only one PV.
 | 
			
		||||
@@ -2034,188 +2051,3 @@ int setup_device(struct cmd_context *cmd, const char *devname)
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * pvscan --cache is specialized/optimized to look only at command args,
 | 
			
		||||
 * so this just sets up the devices file, then individual devices are
 | 
			
		||||
 * added to dev-cache and matched with device_ids later in pvscan.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
int setup_devices_for_pvscan_cache(struct cmd_context *cmd)
 | 
			
		||||
{
 | 
			
		||||
	if (cmd->enable_devices_list) {
 | 
			
		||||
		if (!_setup_devices_list(cmd))
 | 
			
		||||
			return_0;
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!setup_devices_file(cmd))
 | 
			
		||||
		return_0;
 | 
			
		||||
 | 
			
		||||
	if (!cmd->enable_devices_file)
 | 
			
		||||
		return 1;
 | 
			
		||||
 | 
			
		||||
	if (!devices_file_exists(cmd)) {
 | 
			
		||||
		log_debug("Devices file not found, ignoring.");
 | 
			
		||||
		cmd->enable_devices_file = 0;
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!lock_devices_file(cmd, LOCK_SH)) {
 | 
			
		||||
		log_error("Failed to lock the devices file to read.");
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!device_ids_read(cmd)) {
 | 
			
		||||
		log_error("Failed to read the devices file.");
 | 
			
		||||
		unlock_devices_file(cmd);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	unlock_devices_file(cmd);
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Get a device name from a devno. */
 | 
			
		||||
 | 
			
		||||
static char *_get_devname_from_devno(struct cmd_context *cmd, dev_t devno)
 | 
			
		||||
{
 | 
			
		||||
	char path[PATH_MAX];
 | 
			
		||||
	char devname[PATH_MAX];
 | 
			
		||||
	char namebuf[NAME_LEN];
 | 
			
		||||
	char line[1024];
 | 
			
		||||
	int major = MAJOR(devno);
 | 
			
		||||
	int minor = MINOR(devno);
 | 
			
		||||
	int line_major;
 | 
			
		||||
	int line_minor;
 | 
			
		||||
	uint64_t line_blocks;
 | 
			
		||||
	DIR *dir;
 | 
			
		||||
	struct dirent *dirent;
 | 
			
		||||
	FILE *fp;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * $ ls /sys/dev/block/8:0/device/block/
 | 
			
		||||
	 * sda
 | 
			
		||||
	 */
 | 
			
		||||
	if (major_is_scsi_device(cmd->dev_types, major)) {
 | 
			
		||||
		if (dm_snprintf(path, sizeof(path), "%sdev/block/%d:%d/device/block",
 | 
			
		||||
				dm_sysfs_dir(), major, minor) < 0) {
 | 
			
		||||
			return NULL;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (!(dir = opendir(path)))
 | 
			
		||||
			return NULL;
 | 
			
		||||
 | 
			
		||||
		while ((dirent = readdir(dir))) {
 | 
			
		||||
			if (dirent->d_name[0] == '.')
 | 
			
		||||
				continue;
 | 
			
		||||
			if (dm_snprintf(devname, sizeof(devname), "/dev/%s", dirent->d_name) < 0) {
 | 
			
		||||
				devname[0] = '\0';
 | 
			
		||||
				stack;
 | 
			
		||||
			}
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		closedir(dir);
 | 
			
		||||
 | 
			
		||||
		if (devname[0]) {
 | 
			
		||||
			log_debug("Found %s for %d:%d from sys", devname, major, minor);
 | 
			
		||||
			return _strdup(devname);
 | 
			
		||||
		}
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * $ cat /sys/dev/block/253:3/dm/name
 | 
			
		||||
	 * mpatha
 | 
			
		||||
	 */
 | 
			
		||||
	if (major == cmd->dev_types->device_mapper_major) {
 | 
			
		||||
		if (dm_snprintf(path, sizeof(path), "%sdev/block/%d:%d/dm/name",
 | 
			
		||||
				dm_sysfs_dir(), major, minor) < 0) {
 | 
			
		||||
			return NULL;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (!get_sysfs_value(path, namebuf, sizeof(namebuf), 0))
 | 
			
		||||
			return NULL;
 | 
			
		||||
 | 
			
		||||
		if (dm_snprintf(devname, sizeof(devname), "/dev/mapper/%s", namebuf) < 0) {
 | 
			
		||||
			devname[0] = '\0';
 | 
			
		||||
			stack;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (devname[0]) {
 | 
			
		||||
			log_debug("Found %s for %d:%d from sys", devname, major, minor);
 | 
			
		||||
			return _strdup(devname);
 | 
			
		||||
		}
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * /proc/partitions lists
 | 
			
		||||
	 * major minor #blocks name
 | 
			
		||||
	 */
 | 
			
		||||
 | 
			
		||||
	if (!(fp = fopen("/proc/partitions", "r")))
 | 
			
		||||
		return NULL;
 | 
			
		||||
 | 
			
		||||
	while (fgets(line, sizeof(line), fp)) {
 | 
			
		||||
		if (sscanf(line, "%u %u %llu %s", &line_major, &line_minor, (unsigned long long *)&line_blocks, namebuf) != 4)
 | 
			
		||||
			continue;
 | 
			
		||||
		if (line_major != major)
 | 
			
		||||
			continue;
 | 
			
		||||
		if (line_minor != minor)
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		if (dm_snprintf(devname, sizeof(devname), "/dev/%s", namebuf) < 0) {
 | 
			
		||||
			devname[0] = '\0';
 | 
			
		||||
			stack;
 | 
			
		||||
		}
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	fclose(fp);
 | 
			
		||||
 | 
			
		||||
	if (devname[0]) {
 | 
			
		||||
		log_debug("Found %s for %d:%d from proc", devname, major, minor);
 | 
			
		||||
		return _strdup(devname);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * If necessary, this could continue searching by stat'ing /dev entries.
 | 
			
		||||
	 */
 | 
			
		||||
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int setup_devname_in_dev_cache(struct cmd_context *cmd, const char *devname)
 | 
			
		||||
{
 | 
			
		||||
	struct stat buf;
 | 
			
		||||
	struct device *dev;
 | 
			
		||||
 | 
			
		||||
	if (stat(devname, &buf) < 0) {
 | 
			
		||||
		log_error("Cannot access device %s.", devname);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!S_ISBLK(buf.st_mode)) {
 | 
			
		||||
		log_error("Invaild device type %s.", devname);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!_insert_dev(devname, buf.st_rdev))
 | 
			
		||||
		return_0;
 | 
			
		||||
 | 
			
		||||
	if (!(dev = (struct device *) dm_hash_lookup(_cache.names, devname)))
 | 
			
		||||
		return_0;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int setup_devno_in_dev_cache(struct cmd_context *cmd, dev_t devno)
 | 
			
		||||
{
 | 
			
		||||
	const char *devname;
 | 
			
		||||
 | 
			
		||||
	if (!(devname = _get_devname_from_devno(cmd, devno)))
 | 
			
		||||
		return_0;
 | 
			
		||||
 | 
			
		||||
	return setup_devname_in_dev_cache(cmd, devname);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -77,11 +77,7 @@ int get_dm_uuid_from_sysfs(char *buf, size_t buf_size, int major, int minor);
 | 
			
		||||
 | 
			
		||||
int setup_devices_file(struct cmd_context *cmd);
 | 
			
		||||
int setup_devices(struct cmd_context *cmd);
 | 
			
		||||
int setup_devices_no_file_match(struct cmd_context *cmd);
 | 
			
		||||
int setup_device(struct cmd_context *cmd, const char *devname);
 | 
			
		||||
 | 
			
		||||
/* Normal device setup functions are split up for pvscan optimization. */
 | 
			
		||||
int setup_devices_for_pvscan_cache(struct cmd_context *cmd);
 | 
			
		||||
int setup_devname_in_dev_cache(struct cmd_context *cmd, const char *devname);
 | 
			
		||||
int setup_devno_in_dev_cache(struct cmd_context *cmd, dev_t devno);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,6 @@
 | 
			
		||||
#define DEV_IS_MD_COMPONENT	0x00020000	/* device is an md component */
 | 
			
		||||
#define DEV_IS_NVME		0x00040000	/* set if dev is nvme */
 | 
			
		||||
#define DEV_MATCHED_USE_ID	0x00080000	/* matched an entry from cmd->use_devices */
 | 
			
		||||
#define DEV_SCAN_FOUND_NOLABEL	0x00100000	/* label_scan read, passed filters, but no lvm label */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Support for external device info.
 | 
			
		||||
 
 | 
			
		||||
@@ -543,8 +543,11 @@ int device_ids_read(struct cmd_context *cmd)
 | 
			
		||||
			log_debug("read devices file systemid %s", _devices_file_systemid);
 | 
			
		||||
			if ((!cmd->system_id && _devices_file_systemid[0]) ||
 | 
			
		||||
			    (cmd->system_id && strcmp(cmd->system_id, _devices_file_systemid))) {
 | 
			
		||||
				log_warn("WARNING: devices file has unmatching system id %s vs local %s.",
 | 
			
		||||
				log_warn("WARNING: ignoring devices file with wrong system id %s vs local %s.",
 | 
			
		||||
					  _devices_file_systemid[0] ? _devices_file_systemid : "none", cmd->system_id ?: "none");
 | 
			
		||||
				free_dus(&cmd->use_devices);
 | 
			
		||||
				ret = 0;
 | 
			
		||||
				goto out;
 | 
			
		||||
			}
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
@@ -610,6 +613,7 @@ int device_ids_read(struct cmd_context *cmd)
 | 
			
		||||
 | 
			
		||||
		dm_list_add(&cmd->use_devices, &du->list);
 | 
			
		||||
	}
 | 
			
		||||
out:
 | 
			
		||||
	if (fclose(fp))
 | 
			
		||||
		stack;
 | 
			
		||||
 | 
			
		||||
@@ -1533,22 +1537,6 @@ int device_ids_match_dev(struct cmd_context *cmd, struct device *dev)
 | 
			
		||||
 * passes the filter.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
void device_ids_match_device_list(struct cmd_context *cmd)
 | 
			
		||||
{
 | 
			
		||||
	struct dev_use *du;
 | 
			
		||||
 | 
			
		||||
	dm_list_iterate_items(du, &cmd->use_devices) {
 | 
			
		||||
		if (du->dev)
 | 
			
		||||
			continue;
 | 
			
		||||
		if (!(du->dev = dev_cache_get(cmd, du->devname, NULL))) {
 | 
			
		||||
			log_warn("Device not found for %s.", du->devname);
 | 
			
		||||
		} else {
 | 
			
		||||
			/* Should we set dev->id?  Which idtype?  Use --deviceidtype? */
 | 
			
		||||
			du->dev->flags |= DEV_MATCHED_USE_ID;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void device_ids_match(struct cmd_context *cmd)
 | 
			
		||||
{
 | 
			
		||||
	struct dev_iter *iter;
 | 
			
		||||
@@ -1556,7 +1544,16 @@ void device_ids_match(struct cmd_context *cmd)
 | 
			
		||||
	struct device *dev;
 | 
			
		||||
 | 
			
		||||
	if (cmd->enable_devices_list) {
 | 
			
		||||
		device_ids_match_device_list(cmd);
 | 
			
		||||
		dm_list_iterate_items(du, &cmd->use_devices) {
 | 
			
		||||
			if (du->dev)
 | 
			
		||||
				continue;
 | 
			
		||||
			if (!(du->dev = dev_cache_get(cmd, du->devname, NULL))) {
 | 
			
		||||
				log_warn("Device not found for %s.", du->devname);
 | 
			
		||||
			} else {
 | 
			
		||||
				/* Should we set dev->id?  Which idtype?  Use --deviceidtype? */
 | 
			
		||||
				du->dev->flags |= DEV_MATCHED_USE_ID;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,6 @@ int device_id_add(struct cmd_context *cmd, struct device *dev, const char *pvid,
 | 
			
		||||
void device_id_pvremove(struct cmd_context *cmd, struct device *dev);
 | 
			
		||||
void device_ids_match(struct cmd_context *cmd);
 | 
			
		||||
int device_ids_match_dev(struct cmd_context *cmd, struct device *dev);
 | 
			
		||||
void device_ids_match_device_list(struct cmd_context *cmd);
 | 
			
		||||
void device_ids_validate(struct cmd_context *cmd, struct dm_list *scanned_devs, int *device_ids_invalid, int noupdate);
 | 
			
		||||
int device_ids_version_unchanged(struct cmd_context *cmd);
 | 
			
		||||
void device_ids_find_renamed_devs(struct cmd_context *cmd, struct dm_list *dev_list, int *search_count, int noupdate);
 | 
			
		||||
 
 | 
			
		||||
@@ -137,8 +137,7 @@ static int _lookup_p(struct cmd_context *cmd, struct dev_filter *f, struct devic
 | 
			
		||||
			l = PF_GOOD_DEVICE;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (!dev->filtered_flags) /* skipping reason already logged by filter */
 | 
			
		||||
			log_debug_devs("filter caching %s %s", pass ? "good" : "bad", dev_name(dev));
 | 
			
		||||
		log_debug_devs("filter caching %s %s", pass ? "good" : "bad", dev_name(dev));
 | 
			
		||||
 | 
			
		||||
		dm_list_iterate_items(sl, &dev->aliases)
 | 
			
		||||
			if (!dm_hash_insert(pf->devices, sl->str, l)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -47,8 +47,9 @@
 | 
			
		||||
 * with the least recent at the head.
 | 
			
		||||
 */
 | 
			
		||||
struct archive_file {
 | 
			
		||||
	const char *name;
 | 
			
		||||
	struct dm_list list;
 | 
			
		||||
 | 
			
		||||
	const char *name;
 | 
			
		||||
	uint32_t index;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -372,21 +373,21 @@ int archive_list_file(struct cmd_context *cmd, const char *file)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!(af.name = strrchr(file, '/'))) {
 | 
			
		||||
		af.name = file;
 | 
			
		||||
		path[0] = 0;
 | 
			
		||||
	} else {
 | 
			
		||||
		len = (size_t)(af.name - file);
 | 
			
		||||
 | 
			
		||||
		if (len >= sizeof(path)) {
 | 
			
		||||
			log_error(INTERNAL_ERROR "Passed file path name %s is too long.", file);
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		memcpy(path, file, len);
 | 
			
		||||
		path[len] = 0;
 | 
			
		||||
		af.name++;  /* jump over '/' */
 | 
			
		||||
		log_error("No '/' in file path %s found.", file);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	len = (size_t)(af.name - file);
 | 
			
		||||
 | 
			
		||||
	if (len >= sizeof(path)) {
 | 
			
		||||
		log_error(INTERNAL_ERROR "Passed file path name %s is too long.", file);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	memcpy(path, file, len);
 | 
			
		||||
	path[len] = 0;
 | 
			
		||||
	af.name++;  /* jump over '/' */
 | 
			
		||||
 | 
			
		||||
	_display_archive(cmd, path, &af);
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
 
 | 
			
		||||
@@ -626,10 +626,7 @@ void check_current_backup(struct volume_group *vg)
 | 
			
		||||
	int old_suppress;
 | 
			
		||||
 | 
			
		||||
	if (!vg->cmd->backup_params->enabled || !vg->cmd->backup_params->dir) {
 | 
			
		||||
		if (!vg->cmd->backup_disabled) {
 | 
			
		||||
			log_debug("Skipping check for current backup, since backup is disabled.");
 | 
			
		||||
			vg->cmd->backup_disabled = 1;
 | 
			
		||||
		}
 | 
			
		||||
		log_debug("Skipping check for current backup, since backup is disabled.");
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1922,9 +1922,7 @@ static int _text_pv_initialise(const struct format_type *fmt,
 | 
			
		||||
		pv->pe_count = pva->extent_count;
 | 
			
		||||
 | 
			
		||||
	if ((pv->pe_start + pv->pe_count * (uint64_t)pv->pe_size - 1) > pv->size) {
 | 
			
		||||
		log_error("Physical extents (%s) end beyond end of device (%s) %s.",
 | 
			
		||||
			  display_size(pv->fmt->cmd, pv->pe_start + pv->pe_count * (uint64_t)pv->pe_size - 1),
 | 
			
		||||
			  display_size(pv->fmt->cmd, pv->size),
 | 
			
		||||
		log_error("Physical extents end beyond end of device %s.",
 | 
			
		||||
			  pv_dev_name(pv));
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -150,14 +150,11 @@
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
#include <dirent.h>
 | 
			
		||||
#include <time.h>
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/file.h>
 | 
			
		||||
#include <sys/sysmacros.h>
 | 
			
		||||
 | 
			
		||||
int online_pvid_file_read(char *path, int *major, int *minor, char *vgname);
 | 
			
		||||
 | 
			
		||||
static const char *_hints_file = DEFAULT_RUN_DIR "/hints";
 | 
			
		||||
static const char *_nohints_file = DEFAULT_RUN_DIR "/nohints";
 | 
			
		||||
static const char *_newhints_file = DEFAULT_RUN_DIR "/newhints";
 | 
			
		||||
@@ -1282,109 +1279,6 @@ check:
 | 
			
		||||
	free(name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _get_hints_from_pvs_online(struct cmd_context *cmd, struct dm_list *hints_out,
 | 
			
		||||
				      struct dm_list *devs_in, struct dm_list *devs_out)
 | 
			
		||||
{
 | 
			
		||||
	char path[PATH_MAX];
 | 
			
		||||
	char file_vgname[NAME_LEN];
 | 
			
		||||
	struct dm_list hints_list;
 | 
			
		||||
	struct hint file_hint;
 | 
			
		||||
	struct hint *alloc_hint;
 | 
			
		||||
	struct hint *hint, *hint2;
 | 
			
		||||
	struct device_list *devl, *devl2;
 | 
			
		||||
	int file_major, file_minor;
 | 
			
		||||
	int found = 0;
 | 
			
		||||
	DIR *dir;
 | 
			
		||||
	struct dirent *de;
 | 
			
		||||
	char *vgname = NULL;
 | 
			
		||||
	char *pvid;
 | 
			
		||||
 | 
			
		||||
	dm_list_init(&hints_list);
 | 
			
		||||
 | 
			
		||||
	if (!(dir = opendir(PVS_ONLINE_DIR)))
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	while ((de = readdir(dir))) {
 | 
			
		||||
		if (de->d_name[0] == '.')
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		pvid = de->d_name;
 | 
			
		||||
 | 
			
		||||
		if (strlen(pvid) != ID_LEN) /* 32 */
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		memset(path, 0, sizeof(path));
 | 
			
		||||
		snprintf(path, sizeof(path), "%s/%s", PVS_ONLINE_DIR, pvid);
 | 
			
		||||
 | 
			
		||||
		memset(&file_hint, 0, sizeof(file_hint));
 | 
			
		||||
		memset(file_vgname, 0, sizeof(file_vgname));
 | 
			
		||||
		file_major = 0;
 | 
			
		||||
		file_minor = 0;
 | 
			
		||||
 | 
			
		||||
		if (!online_pvid_file_read(path, &file_major, &file_minor, file_vgname))
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		if (!dm_strncpy(file_hint.pvid, pvid, sizeof(file_hint.pvid)))
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		file_hint.devt = makedev(file_major, file_minor);
 | 
			
		||||
 | 
			
		||||
		if (file_vgname[0] && validate_name(file_vgname)) {
 | 
			
		||||
			if (!dm_strncpy(file_hint.vgname, file_vgname, sizeof(file_hint.vgname)))
 | 
			
		||||
				continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (!(alloc_hint = malloc(sizeof(struct hint))))
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		memcpy(alloc_hint, &file_hint, sizeof(struct hint));
 | 
			
		||||
 | 
			
		||||
		log_debug("add hint %s %d:%d %s from pvs_online", file_hint.pvid, file_major, file_minor, file_vgname);
 | 
			
		||||
		dm_list_add(&hints_list, &alloc_hint->list);
 | 
			
		||||
		found++;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (closedir(dir))
 | 
			
		||||
		stack;
 | 
			
		||||
 | 
			
		||||
	log_debug("accept hints found %d from pvs_online", found);
 | 
			
		||||
 | 
			
		||||
	_get_single_vgname_cmd_arg(cmd, &hints_list, &vgname);
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * apply_hints equivalent, move devs from devs_in to devs_out if
 | 
			
		||||
	 * their devno matches the devno of a hint (and if the hint matches
 | 
			
		||||
	 * the vgname when a vgname is present.)
 | 
			
		||||
	 */
 | 
			
		||||
	dm_list_iterate_items_safe(devl, devl2, devs_in) {
 | 
			
		||||
		dm_list_iterate_items_safe(hint, hint2, &hints_list) {
 | 
			
		||||
			if ((MAJOR(devl->dev->dev) == MAJOR(hint->devt)) &&
 | 
			
		||||
			    (MINOR(devl->dev->dev) == MINOR(hint->devt))) {
 | 
			
		||||
 | 
			
		||||
				if (vgname && hint->vgname[0] && strcmp(vgname, hint->vgname))
 | 
			
		||||
					goto next_dev;
 | 
			
		||||
 | 
			
		||||
				snprintf(hint->name, sizeof(hint->name), "%s", dev_name(devl->dev));
 | 
			
		||||
				hint->chosen = 1;
 | 
			
		||||
 | 
			
		||||
				dm_list_del(&devl->list);
 | 
			
		||||
				dm_list_add(devs_out, &devl->list);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 next_dev:
 | 
			
		||||
		;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	log_debug("applied hints using %d other %d vgname %s from pvs_online",
 | 
			
		||||
		  dm_list_size(devs_out), dm_list_size(devs_in), vgname ?: "");
 | 
			
		||||
 | 
			
		||||
	dm_list_splice(hints_out, &hints_list);
 | 
			
		||||
 | 
			
		||||
	free(vgname);
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Returns 0: no hints are used.
 | 
			
		||||
 *  . newhints is set if this command should create new hints after scan
 | 
			
		||||
@@ -1426,15 +1320,6 @@ int get_hints(struct cmd_context *cmd, struct dm_list *hints_out, int *newhints,
 | 
			
		||||
	if (!cmd->use_hints)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	/* hints = "pvs_online" */
 | 
			
		||||
	if (cmd->hints_pvs_online) {
 | 
			
		||||
		if (!_get_hints_from_pvs_online(cmd, &hints_list, devs_in, devs_out)) {
 | 
			
		||||
			log_debug("get_hints: pvs_online failed");
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Check if another command created the nohints file to prevent us from
 | 
			
		||||
	 * using hints.
 | 
			
		||||
 
 | 
			
		||||
@@ -403,7 +403,6 @@ static int _process_block(struct cmd_context *cmd, struct dev_filter *f,
 | 
			
		||||
			memset(dev->pvid, 0, sizeof(dev->pvid));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		dev->flags |= DEV_SCAN_FOUND_NOLABEL;
 | 
			
		||||
		*is_lvm_device = 0;
 | 
			
		||||
		goto out;
 | 
			
		||||
	}
 | 
			
		||||
@@ -1130,9 +1129,6 @@ int label_scan(struct cmd_context *cmd)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	log_debug_devs("Filtering devices to scan done (nodata)");
 | 
			
		||||
 | 
			
		||||
	cmd->filter_nodata_only = 0;
 | 
			
		||||
 | 
			
		||||
	dm_list_iterate_items(devl, &all_devs)
 | 
			
		||||
@@ -1491,7 +1487,7 @@ void label_scan_destroy(struct cmd_context *cmd)
 | 
			
		||||
 * device, this is not a commonly used function.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
int label_scan_dev(struct cmd_context *cmd, struct device *dev)
 | 
			
		||||
int label_scan_dev(struct device *dev)
 | 
			
		||||
{
 | 
			
		||||
	struct dm_list one_dev;
 | 
			
		||||
	struct device_list *devl;
 | 
			
		||||
@@ -1506,7 +1502,7 @@ int label_scan_dev(struct cmd_context *cmd, struct device *dev)
 | 
			
		||||
 | 
			
		||||
	label_scan_invalidate(dev);
 | 
			
		||||
 | 
			
		||||
	_scan_list(cmd, NULL, &one_dev, 0, &failed);
 | 
			
		||||
	_scan_list(NULL, NULL, &one_dev, 0, &failed);
 | 
			
		||||
 | 
			
		||||
	free(devl);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -107,7 +107,7 @@ int label_scan_devs(struct cmd_context *cmd, struct dev_filter *f, struct dm_lis
 | 
			
		||||
int label_scan_devs_cached(struct cmd_context *cmd, struct dev_filter *f, struct dm_list *devs);
 | 
			
		||||
int label_scan_devs_rw(struct cmd_context *cmd, struct dev_filter *f, struct dm_list *devs);
 | 
			
		||||
int label_scan_devs_excl(struct cmd_context *cmd, struct dev_filter *f, struct dm_list *devs);
 | 
			
		||||
int label_scan_dev(struct cmd_context *cmd, struct device *dev);
 | 
			
		||||
int label_scan_dev(struct device *dev);
 | 
			
		||||
void label_scan_invalidate(struct device *dev);
 | 
			
		||||
void label_scan_invalidate_lv(struct cmd_context *cmd, struct logical_volume *lv);
 | 
			
		||||
void label_scan_drop(struct cmd_context *cmd);
 | 
			
		||||
 
 | 
			
		||||
@@ -25,10 +25,7 @@
 | 
			
		||||
#include <syslog.h>
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
#include <time.h>
 | 
			
		||||
 | 
			
		||||
#ifdef SYSTEMD_JOURNAL_SUPPORT
 | 
			
		||||
#include <systemd/sd-journal.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static FILE *_log_file;
 | 
			
		||||
static char _log_file_path[PATH_MAX];
 | 
			
		||||
@@ -315,13 +312,8 @@ void init_log_while_suspended(int log_while_suspended)
 | 
			
		||||
	_log_while_suspended = log_while_suspended;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void init_syslog(int enable, int facility)
 | 
			
		||||
void init_syslog(int facility)
 | 
			
		||||
{
 | 
			
		||||
	if (!enable) {
 | 
			
		||||
		_syslog = 0;
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (getenv("LVM_SUPPRESS_SYSLOG"))
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
@@ -625,7 +617,6 @@ static void _vprint_log(int level, const char *file, int line, int dm_errno_or_c
 | 
			
		||||
 | 
			
		||||
      log_it:
 | 
			
		||||
 | 
			
		||||
#ifdef SYSTEMD_JOURNAL_SUPPORT
 | 
			
		||||
	if (_log_journal) {
 | 
			
		||||
		int to_journal = 0;
 | 
			
		||||
 | 
			
		||||
@@ -651,7 +642,6 @@ static void _vprint_log(int level, const char *file, int line, int dm_errno_or_c
 | 
			
		||||
			va_end(ap);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (!logged_via_report && ((verbose_level() >= level) && !_log_suppress)) {
 | 
			
		||||
		if (verbose_level() > _LOG_DEBUG) {
 | 
			
		||||
@@ -863,7 +853,6 @@ void log_set_report_object_name_and_id(const char *name, const char *id)
 | 
			
		||||
 | 
			
		||||
void log_command(const char *cmd_line, const char *cmd_name, const char *cmd_id)
 | 
			
		||||
{
 | 
			
		||||
#ifdef SYSTEMD_JOURNAL_SUPPORT
 | 
			
		||||
	if (_log_journal & LOG_JOURNAL_COMMAND) {
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
@@ -881,7 +870,6 @@ void log_command(const char *cmd_line, const char *cmd_name, const char *cmd_id)
 | 
			
		||||
				"PRIORITY=%i", LOG_INFO,
 | 
			
		||||
				NULL);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint32_t log_journal_str_to_val(const char *str)
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ void init_abort_on_internal_errors(int fatal);
 | 
			
		||||
void fin_log(void);
 | 
			
		||||
void reset_log_duplicated(void);
 | 
			
		||||
 | 
			
		||||
void init_syslog(int enable, int facility);
 | 
			
		||||
void init_syslog(int facility);
 | 
			
		||||
void fin_syslog(void);
 | 
			
		||||
 | 
			
		||||
void init_log_journal(uint32_t fields);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										21
									
								
								make.tmpl.in
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								make.tmpl.in
									
									
									
									
									
								
							@@ -73,29 +73,22 @@ CLDFLAGS += @CLDFLAGS@
 | 
			
		||||
ELDFLAGS += @ELDFLAGS@
 | 
			
		||||
LDDEPS += @LDDEPS@
 | 
			
		||||
LIB_SUFFIX = @LIB_SUFFIX@
 | 
			
		||||
USE_TRACKING = @USE_TRACKING@
 | 
			
		||||
 | 
			
		||||
DL_LIBS = @DL_LIBS@
 | 
			
		||||
RT_LIBS = @RT_LIBS@
 | 
			
		||||
M_LIBS = @M_LIBS@
 | 
			
		||||
AIO_CFLAGS = @AIO_CFLAGS@
 | 
			
		||||
AIO_LIBS = @AIO_LIBS@
 | 
			
		||||
BLKID_CFLAGS = @BLKID_CFLAGS@
 | 
			
		||||
BLKID_LIBS = @BLKID_LIBS@
 | 
			
		||||
CPG_CFLAGS = @CPG_CFLAGS@
 | 
			
		||||
CPG_LIBS = @CPG_LIBS@
 | 
			
		||||
EDITLINE_CFLAGS = @EDITLINE_CFLAGS@
 | 
			
		||||
EDITLINE_LIBS = @EDITLINE_LIBS@
 | 
			
		||||
AIO_CFLAGS = @AIO_CFLAGS@
 | 
			
		||||
PTHREAD_LIBS = @PTHREAD_LIBS@
 | 
			
		||||
READLINE_CFLAGS = @READLINE_CFLAGS@
 | 
			
		||||
READLINE_LIBS = @READLINE_LIBS@
 | 
			
		||||
EDITLINE_LIBS = @EDITLINE_LIBS@
 | 
			
		||||
SELINUX_LIBS = @SELINUX_LIBS@
 | 
			
		||||
SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@
 | 
			
		||||
SYSTEMD_LIBS = @SYSTEMD_LIBS@
 | 
			
		||||
UDEV_CFLAGS = @UDEV_CFLAGS@
 | 
			
		||||
UDEV_LIBS = @UDEV_LIBS@
 | 
			
		||||
BLKID_CFLAGS = @BLKID_CFLAGS@
 | 
			
		||||
BLKID_LIBS = @BLKID_LIBS@
 | 
			
		||||
SYSTEMD_LIBS = @SYSTEMD_LIBS@
 | 
			
		||||
VALGRIND_CFLAGS = @VALGRIND_CFLAGS@
 | 
			
		||||
VALGRIND_LIBS = @VALGRIND_LIBS@
 | 
			
		||||
USE_TRACKING = @USE_TRACKING@
 | 
			
		||||
 | 
			
		||||
# Setup directory variables
 | 
			
		||||
prefix = @prefix@
 | 
			
		||||
@@ -128,7 +121,7 @@ systemd_generator_dir = $(DESTDIR)$(SYSTEMD_GENERATOR_DIR)
 | 
			
		||||
systemd_dir = $(DESTDIR)@systemdutildir@
 | 
			
		||||
tmpfiles_dir = $(DESTDIR)@tmpfilesdir@
 | 
			
		||||
ocf_scriptdir = $(DESTDIR)@OCFDIR@
 | 
			
		||||
PYTHON_PREFIX = $(DESTDIR)$(prefix)
 | 
			
		||||
pythonprefix = $(DESTDIR)$(prefix)
 | 
			
		||||
 | 
			
		||||
# N.B. No $(DESTDIR) prefix here.
 | 
			
		||||
python2dir = @PYTHON2DIR@
 | 
			
		||||
 
 | 
			
		||||
@@ -51,8 +51,6 @@ pvscan \(em List all physical volumes
 | 
			
		||||
 \fB-j\fP|\fB--major\fP \fINumber\fP
 | 
			
		||||
.br
 | 
			
		||||
    \fB--minor\fP \fINumber\fP
 | 
			
		||||
.br
 | 
			
		||||
    \fB--nohints\fP
 | 
			
		||||
.br
 | 
			
		||||
    \fB--nolocking\fP
 | 
			
		||||
.br
 | 
			
		||||
 
 | 
			
		||||
@@ -63,7 +63,7 @@ install_initscripts:
 | 
			
		||||
	@echo "    [INSTALL] initscripts"
 | 
			
		||||
	$(Q) $(INSTALL_DIR) $(initdir)
 | 
			
		||||
ifeq ("@BUILD_DMEVENTD@", "yes")
 | 
			
		||||
	$(Q) $(INSTALL_SCRIPT) lvm2_monitoring_init_red_hat $(initdir)/lvm-monitor
 | 
			
		||||
	$(Q) $(INSTALL_SCRIPT) lvm2_monitoring_init_red_hat $(initdir)/lvm2-monitor
 | 
			
		||||
endif
 | 
			
		||||
ifeq ("@BUILD_LVMPOLLD@", "yes")
 | 
			
		||||
	$(Q) $(INSTALL_SCRIPT) lvm2_lvmpolld_init_red_hat $(initdir)/lvm2-lvmpolld
 | 
			
		||||
 
 | 
			
		||||
@@ -7,15 +7,9 @@ Before=local-fs-pre.target shutdown.target
 | 
			
		||||
DefaultDependencies=no
 | 
			
		||||
Conflicts=shutdown.target
 | 
			
		||||
 | 
			
		||||
# "--eventactivation service" tells vgchange it is being called
 | 
			
		||||
# from an activation service, so it will do nothing if
 | 
			
		||||
# lvm.conf event_activation_options = "event_only".
 | 
			
		||||
# "--eventactivation on" tells vgchange to enable event-based
 | 
			
		||||
# pvscan activations by creating /run/lvm/event-activation-on.
 | 
			
		||||
 | 
			
		||||
[Service]
 | 
			
		||||
Type=oneshot
 | 
			
		||||
ExecStart=@SBINDIR@/lvm vgchange -aay --nohints --vgonline --eventactivation service,on
 | 
			
		||||
ExecStart=@SBINDIR@/lvm vgchange -aay --nohints --vgonline --eventactivation enable
 | 
			
		||||
RemainAfterExit=yes
 | 
			
		||||
 | 
			
		||||
[Install]
 | 
			
		||||
 
 | 
			
		||||
@@ -6,13 +6,9 @@ Before=local-fs-pre.target shutdown.target
 | 
			
		||||
DefaultDependencies=no
 | 
			
		||||
Conflicts=shutdown.target
 | 
			
		||||
 | 
			
		||||
# "--eventactivation service" tells vgchange it is being called 
 | 
			
		||||
# from an activation service, so it will do nothing if
 | 
			
		||||
# lvm.conf event_activation_options = "event_only".
 | 
			
		||||
 | 
			
		||||
[Service]
 | 
			
		||||
Type=oneshot
 | 
			
		||||
ExecStart=@SBINDIR@/lvm vgchange -aay --nohints --vgonline --eventactivation service
 | 
			
		||||
ExecStart=@SBINDIR@/lvm vgchange -aay --nohints --vgonline
 | 
			
		||||
RemainAfterExit=yes
 | 
			
		||||
 | 
			
		||||
[Install]
 | 
			
		||||
 
 | 
			
		||||
@@ -23,10 +23,10 @@ if [ $1 = 0 ]; then
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
%triggerun -- %{name} < 2.02.86-2
 | 
			
		||||
%{_bindir}/systemd-sysv-convert --save lvm-monitor >/dev/null 2>&1 || :
 | 
			
		||||
/bin/systemctl --no-reload enable lvm-monitor.service > /dev/null 2>&1 || :
 | 
			
		||||
/sbin/chkconfig --del lvm-monitor > /dev/null 2>&1 || :
 | 
			
		||||
/bin/systemctl try-restart lvm-monitor.service > /dev/null 2>&1 || :
 | 
			
		||||
%{_bindir}/systemd-sysv-convert --save lvm2-monitor >/dev/null 2>&1 || :
 | 
			
		||||
/bin/systemctl --no-reload enable lvm2-monitor.service > /dev/null 2>&1 || :
 | 
			
		||||
/sbin/chkconfig --del lvm2-monitor > /dev/null 2>&1 || :
 | 
			
		||||
/bin/systemctl try-restart lvm2-monitor.service > /dev/null 2>&1 || :
 | 
			
		||||
# files in the main package
 | 
			
		||||
 | 
			
		||||
%files
 | 
			
		||||
@@ -100,6 +100,9 @@ fi
 | 
			
		||||
%{_mandir}/man8/lvm-config.8.gz
 | 
			
		||||
%{_mandir}/man8/lvm-dumpconfig.8.gz
 | 
			
		||||
%{_mandir}/man8/lvm.8.gz
 | 
			
		||||
%if %{enable_systemd}
 | 
			
		||||
 %{_mandir}/man8/lvm2-activation-generator.8.gz
 | 
			
		||||
%endif
 | 
			
		||||
%{_mandir}/man8/lvmconfig.8.gz
 | 
			
		||||
%{_mandir}/man8/lvmdevices.8.gz
 | 
			
		||||
%{_mandir}/man8/lvmdiskscan.8.gz
 | 
			
		||||
@@ -184,17 +187,16 @@ fi
 | 
			
		||||
%dir %{_default_run_dir}
 | 
			
		||||
%if %{enable_systemd}
 | 
			
		||||
 %{_tmpfilesdir}/%{name}.conf
 | 
			
		||||
 %{_unitdir}/lvm-activate-vgs-main.service
 | 
			
		||||
 %{_unitdir}/lvm-activate-vgs-last.service
 | 
			
		||||
 %{_unitdir}/lvm-monitor.service
 | 
			
		||||
 %{_unitdir}/blk-availability.service
 | 
			
		||||
 %{_unitdir}/lvm2-monitor.service
 | 
			
		||||
 %attr(555, -, -) %{_prefix}/lib/systemd/system-generators/lvm2-activation-generator
 | 
			
		||||
 %if %{have_service lvmpolld}
 | 
			
		||||
  %{_unitdir}/lvm2-lvmpolld.service
 | 
			
		||||
  %{_unitdir}/lvm2-lvmpolld.socket
 | 
			
		||||
 %endif
 | 
			
		||||
%else
 | 
			
		||||
 %{_sysconfdir}/rc.d/init.d/blk-availability
 | 
			
		||||
 %{_sysconfdir}/rc.d/init.d/lvm-monitor
 | 
			
		||||
 %{_sysconfdir}/rc.d/init.d/lvm2-monitor
 | 
			
		||||
 %if %{have_service lvmpolld}
 | 
			
		||||
  %{_sysconfdir}/rc.d/init.d/lvm2-lvmpolld
 | 
			
		||||
 %endif
 | 
			
		||||
 
 | 
			
		||||
@@ -54,12 +54,7 @@ $(UNIT_TARGET): $(UNIT_OBJECTS) $(LVMINTERNAL_LIBS)
 | 
			
		||||
unit-test: $(UNIT_TARGET)
 | 
			
		||||
run-unit-test: $(UNIT_TARGET)
 | 
			
		||||
	@echo "Running unit tests"
 | 
			
		||||
	test -n "$$LVM_TEST_DIR" || LVM_TEST_DIR=$${TMPDIR:-/tmp} ;\
 | 
			
		||||
		TESTDIR=$$(mktemp -d -t -p "$$LVM_TEST_DIR" "LVMTEST.XXXXXXXXXX") ;\
 | 
			
		||||
		cd "$$TESTDIR" ;\
 | 
			
		||||
		LD_LIBRARY_PATH=$(abs_top_builddir)/libdm:$(abs_top_builddir)/daemons/dmeventd $(abs_top_builddir)/$(UNIT_TARGET) run ;\
 | 
			
		||||
		cd $$OLDPWD ;\
 | 
			
		||||
		$(RM) -r "$${TESTDIR:?}"
 | 
			
		||||
	LD_LIBRARY_PATH=$(top_builddir)/libdm $(UNIT_TARGET) run
 | 
			
		||||
 | 
			
		||||
ifeq ("$(DEPENDS)","yes")
 | 
			
		||||
-include $(UNIT_SOURCE:%.c=%.d)
 | 
			
		||||
 
 | 
			
		||||
@@ -49,39 +49,31 @@ static uint64_t byte(block_address b, uint64_t offset)
 | 
			
		||||
 | 
			
		||||
static void *_fix_init(struct io_engine *engine)
 | 
			
		||||
{
 | 
			
		||||
	uint8_t buffer[T_BLOCK_SIZE];
 | 
			
		||||
	struct fixture *f = malloc(sizeof(*f));
 | 
			
		||||
	unsigned b, i;
 | 
			
		||||
        uint8_t buffer[T_BLOCK_SIZE];
 | 
			
		||||
        struct fixture *f = malloc(sizeof(*f));
 | 
			
		||||
        unsigned b, i;
 | 
			
		||||
	struct statvfs fsdata = { 0 };
 | 
			
		||||
	static int _runs_is_tmpfs = -1;
 | 
			
		||||
 | 
			
		||||
	memset(buffer, 0, sizeof(buffer));
 | 
			
		||||
	T_ASSERT(f);
 | 
			
		||||
 | 
			
		||||
	if (_runs_is_tmpfs == -1) {
 | 
			
		||||
		snprintf(f->fname, sizeof(f->fname), "unit-test-XXXXXX");
 | 
			
		||||
		/* coverity[secure_temp] don't care */
 | 
			
		||||
		f->fd = mkstemp(f->fname);
 | 
			
		||||
		T_ASSERT(f->fd >= 0);
 | 
			
		||||
		(void) close(f->fd);
 | 
			
		||||
		// test if we can reopen with O_DIRECT
 | 
			
		||||
		if ((f->fd = open(f->fname, O_RDWR | O_DIRECT)) >= 0) {
 | 
			
		||||
			_runs_is_tmpfs = 0;
 | 
			
		||||
			(void) close(f->fd);
 | 
			
		||||
		} else {
 | 
			
		||||
			_runs_is_tmpfs = 1; // likely running on tmpfs
 | 
			
		||||
		// With testing in tmpfs directory O_DIRECT cannot be used
 | 
			
		||||
		// tmpfs has  f_fsid == 0  (unsure if this is best guess)
 | 
			
		||||
		_runs_is_tmpfs = (statvfs(".", &fsdata) == 0 && !fsdata.f_fsid) ? 1 : 0;
 | 
			
		||||
		if (_runs_is_tmpfs)
 | 
			
		||||
			printf("  Running test in tmpfs, *NOT* using O_DIRECT\n");
 | 
			
		||||
		}
 | 
			
		||||
		(void) unlink(f->fname);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	snprintf(f->fname, sizeof(f->fname), "unit-test-XXXXXX");
 | 
			
		||||
        T_ASSERT(f);
 | 
			
		||||
 | 
			
		||||
        snprintf(f->fname, sizeof(f->fname), "unit-test-XXXXXX");
 | 
			
		||||
	/* coverity[secure_temp] don't care */
 | 
			
		||||
	f->fd = mkstemp(f->fname);
 | 
			
		||||
	T_ASSERT(f->fd >= 0);
 | 
			
		||||
 | 
			
		||||
	for (b = 0; b < NR_BLOCKS; b++) {
 | 
			
		||||
		for (i = 0; i < sizeof(buffer); i++)
 | 
			
		||||
			buffer[i] = _pattern_at(INIT_PATTERN, byte(b, i));
 | 
			
		||||
        	for (i = 0; i < sizeof(buffer); i++)
 | 
			
		||||
                	buffer[i] = _pattern_at(INIT_PATTERN, byte(b, i));
 | 
			
		||||
		T_ASSERT(write(f->fd, buffer, T_BLOCK_SIZE) > 0);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -97,7 +89,7 @@ static void *_fix_init(struct io_engine *engine)
 | 
			
		||||
 | 
			
		||||
	f->di = bcache_set_fd(f->fd);
 | 
			
		||||
 | 
			
		||||
	return f;
 | 
			
		||||
        return f;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void *_async_init(void)
 | 
			
		||||
 
 | 
			
		||||
@@ -279,9 +279,8 @@ arg(errorwhenfull_ARG, '\0', "errorwhenfull", bool_VAL, 0, 0,
 | 
			
		||||
    "See \\fBlvmthin\\fP(7) for more information.\n")
 | 
			
		||||
 | 
			
		||||
arg(eventactivation_ARG, '\0', "eventactivation", string_VAL, 0, 0,
 | 
			
		||||
    "Specify if the command is running autoactivation from an event\n"
 | 
			
		||||
    "or a fixed service. The lvm.conf event_activation_options setting\n"
 | 
			
		||||
    "determines if event or service based activation commands are used.\n")
 | 
			
		||||
    "Use a run file to coordinate the transition to event\n"
 | 
			
		||||
    "activation.\n")
 | 
			
		||||
 | 
			
		||||
arg(force_long_ARG, '\0', "force", 0, ARG_COUNTABLE, 0,
 | 
			
		||||
    "Force metadata restore even with thin pool LVs.\n"
 | 
			
		||||
 
 | 
			
		||||
@@ -2540,8 +2540,6 @@ static int _get_current_settings(struct cmd_context *cmd)
 | 
			
		||||
		if (!strcmp(hint_mode, "none")) {
 | 
			
		||||
			cmd->enable_hints = 0;
 | 
			
		||||
			cmd->use_hints = 0;
 | 
			
		||||
		} else if (!strcmp(hint_mode, "pvs_online")) {
 | 
			
		||||
			cmd->hints_pvs_online = 1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										159
									
								
								tools/pvscan.c
									
									
									
									
									
								
							
							
						
						
									
										159
									
								
								tools/pvscan.c
									
									
									
									
									
								
							@@ -20,8 +20,7 @@
 | 
			
		||||
#include "lib/label/hints.h"
 | 
			
		||||
 | 
			
		||||
#include <dirent.h>
 | 
			
		||||
 | 
			
		||||
int online_pvid_file_read(char *path, int *major, int *minor, char *vgname);
 | 
			
		||||
#include <time.h>
 | 
			
		||||
 | 
			
		||||
struct pvscan_params {
 | 
			
		||||
	int new_pvs_found;
 | 
			
		||||
@@ -183,60 +182,6 @@ out:
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Event based activation
 | 
			
		||||
 * lvm.conf event_activation_options = "event_only"
 | 
			
		||||
 * . all events are used for activation
 | 
			
		||||
 * . no fixed services are used for activation
 | 
			
		||||
 * . lvm.conf event_activation=1 required
 | 
			
		||||
 *
 | 
			
		||||
 * vgchange -aay --eventactivation service
 | 
			
		||||
 * . does nothing
 | 
			
		||||
 * vgchange -aay --eventactivation event
 | 
			
		||||
 * . does activation
 | 
			
		||||
 * pvscan --eventactivation event
 | 
			
		||||
 * . does activation
 | 
			
		||||
 *
 | 
			
		||||
 * ---
 | 
			
		||||
 *
 | 
			
		||||
 * Non-event based activation
 | 
			
		||||
 * lvm.conf event_activation_options = "service_only"
 | 
			
		||||
 * . fixed services are used for activation
 | 
			
		||||
 * . no events are used for activation
 | 
			
		||||
 * . lvm.conf event_activation=0 is equivalent to
 | 
			
		||||
 *   event_activation=1 event_activation_options="service_only"
 | 
			
		||||
 *
 | 
			
		||||
 * vgchange -aay --eventactivation service
 | 
			
		||||
 * . does activation
 | 
			
		||||
 * vgchange -aay --eventactivation event
 | 
			
		||||
 * . does nothing
 | 
			
		||||
 * pvscan --eventactivation event
 | 
			
		||||
 * . does nothing
 | 
			
		||||
 *
 | 
			
		||||
 * ---
 | 
			
		||||
 *
 | 
			
		||||
 * Mix of event and non-event based activation
 | 
			
		||||
 * lvm.conf event_activation_options = "service_to_event"
 | 
			
		||||
 * . both services and events are used for activation
 | 
			
		||||
 * . fixed services are used for activation initially,
 | 
			
		||||
 *   and last service enables event based activation
 | 
			
		||||
 *   by creating the event-activation-on file
 | 
			
		||||
 *
 | 
			
		||||
 * vgchange -aay --eventactivation service
 | 
			
		||||
 * . does activation only if event-activation-on does not exist
 | 
			
		||||
 * vgchange -aay --eventactivation event
 | 
			
		||||
 * . does activation only if event-activation-on exists
 | 
			
		||||
 * vgchange -aay --eventactivation service,on
 | 
			
		||||
 * . does activation only if event-activation-on does not exist
 | 
			
		||||
 * . creates event-activation-on to enable event-based activation
 | 
			
		||||
 * vgchange --eventactivation on|off
 | 
			
		||||
 * . create or remove event-activation-on to enable|disable
 | 
			
		||||
 *   event-based activation
 | 
			
		||||
 * pvscan --eventactivation event
 | 
			
		||||
 * . does activation only if event-activation-on exists
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
int event_activation_enable(struct cmd_context *cmd)
 | 
			
		||||
{
 | 
			
		||||
	FILE *fp;
 | 
			
		||||
@@ -307,7 +252,7 @@ static char *_vgname_in_pvid_file_buf(char *buf)
 | 
			
		||||
 | 
			
		||||
#define MAX_PVID_FILE_SIZE 512
 | 
			
		||||
 | 
			
		||||
int online_pvid_file_read(char *path, int *major, int *minor, char *vgname)
 | 
			
		||||
static int _online_pvid_file_read(char *path, int *major, int *minor, char *vgname)
 | 
			
		||||
{
 | 
			
		||||
	char buf[MAX_PVID_FILE_SIZE] = { 0 };
 | 
			
		||||
	char *name;
 | 
			
		||||
@@ -353,7 +298,7 @@ static void _lookup_file_remove(char *vgname)
 | 
			
		||||
 | 
			
		||||
	log_debug("Unlink pvs_lookup: %s", path);
 | 
			
		||||
 | 
			
		||||
	if (unlink(path) && (errno != ENOENT))
 | 
			
		||||
	if (unlink(path))
 | 
			
		||||
		log_sys_debug("unlink", path);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -374,7 +319,7 @@ void online_vg_file_remove(const char *vgname)
 | 
			
		||||
 | 
			
		||||
	log_debug("Unlink vg online: %s", path);
 | 
			
		||||
 | 
			
		||||
	if (unlink(path) && (errno != ENOENT))
 | 
			
		||||
	if (unlink(path))
 | 
			
		||||
		log_sys_debug("unlink", path);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -410,11 +355,11 @@ static void _online_pvid_file_remove_devno(int major, int minor)
 | 
			
		||||
		file_minor = 0;
 | 
			
		||||
		memset(file_vgname, 0, sizeof(file_vgname));
 | 
			
		||||
 | 
			
		||||
		online_pvid_file_read(path, &file_major, &file_minor, file_vgname);
 | 
			
		||||
		_online_pvid_file_read(path, &file_major, &file_minor, file_vgname);
 | 
			
		||||
 | 
			
		||||
		if ((file_major == major) && (file_minor == minor)) {
 | 
			
		||||
			log_debug("Unlink pv online %s", path);
 | 
			
		||||
			if (unlink(path) && (errno != ENOENT))
 | 
			
		||||
			if (unlink(path))
 | 
			
		||||
				log_sys_debug("unlink", path);
 | 
			
		||||
 | 
			
		||||
			if (file_vgname[0]) {
 | 
			
		||||
@@ -442,7 +387,7 @@ static void _online_files_remove(const char *dirpath)
 | 
			
		||||
 | 
			
		||||
		memset(path, 0, sizeof(path));
 | 
			
		||||
		snprintf(path, sizeof(path), "%s/%s", dirpath, de->d_name);
 | 
			
		||||
		if (unlink(path) && (errno != ENOENT))
 | 
			
		||||
		if (unlink(path))
 | 
			
		||||
			log_sys_debug("unlink", path);
 | 
			
		||||
	}
 | 
			
		||||
	if (closedir(dir))
 | 
			
		||||
@@ -533,7 +478,7 @@ check_duplicate:
 | 
			
		||||
 | 
			
		||||
	memset(file_vgname, 0, sizeof(file_vgname));
 | 
			
		||||
 | 
			
		||||
	online_pvid_file_read(path, &file_major, &file_minor, file_vgname);
 | 
			
		||||
	_online_pvid_file_read(path, &file_major, &file_minor, file_vgname);
 | 
			
		||||
 | 
			
		||||
	if ((file_major == major) && (file_minor == minor)) {
 | 
			
		||||
		log_debug("Existing online file for %d:%d", major, minor);
 | 
			
		||||
@@ -834,7 +779,7 @@ static int _pvscan_aa_single(struct cmd_context *cmd, const char *vg_name,
 | 
			
		||||
 | 
			
		||||
	log_debug("pvscan autoactivating VG %s.", vg_name);
 | 
			
		||||
 | 
			
		||||
	if (!vgchange_activate(cmd, vg, CHANGE_AAY, 1)) {
 | 
			
		||||
	if (!vgchange_activate(cmd, vg, CHANGE_AAY)) {
 | 
			
		||||
		log_error_pvscan(cmd, "%s: autoactivation failed.", vg->name);
 | 
			
		||||
		pp->activate_errors++;
 | 
			
		||||
	}
 | 
			
		||||
@@ -933,7 +878,7 @@ static int _get_devs_from_saved_vg(struct cmd_context *cmd, const char *vgname,
 | 
			
		||||
		file_minor = 0;
 | 
			
		||||
		memset(file_vgname, 0, sizeof(file_vgname));
 | 
			
		||||
 | 
			
		||||
		online_pvid_file_read(path, &file_major, &file_minor, file_vgname);
 | 
			
		||||
		_online_pvid_file_read(path, &file_major, &file_minor, file_vgname);
 | 
			
		||||
 | 
			
		||||
		if (file_vgname[0] && strcmp(vgname, file_vgname)) {
 | 
			
		||||
			log_error_pvscan(cmd, "Wrong VG found for %d:%d PVID %s: %s vs %s",
 | 
			
		||||
@@ -943,21 +888,11 @@ static int _get_devs_from_saved_vg(struct cmd_context *cmd, const char *vgname,
 | 
			
		||||
 | 
			
		||||
		devno = MKDEV(file_major, file_minor);
 | 
			
		||||
 | 
			
		||||
		if (!setup_devno_in_dev_cache(cmd, devno)) {
 | 
			
		||||
			log_error_pvscan(cmd, "No device set up for %d:%d PVID %s", file_major, file_minor, pvid);
 | 
			
		||||
			goto bad;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (!(dev = dev_cache_get_by_devt(cmd, devno, NULL, NULL))) {
 | 
			
		||||
			log_error_pvscan(cmd, "No device found for %d:%d PVID %s", file_major, file_minor, pvid);
 | 
			
		||||
			goto bad;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
		 * Do not need to match device_id here, see comment after
 | 
			
		||||
		 * get_devs_from_saved_vg about relying on pvid online file.
 | 
			
		||||
		 */
 | 
			
		||||
 | 
			
		||||
		name1 = dev_name(dev);
 | 
			
		||||
		name2 = pvl->pv->device_hint;
 | 
			
		||||
 | 
			
		||||
@@ -1122,7 +1057,7 @@ static int _pvscan_aa_quick(struct cmd_context *cmd, struct pvscan_aa_params *pp
 | 
			
		||||
 | 
			
		||||
	log_debug("pvscan autoactivating VG %s.", vgname);
 | 
			
		||||
 | 
			
		||||
	if (!vgchange_activate(cmd, vg, CHANGE_AAY, 1)) {
 | 
			
		||||
	if (!vgchange_activate(cmd, vg, CHANGE_AAY)) {
 | 
			
		||||
		log_error_pvscan(cmd, "%s: autoactivation failed.", vg->name);
 | 
			
		||||
		pp->activate_errors++;
 | 
			
		||||
	}
 | 
			
		||||
@@ -1288,15 +1223,11 @@ static int _get_args_devs(struct cmd_context *cmd, struct dm_list *pvscan_args,
 | 
			
		||||
	/* in common usage, no dev will be found for a devno */
 | 
			
		||||
 | 
			
		||||
	dm_list_iterate_items(arg, pvscan_args) {
 | 
			
		||||
		if (arg->devname) {
 | 
			
		||||
			if (!setup_devname_in_dev_cache(cmd, arg->devname))
 | 
			
		||||
				log_error_pvscan(cmd, "No device set up for name arg %s", arg->devname);
 | 
			
		||||
		if (arg->devname)
 | 
			
		||||
			arg->dev = dev_cache_get(cmd, arg->devname, NULL);
 | 
			
		||||
		} else if (arg->devno) {
 | 
			
		||||
			if (!setup_devno_in_dev_cache(cmd, arg->devno))
 | 
			
		||||
				log_error_pvscan(cmd, "No device set up for devno arg %d", (int)arg->devno);
 | 
			
		||||
		else if (arg->devno)
 | 
			
		||||
			arg->dev = dev_cache_get_by_devt(cmd, arg->devno, NULL, NULL);
 | 
			
		||||
		} else
 | 
			
		||||
		else
 | 
			
		||||
			return_0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -1346,7 +1277,7 @@ static void _set_pv_devices_online(struct cmd_context *cmd, struct volume_group
 | 
			
		||||
		minor = 0;
 | 
			
		||||
		file_vgname[0] = '\0';
 | 
			
		||||
 | 
			
		||||
		online_pvid_file_read(path, &major, &minor, file_vgname);
 | 
			
		||||
		_online_pvid_file_read(path, &major, &minor, file_vgname);
 | 
			
		||||
 | 
			
		||||
		if (file_vgname[0] && strcmp(vg->name, file_vgname)) {
 | 
			
		||||
			log_warn("WARNING: VG %s PV %s wrong vgname in online file %s",
 | 
			
		||||
@@ -1395,7 +1326,7 @@ static int _online_devs(struct cmd_context *cmd, int do_all, struct dm_list *pvs
 | 
			
		||||
	int pvs_online;
 | 
			
		||||
	int pvs_offline;
 | 
			
		||||
	int pvs_unknown;
 | 
			
		||||
	int vg_complete = 0;
 | 
			
		||||
	int vg_complete;
 | 
			
		||||
	int do_full_check;
 | 
			
		||||
	int ret = 1;
 | 
			
		||||
 | 
			
		||||
@@ -1772,13 +1703,11 @@ static int _pvscan_cache_args(struct cmd_context *cmd, int argc, char **argv,
 | 
			
		||||
	cmd->pvscan_cache_single = 1;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Special pvscan-specific setup steps to avoid looking
 | 
			
		||||
	 * at any devices except for device args.
 | 
			
		||||
	 * Read devices file and determine if devices file will be used.
 | 
			
		||||
	 * Does not do dev_cache_scan (adds nothing to dev-cache), and
 | 
			
		||||
	 * does not do any device id matching.
 | 
			
		||||
	 * "no_file_match" means that when the devices file is used,
 | 
			
		||||
	 * setup_devices will skip matching devs to devices file entries.
 | 
			
		||||
	 * Specific devs must be matched later with device_ids_match_dev().
 | 
			
		||||
	 */
 | 
			
		||||
	if (!setup_devices_for_pvscan_cache(cmd)) {
 | 
			
		||||
	if (!setup_devices_no_file_match(cmd)) {
 | 
			
		||||
		log_error_pvscan(cmd, "Failed to set up devices.");
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
@@ -1837,21 +1766,17 @@ static int _pvscan_cache_args(struct cmd_context *cmd, int argc, char **argv,
 | 
			
		||||
	log_debug("pvscan_cache_args: filter devs nodata");
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Match dev args with the devices file because special/optimized
 | 
			
		||||
	 * device setup was used above which does not check the devices file.
 | 
			
		||||
	 * If a match fails here do not exclude it, that will be done below by
 | 
			
		||||
	 * passes_filter() which runs filter-deviceid. The
 | 
			
		||||
	 * relax_deviceid_filter case needs to be able to work around
 | 
			
		||||
	 * Match dev args with the devices file because
 | 
			
		||||
	 * setup_devices_no_file_match() was used above which skipped checking
 | 
			
		||||
	 * the devices file.  If a match fails here do not exclude it, that
 | 
			
		||||
	 * will be done below by passes_filter() which runs filter-deviceid.
 | 
			
		||||
	 * The relax_deviceid_filter case needs to be able to work around
 | 
			
		||||
	 * unmatching devs.
 | 
			
		||||
	 */
 | 
			
		||||
 | 
			
		||||
	if (cmd->enable_devices_file) {
 | 
			
		||||
		dm_list_iterate_items(devl, &pvscan_devs)
 | 
			
		||||
		dm_list_iterate_items_safe(devl, devl2, &pvscan_devs)
 | 
			
		||||
			device_ids_match_dev(cmd, devl->dev);
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	if (cmd->enable_devices_list)
 | 
			
		||||
		device_ids_match_device_list(cmd);
 | 
			
		||||
 | 
			
		||||
	if (cmd->enable_devices_file && device_ids_use_devname(cmd)) {
 | 
			
		||||
		relax_deviceid_filter = 1;
 | 
			
		||||
@@ -2038,33 +1963,11 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
 | 
			
		||||
			return ECMD_PROCESSED;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		if ((ea = arg_str_value(cmd, eventactivation_ARG, NULL))) {
 | 
			
		||||
			int service_only = 0, event_only = 0, service_to_event = 0;
 | 
			
		||||
			int ea_service = 0, ea_event = 0, ea_on = 0;
 | 
			
		||||
 | 
			
		||||
			if (!get_event_activation_config_settings(cmd, &service_only, &event_only, &service_to_event))
 | 
			
		||||
				return ECMD_FAILED;
 | 
			
		||||
			if (!get_event_activation_command_options(cmd, ea, &ea_service, &ea_event, &ea_on))
 | 
			
		||||
				return ECMD_FAILED;
 | 
			
		||||
 | 
			
		||||
			if (ea_event) {
 | 
			
		||||
				if (!event_activation) {
 | 
			
		||||
					log_print("Skip pvscan for event and event_activation=0.");
 | 
			
		||||
					return ECMD_PROCESSED;
 | 
			
		||||
				}
 | 
			
		||||
				if (service_only) {
 | 
			
		||||
					log_print("Skip pvscan for event and event_activation_options service_only.");
 | 
			
		||||
					return ECMD_PROCESSED;
 | 
			
		||||
				}
 | 
			
		||||
				if (service_to_event && !event_activation_is_on(cmd)) {
 | 
			
		||||
					log_print("Skip pvscan for event and no event-activation-on.");
 | 
			
		||||
					return ECMD_PROCESSED;
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				log_error("Option --eventactivation %s is not used by pvscan.", ea);
 | 
			
		||||
				return ECMD_FAILED;
 | 
			
		||||
			}
 | 
			
		||||
		if ((ea = arg_str_value(cmd, eventactivation_ARG, NULL)) &&
 | 
			
		||||
		    !strcmp(ea, "check") &&
 | 
			
		||||
		    !event_activation_is_on(cmd)) {
 | 
			
		||||
			log_verbose("Ignoring pvscan --cache because event_activation is not started.");
 | 
			
		||||
			return ECMD_PROCESSED;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (!_pvscan_cache_args(cmd, argc, argv, &complete_vgnames))
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										346
									
								
								tools/toollib.c
									
									
									
									
									
								
							
							
						
						
									
										346
									
								
								tools/toollib.c
									
									
									
									
									
								
							@@ -828,7 +828,7 @@ int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv,
 | 
			
		||||
	 * user may want to take charge of activation changes to the VG
 | 
			
		||||
	 * and not have the system autoactivation interfere.
 | 
			
		||||
	 */
 | 
			
		||||
	if (!is_change_activating(activate) && cmd->event_activation)
 | 
			
		||||
	if (!is_change_activating(activate) && find_config_tree_bool(cmd, global_event_activation_CFG, NULL))
 | 
			
		||||
		online_vg_file_remove(lv->vg->name);
 | 
			
		||||
 | 
			
		||||
	set_lv_notify(lv->vg->cmd);
 | 
			
		||||
@@ -1481,7 +1481,7 @@ int process_each_label(struct cmd_context *cmd, int argc, char **argv,
 | 
			
		||||
			/*
 | 
			
		||||
			 * add info to lvmcache from the duplicate dev.
 | 
			
		||||
			 */
 | 
			
		||||
			label_scan_dev(cmd, devl->dev);
 | 
			
		||||
			label_scan_dev(devl->dev);
 | 
			
		||||
 | 
			
		||||
			/*
 | 
			
		||||
			 * the info/label should now be found because
 | 
			
		||||
@@ -3882,6 +3882,63 @@ static int _get_arg_devices(struct cmd_context *cmd,
 | 
			
		||||
	return ret_max;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _get_all_devices(struct cmd_context *cmd,
 | 
			
		||||
			    int process_all_devices,
 | 
			
		||||
			    struct dm_list *all_devices)
 | 
			
		||||
{
 | 
			
		||||
	struct dev_iter *iter;
 | 
			
		||||
	struct device *dev;
 | 
			
		||||
	struct device_id_list *dil;
 | 
			
		||||
	struct hint *hint;
 | 
			
		||||
	int r = ECMD_FAILED;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * If command is using hints and is only looking for PVs
 | 
			
		||||
	 * (not all devices), then we can use only devs from hints.
 | 
			
		||||
	 */
 | 
			
		||||
	if (!process_all_devices && !dm_list_empty(&cmd->hints)) {
 | 
			
		||||
		log_debug("Getting list of all devices from hints");
 | 
			
		||||
 | 
			
		||||
		dm_list_iterate_items(hint, &cmd->hints) {
 | 
			
		||||
			if (!(dev = dev_cache_get(cmd, hint->name, NULL)))
 | 
			
		||||
				continue;
 | 
			
		||||
 | 
			
		||||
			if (!(dil = dm_pool_zalloc(cmd->mem, sizeof(*dil)))) {
 | 
			
		||||
				log_error("device_id_list alloc failed.");
 | 
			
		||||
				return ECMD_FAILED;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			memcpy(dil->pvid, hint->pvid, ID_LEN);
 | 
			
		||||
			dil->dev = dev;
 | 
			
		||||
			dm_list_add(all_devices, &dil->list);
 | 
			
		||||
		}
 | 
			
		||||
		return ECMD_PROCESSED;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	log_debug("Getting list of all devices from system");
 | 
			
		||||
 | 
			
		||||
	if (!(iter = dev_iter_create(cmd->filter, 1))) {
 | 
			
		||||
		log_error("dev_iter creation failed.");
 | 
			
		||||
		return ECMD_FAILED;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	while ((dev = dev_iter_get(cmd, iter))) {
 | 
			
		||||
		if (!(dil = dm_pool_zalloc(cmd->mem, sizeof(*dil)))) {
 | 
			
		||||
			log_error("device_id_list alloc failed.");
 | 
			
		||||
			goto out;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		memcpy(dil->pvid, dev->pvid, ID_LEN);
 | 
			
		||||
		dil->dev = dev;
 | 
			
		||||
		dm_list_add(all_devices, &dil->list);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	r = ECMD_PROCESSED;
 | 
			
		||||
out:
 | 
			
		||||
	dev_iter_destroy(iter);
 | 
			
		||||
	return r;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _device_list_remove(struct dm_list *devices, struct device *dev)
 | 
			
		||||
{
 | 
			
		||||
	struct device_id_list *dil;
 | 
			
		||||
@@ -3908,66 +3965,47 @@ static struct device_id_list *_device_list_find_dev(struct dm_list *devices, str
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Process devices that are not PVs. */
 | 
			
		||||
 | 
			
		||||
static int _process_other_devices(struct cmd_context *cmd,
 | 
			
		||||
static int _process_device_list(struct cmd_context *cmd, struct dm_list *all_devices,
 | 
			
		||||
				struct processing_handle *handle,
 | 
			
		||||
				process_single_pv_fn_t process_single_pv)
 | 
			
		||||
{
 | 
			
		||||
	struct dev_iter *iter;
 | 
			
		||||
	struct physical_volume pv_dummy;
 | 
			
		||||
	struct physical_volume *pv;
 | 
			
		||||
	struct device *dev;
 | 
			
		||||
	int failed = 0;
 | 
			
		||||
	int ret;
 | 
			
		||||
	struct device_id_list *dil;
 | 
			
		||||
	int ret_max = ECMD_PROCESSED;
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
 | 
			
		||||
	log_debug("Processing devices that are not PVs");
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * We want devices here that passed filters during
 | 
			
		||||
	 * label_scan but were found to not be PVs.
 | 
			
		||||
	 *
 | 
			
		||||
	 * No filtering used in iter, DEV_SCAN_FOUND_NOLABEL
 | 
			
		||||
	 * was set by label_scan which did filtering.
 | 
			
		||||
	 * Pretend that each device is a PV with dummy values.
 | 
			
		||||
	 * FIXME Formalise this extension or find an alternative.
 | 
			
		||||
	 */
 | 
			
		||||
 | 
			
		||||
	if (!(iter = dev_iter_create(NULL, 0)))
 | 
			
		||||
		return_0;
 | 
			
		||||
 | 
			
		||||
	while ((dev = dev_iter_get(cmd, iter))) {
 | 
			
		||||
		if (sigint_caught()) {
 | 
			
		||||
			failed = 1;
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (!(dev->flags & DEV_SCAN_FOUND_NOLABEL))
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
		 * Pretend that each device is a PV with dummy values.
 | 
			
		||||
		 * FIXME Formalise this extension or find an alternative.
 | 
			
		||||
		 */
 | 
			
		||||
	dm_list_iterate_items(dil, all_devices) {
 | 
			
		||||
		if (sigint_caught())
 | 
			
		||||
			return_ECMD_FAILED;
 | 
			
		||||
 | 
			
		||||
		memset(&pv_dummy, 0, sizeof(pv_dummy));
 | 
			
		||||
		dm_list_init(&pv_dummy.tags);
 | 
			
		||||
		dm_list_init(&pv_dummy.segments);
 | 
			
		||||
		pv_dummy.dev = dev;
 | 
			
		||||
		pv_dummy.dev = dil->dev;
 | 
			
		||||
		pv = &pv_dummy;
 | 
			
		||||
 | 
			
		||||
		log_very_verbose("Processing device %s.", dev_name(dev));
 | 
			
		||||
		log_very_verbose("Processing device %s.", dev_name(dil->dev));
 | 
			
		||||
 | 
			
		||||
		ret = process_single_pv(cmd, NULL, pv, handle);
 | 
			
		||||
		if (ret != ECMD_PROCESSED)
 | 
			
		||||
			failed = 1;
 | 
			
		||||
	}
 | 
			
		||||
	dev_iter_destroy(iter);
 | 
			
		||||
 | 
			
		||||
	return failed ? 0 : 1;
 | 
			
		||||
		if (ret > ret_max)
 | 
			
		||||
			ret_max = ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ECMD_PROCESSED;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _process_duplicate_pvs(struct cmd_context *cmd,
 | 
			
		||||
				  struct dm_list *all_devices,
 | 
			
		||||
				  struct dm_list *arg_devices,
 | 
			
		||||
				  int process_other_devices,
 | 
			
		||||
				  int process_all_devices,
 | 
			
		||||
				  struct processing_handle *handle,
 | 
			
		||||
				  process_single_pv_fn_t process_single_pv)
 | 
			
		||||
{
 | 
			
		||||
@@ -3977,8 +4015,8 @@ static int _process_duplicate_pvs(struct cmd_context *cmd,
 | 
			
		||||
	struct lvmcache_info *info;
 | 
			
		||||
	const char *vgname;
 | 
			
		||||
	const char *vgid;
 | 
			
		||||
	int failed = 0;
 | 
			
		||||
	int ret;
 | 
			
		||||
	int ret_max = ECMD_PROCESSED;
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
 | 
			
		||||
	struct physical_volume dummy_pv = {
 | 
			
		||||
		.pe_size = 1,
 | 
			
		||||
@@ -4007,15 +4045,20 @@ static int _process_duplicate_pvs(struct cmd_context *cmd,
 | 
			
		||||
	dm_list_init(&unused_duplicate_devs);
 | 
			
		||||
 | 
			
		||||
	if (!lvmcache_get_unused_duplicates(cmd, &unused_duplicate_devs))
 | 
			
		||||
		return_0;
 | 
			
		||||
		return_ECMD_FAILED;
 | 
			
		||||
 | 
			
		||||
	dm_list_iterate_items(devl, &unused_duplicate_devs) {
 | 
			
		||||
		/* Duplicates are displayed if -a is used or the dev is named as an arg. */
 | 
			
		||||
 | 
			
		||||
		_device_list_remove(all_devices, devl->dev);
 | 
			
		||||
 | 
			
		||||
		if (!process_all_devices && dm_list_empty(arg_devices))
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		if ((dil = _device_list_find_dev(arg_devices, devl->dev)))
 | 
			
		||||
			_device_list_remove(arg_devices, devl->dev);
 | 
			
		||||
 | 
			
		||||
		if (!process_other_devices && !dil)
 | 
			
		||||
		if (!process_all_devices && !dil)
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		if (!(cmd->cname->flags & ENABLE_DUPLICATE_DEVS))
 | 
			
		||||
@@ -4044,7 +4087,7 @@ static int _process_duplicate_pvs(struct cmd_context *cmd,
 | 
			
		||||
		 */
 | 
			
		||||
		if (!(info = lvmcache_info_from_pvid(devl->dev->pvid, NULL, 0))) {
 | 
			
		||||
			log_error(INTERNAL_ERROR "No info for pvid");
 | 
			
		||||
			return 0;
 | 
			
		||||
			return ECMD_FAILED;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		vgname = lvmcache_vgname_from_info(info);
 | 
			
		||||
@@ -4060,39 +4103,47 @@ static int _process_duplicate_pvs(struct cmd_context *cmd,
 | 
			
		||||
			memset(&dummy_vg.id, 0, sizeof(dummy_vg.id));
 | 
			
		||||
 | 
			
		||||
		ret = process_single_pv(cmd, &dummy_vg, &dummy_pv, handle);
 | 
			
		||||
		if (ret != ECMD_PROCESSED)
 | 
			
		||||
			failed = 1;
 | 
			
		||||
 | 
			
		||||
		if (ret > ret_max)
 | 
			
		||||
			ret_max = ret;
 | 
			
		||||
 | 
			
		||||
		if (sigint_caught())
 | 
			
		||||
			return_0;
 | 
			
		||||
			return_ECMD_FAILED;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return failed ? 0 : 1;
 | 
			
		||||
	return ECMD_PROCESSED;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _process_pvs_in_vg(struct cmd_context *cmd,
 | 
			
		||||
			      struct volume_group *vg,
 | 
			
		||||
			      struct dm_list *all_devices,
 | 
			
		||||
			      struct dm_list *arg_devices,
 | 
			
		||||
			      struct dm_list *arg_tags,
 | 
			
		||||
			      int process_all_pvs,
 | 
			
		||||
			      int process_all_devices,
 | 
			
		||||
			      int skip,
 | 
			
		||||
			      uint32_t error_flags,
 | 
			
		||||
			      struct processing_handle *handle,
 | 
			
		||||
			      process_single_pv_fn_t process_single_pv)
 | 
			
		||||
{
 | 
			
		||||
	log_report_t saved_log_report_state = log_get_report_state();
 | 
			
		||||
	char vgid[ID_LEN + 1] __attribute__((aligned(8))) = { 0 };
 | 
			
		||||
	char pv_uuid[64] __attribute__((aligned(8)));
 | 
			
		||||
	char vg_uuid[64] __attribute__((aligned(8)));
 | 
			
		||||
	int handle_supplied = handle != NULL;
 | 
			
		||||
	struct physical_volume *pv;
 | 
			
		||||
	struct pv_list *pvl;
 | 
			
		||||
	struct device_id_list *dil;
 | 
			
		||||
	struct device_list *devl;
 | 
			
		||||
	struct dm_list outdated_devs;
 | 
			
		||||
	const char *pv_name;
 | 
			
		||||
	int process_pv;
 | 
			
		||||
	int do_report_ret_code = 1;
 | 
			
		||||
	int ret_max = ECMD_PROCESSED;
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
 | 
			
		||||
	dm_list_init(&outdated_devs);
 | 
			
		||||
 | 
			
		||||
	log_set_report_object_type(LOG_REPORT_OBJECT_TYPE_PV);
 | 
			
		||||
 | 
			
		||||
	vg_uuid[0] = '\0';
 | 
			
		||||
@@ -4170,6 +4221,18 @@ static int _process_pvs_in_vg(struct cmd_context *cmd,
 | 
			
		||||
			else
 | 
			
		||||
				log_very_verbose("Processing PV %s in VG %s.", pv_name, vg->name);
 | 
			
		||||
 | 
			
		||||
			_device_list_remove(all_devices, pv->dev);
 | 
			
		||||
 | 
			
		||||
			/*
 | 
			
		||||
			 * pv->dev should be found in all_devices unless it's a
 | 
			
		||||
			 * case of a "missing device".  Previously there have
 | 
			
		||||
			 * been cases where we needed to skip processing the PV
 | 
			
		||||
			 * if pv->dev was not found in all_devices to avoid
 | 
			
		||||
			 * processing a PV twice, i.e. when the PV had no MDAs
 | 
			
		||||
			 * it would be seen once in its real VG and again
 | 
			
		||||
			 * wrongly in the orphan VG.  This no longer happens.
 | 
			
		||||
			 */
 | 
			
		||||
 | 
			
		||||
			if (!skip) {
 | 
			
		||||
				ret = process_single_pv(cmd, vg, pv, handle);
 | 
			
		||||
				if (ret != ECMD_PROCESSED)
 | 
			
		||||
@@ -4189,6 +4252,13 @@ static int _process_pvs_in_vg(struct cmd_context *cmd,
 | 
			
		||||
		log_set_report_object_name_and_id(NULL, NULL);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!is_orphan_vg(vg->name)) {
 | 
			
		||||
		memcpy(vgid, &vg->id, ID_LEN);
 | 
			
		||||
		lvmcache_get_outdated_devs(cmd, vg->name, vgid, &outdated_devs);
 | 
			
		||||
	}
 | 
			
		||||
	dm_list_iterate_items(devl, &outdated_devs)
 | 
			
		||||
		_device_list_remove(all_devices, devl->dev);
 | 
			
		||||
 | 
			
		||||
	do_report_ret_code = 0;
 | 
			
		||||
out:
 | 
			
		||||
	if (do_report_ret_code)
 | 
			
		||||
@@ -4208,15 +4278,18 @@ out:
 | 
			
		||||
 * arg_devices and arg_tags are empty, then process all PVs.
 | 
			
		||||
 * No PV should be processed more than once.
 | 
			
		||||
 *
 | 
			
		||||
 * Each PV is removed from arg_devices when it is processed.
 | 
			
		||||
 * Any names remaining in arg_devices were not found, and
 | 
			
		||||
 * should produce an error.
 | 
			
		||||
 * Each PV is removed from arg_devices and all_devices when it is
 | 
			
		||||
 * processed.  Any names remaining in arg_devices were not found, and
 | 
			
		||||
 * should produce an error.  Any devices remaining in all_devices were
 | 
			
		||||
 * not found and should be processed by process_device_list().
 | 
			
		||||
 */
 | 
			
		||||
static int _process_pvs_in_vgs(struct cmd_context *cmd, uint32_t read_flags,
 | 
			
		||||
			       struct dm_list *all_vgnameids,
 | 
			
		||||
			       struct dm_list *all_devices,
 | 
			
		||||
			       struct dm_list *arg_devices,
 | 
			
		||||
			       struct dm_list *arg_tags,
 | 
			
		||||
			       int process_all_pvs,
 | 
			
		||||
			       int process_all_devices,
 | 
			
		||||
			       struct processing_handle *handle,
 | 
			
		||||
			       process_single_pv_fn_t process_single_pv)
 | 
			
		||||
{
 | 
			
		||||
@@ -4285,8 +4358,8 @@ static int _process_pvs_in_vgs(struct cmd_context *cmd, uint32_t read_flags,
 | 
			
		||||
		 * error_vg->pvs entries from devices list.
 | 
			
		||||
		 */
 | 
			
		||||
		
 | 
			
		||||
		ret = _process_pvs_in_vg(cmd, vg ? vg : error_vg, arg_devices, arg_tags,
 | 
			
		||||
					 process_all_pvs, skip, error_flags,
 | 
			
		||||
		ret = _process_pvs_in_vg(cmd, vg ? vg : error_vg, all_devices, arg_devices, arg_tags,
 | 
			
		||||
					 process_all_pvs, process_all_devices, skip, error_flags,
 | 
			
		||||
					 handle, process_single_pv);
 | 
			
		||||
		if (ret != ECMD_PROCESSED)
 | 
			
		||||
			stack;
 | 
			
		||||
@@ -4332,9 +4405,10 @@ int process_each_pv(struct cmd_context *cmd,
 | 
			
		||||
	struct dm_list arg_pvnames;	/* str_list */
 | 
			
		||||
	struct dm_list arg_devices;	/* device_id_list */
 | 
			
		||||
	struct dm_list all_vgnameids;	/* vgnameid_list */
 | 
			
		||||
	struct dm_list all_devices;	/* device_id_list */
 | 
			
		||||
	struct device_id_list *dil;
 | 
			
		||||
	int process_all_pvs;
 | 
			
		||||
	int process_other_devices;
 | 
			
		||||
	int process_all_devices;
 | 
			
		||||
	int ret_max = ECMD_PROCESSED;
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
@@ -4361,6 +4435,7 @@ int process_each_pv(struct cmd_context *cmd,
 | 
			
		||||
	dm_list_init(&arg_pvnames);
 | 
			
		||||
	dm_list_init(&arg_devices);
 | 
			
		||||
	dm_list_init(&all_vgnameids);
 | 
			
		||||
	dm_list_init(&all_devices);
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Create two lists from argv:
 | 
			
		||||
@@ -4382,7 +4457,7 @@ int process_each_pv(struct cmd_context *cmd,
 | 
			
		||||
 | 
			
		||||
	process_all_pvs = dm_list_empty(&arg_pvnames) && dm_list_empty(&arg_tags);
 | 
			
		||||
 | 
			
		||||
	process_other_devices = process_all_pvs && (cmd->cname->flags & ENABLE_ALL_DEVS) && all_is_set;
 | 
			
		||||
	process_all_devices = process_all_pvs && (cmd->cname->flags & ENABLE_ALL_DEVS) && all_is_set;
 | 
			
		||||
 | 
			
		||||
	/* Needed for a current listing of the global VG namespace. */
 | 
			
		||||
	if (!only_this_vgname && !lock_global(cmd, "sh")) {
 | 
			
		||||
@@ -4398,6 +4473,16 @@ int process_each_pv(struct cmd_context *cmd,
 | 
			
		||||
		goto_out;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * If the caller wants to process all devices (not just PVs), then all PVs
 | 
			
		||||
	 * from all VGs are processed first, removing them from all_devices.  Then
 | 
			
		||||
	 * any devs remaining in all_devices are processed.
 | 
			
		||||
	 */
 | 
			
		||||
	if ((ret = _get_all_devices(cmd, process_all_devices, &all_devices)) != ECMD_PROCESSED) {
 | 
			
		||||
		ret_max = ret;
 | 
			
		||||
		goto_out;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if ((ret = _get_arg_devices(cmd, &arg_pvnames, &arg_devices)) != ECMD_PROCESSED) {
 | 
			
		||||
		/* get_arg_devices reports EINIT_FAILED for any PV names not found. */
 | 
			
		||||
		ret_max = ret;
 | 
			
		||||
@@ -4406,8 +4491,9 @@ int process_each_pv(struct cmd_context *cmd,
 | 
			
		||||
		ret_max = ECMD_FAILED; /* but ATM we've returned FAILED for all cases */
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ret = _process_pvs_in_vgs(cmd, read_flags, &all_vgnameids,
 | 
			
		||||
				  &arg_devices, &arg_tags, process_all_pvs,
 | 
			
		||||
	ret = _process_pvs_in_vgs(cmd, read_flags, &all_vgnameids, &all_devices,
 | 
			
		||||
				  &arg_devices, &arg_tags,
 | 
			
		||||
				  process_all_pvs, process_all_devices,
 | 
			
		||||
				  handle, process_single_pv);
 | 
			
		||||
	if (ret != ECMD_PROCESSED)
 | 
			
		||||
		stack;
 | 
			
		||||
@@ -4415,29 +4501,58 @@ int process_each_pv(struct cmd_context *cmd,
 | 
			
		||||
		ret_max = ret;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Process the list of unused duplicate devs to display duplicate PVs
 | 
			
		||||
	 * in two cases: 1. pvs -a (which has traditionally included duplicate
 | 
			
		||||
	 * PVs in addition to the expected non-PV devices), 2. pvs <devname>
 | 
			
		||||
	 * (duplicate dev is named on the command line.)
 | 
			
		||||
	 * Process the list of unused duplicate devs so they can be shown by
 | 
			
		||||
	 * report/display commands.  These are the devices that were not chosen
 | 
			
		||||
	 * to be used in lvmcache because another device with the same PVID was
 | 
			
		||||
	 * preferred.  The unused duplicate devs are not seen by
 | 
			
		||||
	 * _process_pvs_in_vgs, which only sees the preferred device for the
 | 
			
		||||
	 * PVID.
 | 
			
		||||
	 *
 | 
			
		||||
	 * The main purpose in reporting/displaying the unused duplicate PVs
 | 
			
		||||
	 * here is so that they do not appear to be unused/free devices or
 | 
			
		||||
	 * orphans.
 | 
			
		||||
	 *
 | 
			
		||||
	 * We do not allow modifying the unused duplicate PVs.  To modify a
 | 
			
		||||
	 * non-preferred duplicate PV, e.g. pvchange -u, a filter needs to be
 | 
			
		||||
	 * used with the command to exclude the other devices with the same
 | 
			
		||||
	 * PVID.  This results in the command seeing only the one device with
 | 
			
		||||
	 * the PVID and allows it to be changed.  (If the duplicates actually
 | 
			
		||||
	 * represent the same underlying storage, these precautions are
 | 
			
		||||
	 * unnecessary, but lvm can't tell when the duplicates are different
 | 
			
		||||
	 * paths to the same storage or different underlying storage.)
 | 
			
		||||
	 *
 | 
			
		||||
	 * Even the preferred duplicate PV in lvmcache is limitted from being
 | 
			
		||||
	 * modified (by allow_changes_with_duplicate_pvs setting), because lvm
 | 
			
		||||
	 * cannot be sure that the preferred duplicate device is the correct one,
 | 
			
		||||
	 * e.g. if a VG has two PVs, and both PVs are cloned, lvm might prefer
 | 
			
		||||
	 * one of the original PVs and one of the cloned PVs, pairing them
 | 
			
		||||
	 * together as the VG.  Any changes on the VG or PVs in that state would
 | 
			
		||||
	 * end up changing one of the original PVs and one of the cloned PVs.
 | 
			
		||||
	 *
 | 
			
		||||
	 * vgimportclone of the two cloned PVs changes their PV UUIDs and gives
 | 
			
		||||
	 * them a new VG name.
 | 
			
		||||
	 */
 | 
			
		||||
	if (process_other_devices || !dm_list_empty(&arg_devices)) {
 | 
			
		||||
		if (!_process_duplicate_pvs(cmd, &arg_devices, process_other_devices, handle, process_single_pv))
 | 
			
		||||
			ret_max = ECMD_FAILED;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ret = _process_duplicate_pvs(cmd, &all_devices, &arg_devices, process_all_devices,
 | 
			
		||||
				     handle, process_single_pv);
 | 
			
		||||
	if (ret != ECMD_PROCESSED)
 | 
			
		||||
		stack;
 | 
			
		||||
	if (ret > ret_max)
 | 
			
		||||
		ret_max = ret;
 | 
			
		||||
 | 
			
		||||
	dm_list_iterate_items(dil, &arg_devices) {
 | 
			
		||||
		log_error("Failed to find physical volume \"%s\".", dev_name(dil->dev));
 | 
			
		||||
		ret_max = ECMD_FAILED;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * pvs -a and pvdisplay -a want to show devices that are not PVs.
 | 
			
		||||
	 */
 | 
			
		||||
	if (process_other_devices) {
 | 
			
		||||
		if (!_process_other_devices(cmd, handle, process_single_pv))
 | 
			
		||||
			ret_max = ECMD_FAILED;
 | 
			
		||||
	}
 | 
			
		||||
	if (!process_all_devices)
 | 
			
		||||
		goto out;
 | 
			
		||||
 | 
			
		||||
	ret = _process_device_list(cmd, &all_devices, handle, process_single_pv);
 | 
			
		||||
	if (ret != ECMD_PROCESSED)
 | 
			
		||||
		stack;
 | 
			
		||||
	if (ret > ret_max)
 | 
			
		||||
		ret_max = ret;
 | 
			
		||||
out:
 | 
			
		||||
	log_restore_report_state(saved_log_report_state);
 | 
			
		||||
	return ret_max;
 | 
			
		||||
@@ -5714,90 +5829,3 @@ bad:
 | 
			
		||||
out:
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int get_event_activation_config_settings(struct cmd_context *cmd,
 | 
			
		||||
				  int *service_only, int *event_only, int *service_to_event)
 | 
			
		||||
{
 | 
			
		||||
	const struct dm_config_node *cn;
 | 
			
		||||
	const struct dm_config_value *cv;
 | 
			
		||||
	int eo = 0, so = 0, se = 0;
 | 
			
		||||
 | 
			
		||||
	if (!(cn = find_config_tree_array(cmd, global_event_activation_options_CFG, NULL)))
 | 
			
		||||
                return 1;
 | 
			
		||||
 | 
			
		||||
	for (cv = cn->v; cv; cv = cv->next) {
 | 
			
		||||
		if (cv->type != DM_CFG_STRING)
 | 
			
		||||
			continue;
 | 
			
		||||
		if (!strcmp(cv->v.str, "service_only"))
 | 
			
		||||
			so = 1;
 | 
			
		||||
		else if (!strcmp(cv->v.str, "event_only"))
 | 
			
		||||
			eo = 1;
 | 
			
		||||
		else if (!strcmp(cv->v.str, "service_to_event"))
 | 
			
		||||
			se = 1;
 | 
			
		||||
		else if (strlen(cv->v.str) > 0)
 | 
			
		||||
			log_warn("WARNING: ignoring unrecognized event_activation_options value %s.", cv->v.str);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (se && (so || eo)) {
 | 
			
		||||
		log_warn("WARNING: ignoring incompatible event_activation_options, using service_to_event.");
 | 
			
		||||
		*service_to_event = 1;
 | 
			
		||||
	} else if (so && eo) {
 | 
			
		||||
		log_warn("WARNING: ignoring incompatible event_activation_options, using event_only.");
 | 
			
		||||
		*event_only = 1;
 | 
			
		||||
	} else if (se) {
 | 
			
		||||
		*service_to_event = 1;
 | 
			
		||||
	} else if (so) {
 | 
			
		||||
		*service_only = 1;
 | 
			
		||||
	} else if (eo) {
 | 
			
		||||
		*event_only = 1;
 | 
			
		||||
	} else {
 | 
			
		||||
		*service_to_event = 1;
 | 
			
		||||
	}
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _ea_option_value(const char *val, int *ea_service, int *ea_event, int *ea_on)
 | 
			
		||||
{
 | 
			
		||||
	if (!strcmp(val, "service"))
 | 
			
		||||
		*ea_service = 1;
 | 
			
		||||
	else if (!strcmp(val, "event"))
 | 
			
		||||
		*ea_event = 1;
 | 
			
		||||
	else if (!strcmp(val, "on"))
 | 
			
		||||
		*ea_on = 1;
 | 
			
		||||
	else {
 | 
			
		||||
		log_error("Unknown --eventactivation value.");
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int get_event_activation_command_options(struct cmd_context *cmd, const char *ea, int *ea_service, int *ea_event, int *ea_on)
 | 
			
		||||
{
 | 
			
		||||
	char ea_vals[128] = {0};
 | 
			
		||||
	char *val1, *val2;
 | 
			
		||||
 | 
			
		||||
	strncpy(ea_vals, ea, 127);
 | 
			
		||||
 | 
			
		||||
	/* Currently only two values can be used together. */
 | 
			
		||||
 | 
			
		||||
	val1 = ea_vals;
 | 
			
		||||
 | 
			
		||||
	if ((val2 = strchr(ea_vals, ','))) {
 | 
			
		||||
		*val2 = '\0';
 | 
			
		||||
		val2++;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (val1 && !_ea_option_value(val1, ea_service, ea_event, ea_on))
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	if (val2 && !_ea_option_value(val2, ea_service, ea_event, ea_on))
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	if (*ea_service && *ea_event) {
 | 
			
		||||
		log_error("Invalid --eventactivation options, service and event are incompatible.");
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -237,9 +237,4 @@ int lvremove_single(struct cmd_context *cmd, struct logical_volume *lv,
 | 
			
		||||
 | 
			
		||||
int get_lvt_enum(struct logical_volume *lv);
 | 
			
		||||
 | 
			
		||||
int get_event_activation_config_settings(struct cmd_context *cmd,
 | 
			
		||||
		int *service_only, int *event_only, int *service_to_event);
 | 
			
		||||
int get_event_activation_command_options(struct cmd_context *cmd,
 | 
			
		||||
		const char *ea, int *ea_service, int *ea_event, int *ea_on);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -226,8 +226,9 @@ int lvconvert_poll(struct cmd_context *cmd, struct logical_volume *lv, unsigned
 | 
			
		||||
int mirror_remove_missing(struct cmd_context *cmd,
 | 
			
		||||
			  struct logical_volume *lv, int force);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg,
 | 
			
		||||
                      activation_change_t activate, int vg_complete_to_activate);
 | 
			
		||||
		       activation_change_t activate);
 | 
			
		||||
 | 
			
		||||
int vgchange_background_polling(struct cmd_context *cmd, struct volume_group *vg);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										167
									
								
								tools/vgchange.c
									
									
									
									
									
								
							
							
						
						
									
										167
									
								
								tools/vgchange.c
									
									
									
									
									
								
							@@ -19,7 +19,6 @@
 | 
			
		||||
struct vgchange_params {
 | 
			
		||||
	int lock_start_count;
 | 
			
		||||
	unsigned int lock_start_sanlock : 1;
 | 
			
		||||
	unsigned int vg_complete_to_activate : 1;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
@@ -231,11 +230,10 @@ static int _online_pvid_file_create_all(struct cmd_context *cmd)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg,
 | 
			
		||||
		      activation_change_t activate, int vg_complete_to_activate)
 | 
			
		||||
		      activation_change_t activate)
 | 
			
		||||
{
 | 
			
		||||
	int lv_open, active, monitored = 0, r = 1;
 | 
			
		||||
	const struct lv_list *lvl;
 | 
			
		||||
	struct pv_list *pvl;
 | 
			
		||||
	int do_activate = is_change_activating(activate);
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
@@ -261,15 +259,6 @@ int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg,
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (do_activate && vg_complete_to_activate) {
 | 
			
		||||
		dm_list_iterate_items(pvl, &vg->pvs) {
 | 
			
		||||
			if (!pvl->pv->dev) {
 | 
			
		||||
				log_print("VG %s is incomplete.", vg->name);
 | 
			
		||||
				return 1;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Safe, since we never write out new metadata here. Required for
 | 
			
		||||
	 * partial activation to work.
 | 
			
		||||
@@ -698,7 +687,6 @@ static int _vgchange_single(struct cmd_context *cmd, const char *vg_name,
 | 
			
		||||
			    struct volume_group *vg,
 | 
			
		||||
			    struct processing_handle *handle)
 | 
			
		||||
{
 | 
			
		||||
	struct vgchange_params *vp = (struct vgchange_params *)handle->custom_handle;
 | 
			
		||||
	int ret = ECMD_PROCESSED;
 | 
			
		||||
	unsigned i;
 | 
			
		||||
	activation_change_t activate;
 | 
			
		||||
@@ -756,7 +744,7 @@ static int _vgchange_single(struct cmd_context *cmd, const char *vg_name,
 | 
			
		||||
 | 
			
		||||
	if (arg_is_set(cmd, activate_ARG)) {
 | 
			
		||||
		activate = (activation_change_t) arg_uint_value(cmd, activate_ARG, 0);
 | 
			
		||||
		if (!vgchange_activate(cmd, vg, activate, vp->vg_complete_to_activate))
 | 
			
		||||
		if (!vgchange_activate(cmd, vg, activate))
 | 
			
		||||
			return_ECMD_FAILED;
 | 
			
		||||
	} else if (arg_is_set(cmd, refresh_ARG)) {
 | 
			
		||||
		/* refreshes the visible LVs (which starts polling) */
 | 
			
		||||
@@ -777,114 +765,10 @@ static int _vgchange_single(struct cmd_context *cmd, const char *vg_name,
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _check_event_activation(struct cmd_context *cmd, struct vgchange_params *vp, int *skip_command, int *enable_events)
 | 
			
		||||
{
 | 
			
		||||
	const char *ea;
 | 
			
		||||
	int service_only = 0, event_only = 0, service_to_event = 0;
 | 
			
		||||
	int ea_service = 0, ea_event = 0, ea_on = 0;
 | 
			
		||||
	int on_file_exists;
 | 
			
		||||
	int event_activation;
 | 
			
		||||
 | 
			
		||||
	if (!(ea = arg_str_value(cmd, eventactivation_ARG, NULL))) {
 | 
			
		||||
		log_error("No eventactivation value.");
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* lvm.conf event_activation_options */
 | 
			
		||||
	if (!get_event_activation_config_settings(cmd, &service_only, &event_only, &service_to_event))
 | 
			
		||||
		return_0;
 | 
			
		||||
 | 
			
		||||
	/* --eventactivation values */
 | 
			
		||||
	if (!get_event_activation_command_options(cmd, ea, &ea_service, &ea_event, &ea_on))
 | 
			
		||||
		return_0;
 | 
			
		||||
 | 
			
		||||
	event_activation = find_config_tree_bool(cmd, global_event_activation_CFG, NULL);
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * The combination of lvm.conf event_activation/event_activation_options
 | 
			
		||||
	 * and the --eventactivation service|event value determines if this
 | 
			
		||||
	 * command should do anything or be skipped, along with the existence of
 | 
			
		||||
	 * the /run/lvm/event-activation-on file in case of service_to_event.
 | 
			
		||||
	 */
 | 
			
		||||
	if (!event_activation) {
 | 
			
		||||
		if (ea_event) {
 | 
			
		||||
			log_print("Skip vgchange for event and event_activation=0.");
 | 
			
		||||
			*skip_command = 1;
 | 
			
		||||
			return 1;
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		if (event_only && ea_service) {
 | 
			
		||||
			log_print("Skip vgchange for service and event_activation_options event_only.");
 | 
			
		||||
			*skip_command = 1;
 | 
			
		||||
			return 1;
 | 
			
		||||
		}
 | 
			
		||||
		if (service_only && ea_event) {
 | 
			
		||||
			log_print("Skip vgchange for event and event_activation_options service_only.");
 | 
			
		||||
			*skip_command = 1;
 | 
			
		||||
			return 1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		on_file_exists = event_activation_is_on(cmd);
 | 
			
		||||
 | 
			
		||||
		if (service_to_event && ea_service && on_file_exists) {
 | 
			
		||||
			log_print("Skip vgchange for service and event-activation-on.");
 | 
			
		||||
			*skip_command = 1;
 | 
			
		||||
			return 1;
 | 
			
		||||
		}
 | 
			
		||||
		if (service_to_event && ea_event && !on_file_exists) {
 | 
			
		||||
			log_print("Skip vgchange for event and no event-activation-on.");
 | 
			
		||||
			*skip_command = 1;
 | 
			
		||||
			return 1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Switch from service activation to event activation when:
 | 
			
		||||
	 * lvm.conf event_activation=1,
 | 
			
		||||
	 * event_activation_options=service_to_event,
 | 
			
		||||
	 * and --eventactivation service,on.
 | 
			
		||||
	 *
 | 
			
		||||
	 * When enabling event-based activation, first create the
 | 
			
		||||
	 * /run/lvm/event-activation-on file to tell other commands
 | 
			
		||||
	 * to begin responding to PV events and doing activation
 | 
			
		||||
	 * for newly completed VGs.  It also needs to create online
 | 
			
		||||
	 * files for existing PVs because some VGs may be incomplete
 | 
			
		||||
	 * at this point, and future pvscan commands need to
 | 
			
		||||
	 * find online files for PVs that have already appeared.
 | 
			
		||||
	 * The label scan provides info to know which PVs are
 | 
			
		||||
	 * present and should have pvid online files created.
 | 
			
		||||
	 *
 | 
			
		||||
	 * process_each_vg() usually begins with lock_global() and
 | 
			
		||||
	 * lvmcache_label_scan(), and then processes each VG.
 | 
			
		||||
	 * In this case, lock_global/lvmcache_label_scan are done
 | 
			
		||||
	 * before calling process_each_vg. This allows a special
 | 
			
		||||
	 * step to be inserted between the label scan and processing
 | 
			
		||||
	 * vgs. That step creates the pvid online files, which
 | 
			
		||||
	 * requires label scan info.  The lock_global and
 | 
			
		||||
	 * lvmcache_label_scan will be skipped by process_each_vg
 | 
			
		||||
	 * since they are already done here.
 | 
			
		||||
	 */
 | 
			
		||||
	if (event_activation && service_to_event && ea_service && ea_on) {
 | 
			
		||||
		if (!event_activation_enable(cmd))
 | 
			
		||||
			log_warn("WARNING: Failed to create event-activation-on.");
 | 
			
		||||
		*enable_events = 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * lvm.conf service_to_event, and vgchange -aay --eventactivation service,
 | 
			
		||||
	 * then only activate LVs if the VG is complete.
 | 
			
		||||
	 * A later event will complete the VG and activate it.
 | 
			
		||||
	 */
 | 
			
		||||
	if (event_activation && service_to_event && ea_service)
 | 
			
		||||
		vp->vg_complete_to_activate = 1;
 | 
			
		||||
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int vgchange(struct cmd_context *cmd, int argc, char **argv)
 | 
			
		||||
{
 | 
			
		||||
	struct vgchange_params vp = { 0 };
 | 
			
		||||
	struct processing_handle *handle;
 | 
			
		||||
	const char *ea;
 | 
			
		||||
	uint32_t flags = 0;
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
@@ -997,22 +881,37 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
 | 
			
		||||
			cmd->lockd_vg_enforce_sh = 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (arg_is_set(cmd, eventactivation_ARG)) {
 | 
			
		||||
		int skip_command = 0, enable_events = 0;
 | 
			
		||||
		if (!_check_event_activation(cmd, &vp, &skip_command, &enable_events))
 | 
			
		||||
			return ECMD_FAILED;
 | 
			
		||||
		if (skip_command)
 | 
			
		||||
			return ECMD_PROCESSED;
 | 
			
		||||
		if (enable_events) {
 | 
			
		||||
	/*
 | 
			
		||||
	 * When enabling event-based activation for pvscan, we first created
 | 
			
		||||
	 * the /run/lvm/event-activation-on file to tell pvscans to begin
 | 
			
		||||
	 * processing new PVs and doing activation for newly completed VGs.  We
 | 
			
		||||
	 * also need to create online files for existing PVs because some VGs
 | 
			
		||||
	 * may be incomplete at this point, and future pvscan commands need to
 | 
			
		||||
	 * find online files for PVs that have already appeared.  The label
 | 
			
		||||
	 * scan gives us the info to know which PVs are present and should have
 | 
			
		||||
	 * pvid online files created.
 | 
			
		||||
	 *
 | 
			
		||||
	 * process_each_vg() usually begins with lock_global() and
 | 
			
		||||
	 * lvmcache_label_scan(), and then processes each VG.  In this case,
 | 
			
		||||
	 * lock_global/lvmcache_label_scan are done before calling
 | 
			
		||||
	 * process_each_vg. This allows a special step to be inserted between
 | 
			
		||||
	 * the label scan and processing vgs. That step creates the pvid online
 | 
			
		||||
	 * files, which requires label scan info.  The lock_global and
 | 
			
		||||
	 * lvmcache_label_scan will be skipped by process_each_vg since they
 | 
			
		||||
	 * are already done here.
 | 
			
		||||
	 */
 | 
			
		||||
	if ((ea = arg_str_value(cmd, eventactivation_ARG, NULL)) && !strcmp(ea, "enable")) {
 | 
			
		||||
		if (!find_config_tree_bool(cmd, global_event_activation_CFG, NULL)) {
 | 
			
		||||
			log_print("Skip event activation enable for lvm.conf event_activation 0.");
 | 
			
		||||
		} else {
 | 
			
		||||
			if (!event_activation_enable(cmd))
 | 
			
		||||
				log_warn("WARNING: Failed to create event-activation-on.");
 | 
			
		||||
			/* The process_each_vg lock_global/lvmcache_label_scan will be skipped. */
 | 
			
		||||
			if (!lock_global(cmd, "sh"))
 | 
			
		||||
				return ECMD_FAILED;
 | 
			
		||||
			lvmcache_label_scan(cmd);
 | 
			
		||||
			_online_pvid_file_create_all(cmd);
 | 
			
		||||
			flags |= PROCESS_SKIP_SCAN;
 | 
			
		||||
				log_warn("WARNING: failed to enable event activation");
 | 
			
		||||
		}
 | 
			
		||||
		if (!lock_global(cmd, "sh"))
 | 
			
		||||
			return ECMD_FAILED;
 | 
			
		||||
		lvmcache_label_scan(cmd);
 | 
			
		||||
		_online_pvid_file_create_all(cmd);
 | 
			
		||||
		flags |= PROCESS_SKIP_SCAN;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (update)
 | 
			
		||||
@@ -1025,8 +924,6 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
 | 
			
		||||
		return ECMD_FAILED;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	handle->custom_handle = &vp;
 | 
			
		||||
 | 
			
		||||
	ret = process_each_vg(cmd, argc, argv, NULL, NULL, flags, 0, handle, &_vgchange_single);
 | 
			
		||||
 | 
			
		||||
	destroy_processing_handle(cmd, handle);
 | 
			
		||||
 
 | 
			
		||||
@@ -121,6 +121,6 @@ LABEL="direct_pvscan"
 | 
			
		||||
#  MD    |          |      X      |       X*       |                   |
 | 
			
		||||
#  loop  |          |      X      |       X*       |                   |
 | 
			
		||||
#  other |    X     |             |       X        |                   |   X
 | 
			
		||||
RUN+="(LVM_EXEC)/lvm pvscan --cache -aay --eventactivation event --major $major --minor $minor", ENV{LVM_SCANNED}="1"
 | 
			
		||||
RUN+="(LVM_EXEC)/lvm pvscan --background --cache --activate ay --eventactivation check --major $major --minor $minor", ENV{LVM_SCANNED}="1"
 | 
			
		||||
 | 
			
		||||
LABEL="lvm_end"
 | 
			
		||||
 
 | 
			
		||||
@@ -78,19 +78,9 @@ ENV{SYSTEMD_READY}="1"
 | 
			
		||||
#
 | 
			
		||||
# TODO: adjust the output of vgchange -aay so that
 | 
			
		||||
# it's better suited to appearing in the journal.
 | 
			
		||||
#
 | 
			
		||||
# "--eventactivation event" used with pvscan or vgchange
 | 
			
		||||
# tells the command that it is being run from an event.
 | 
			
		||||
# The command does nothing if lvm.conf event_activation=0.
 | 
			
		||||
# The command does nothing if lvm.conf event_activation=1,
 | 
			
		||||
# and lvm.conf event_activation_options="service_only".
 | 
			
		||||
# The command goes ahead if event_activation_options="event_only",
 | 
			
		||||
# or if event_activation_options="service_to_event" and the
 | 
			
		||||
# event-activation-on file exists.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
IMPORT{program}="(LVM_EXEC)/lvm pvscan --cache --listvg --checkcomplete --vgonline --eventactivation event --udevoutput --journal=output $env{DEVNAME}"
 | 
			
		||||
ENV{LVM_VG_NAME_COMPLETE}=="?*", RUN+="/usr/bin/systemd-run -r --no-block --property DefaultDependencies=no --unit lvm-activate-$env{LVM_VG_NAME_COMPLETE} lvm vgchange -aay --config devices/hints=pvs_online --eventactivation event $env{LVM_VG_NAME_COMPLETE}"
 | 
			
		||||
IMPORT{program}="(LVM_EXEC)/lvm pvscan --cache --listvg --checkcomplete --vgonline --eventactivation check --udevoutput --journal=output $env{DEVNAME}"
 | 
			
		||||
ENV{LVM_VG_NAME_COMPLETE}=="?*", RUN+="/usr/bin/systemd-run -r --no-block --property DefaultDependencies=no --unit lvm-activate-$env{LVM_VG_NAME_COMPLETE} lvm vgchange -aay --nohints $env{LVM_VG_NAME_COMPLETE}"
 | 
			
		||||
GOTO="lvm_end"
 | 
			
		||||
 | 
			
		||||
LABEL="lvm_end"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user