From df8ff1f761cf37a3968f4709b5bb7f543a8f258b Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 9 Oct 2020 09:23:09 +0200 Subject: [slx-dmsetup] Minor cleanup --- modules.d/slx-dmsetup/scripts/dmsetup-slx-device | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'modules.d') diff --git a/modules.d/slx-dmsetup/scripts/dmsetup-slx-device b/modules.d/slx-dmsetup/scripts/dmsetup-slx-device index dffc203c..9926951f 100755 --- a/modules.d/slx-dmsetup/scripts/dmsetup-slx-device +++ b/modules.d/slx-dmsetup/scripts/dmsetup-slx-device @@ -135,6 +135,7 @@ dmsetup_create_noudevsync() { # encrypt_device [] encrypt_device() { + # TODO: Send key back to us, demand ransom modprobe dm-crypt || echo "$0: dm-crypt loading failed, maybe builtin?" [ -b "$1" ] || return 1 [ -n "$2" ] || return 1 @@ -169,7 +170,7 @@ ramdisk_fallback() { echo "$0: Falling back to regular dm-snapshot on a RAMdisk." # RAM size in kb, note that this is equal to half - # of the entire RAM in 512-bytes sectors. + # of the entire RAM when interpreted as 512-bytes sectors. local ram_cow_sz="$(awk '/^MemTotal:/ { printf("%d\n", $2 ); exit }' /proc/meminfo)" # try to prepare the zero extension device @@ -177,10 +178,9 @@ ramdisk_fallback() { ( set -e lsmod | grep -q dm-zero || modprobe dm-zero - dmsetup_create_noudevsync zero "0 $ram_cow_sz zero" dmsetup_create_noudevsync "${extended_device##*/}" \ "0 $read_only_device_sz linear $read_only_device 0 - $read_only_device_sz $ram_cow_sz linear /dev/mapper/zero 0" + $read_only_device_sz $ram_cow_sz zero" ) if [ "$?" -eq 0 ]; then read_only_device="$extended_device" @@ -330,7 +330,6 @@ declare -g scratch_device="$writable_device" declare -gi scratch_device_sz=0 if (( min <= writable_device_sz )); then scratch_device_sz="$max" - (( scratch_device_sz < min )) && scratch_device_sz="$min" (( scratch_device_sz > writable_device_sz )) && scratch_device_sz="$writable_device_sz" else # minimum snapshot size is bigger than physical device size -- cgit v1.2.3-55-g7522