Re: [RFC PATCH 1/7] common/encrypt: introduce helpers for set_encpolicy and get_encpolicy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 26, 2019 at 01:41:47PM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@xxxxxxxxxx>
> 
> For conciseness in tests, add helper functions that wrap the xfs_io
> commands 'set_encpolicy' and 'get_encpolicy'.  Then update all
> encryption tests to use them.
> 
> Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
> ---
>  common/encrypt        | 34 ++++++++++++++++++++++++++++++++--
>  tests/ext4/024        |  3 +--
>  tests/generic/395     | 28 +++++++++++++---------------
>  tests/generic/395.out |  2 +-
>  tests/generic/396     | 15 +++++++--------
>  tests/generic/397     |  3 +--
>  tests/generic/398     |  5 ++---
>  tests/generic/399     |  3 +--
>  tests/generic/419     |  3 +--
>  tests/generic/421     |  3 +--
>  tests/generic/429     |  3 +--
>  tests/generic/435     |  3 +--
>  tests/generic/440     |  5 ++---
>  13 files changed, 64 insertions(+), 46 deletions(-)
> 
> diff --git a/common/encrypt b/common/encrypt
> index 1b10aa71..54d873fa 100644
> --- a/common/encrypt
> +++ b/common/encrypt
> @@ -38,8 +38,7 @@ _require_scratch_encryption()
>  	# presence of /sys/fs/ext4/features/encryption, but this is broken on
>  	# some older kernels and is ext4-specific anyway.)
>  	mkdir $SCRATCH_MNT/tmpdir
> -	if $XFS_IO_PROG -c set_encpolicy $SCRATCH_MNT/tmpdir \
> -		2>&1 >>$seqres.full | \
> +	if _set_encpolicy $SCRATCH_MNT/tmpdir 2>&1 >>$seqres.full | \
>  		egrep -q 'Inappropriate ioctl for device|Operation not supported'
>  	then
>  		_notrun "kernel does not support $FSTYP encryption"
> @@ -175,3 +174,34 @@ _revoke_encryption_key()
>  	local keyid=$($KEYCTL_PROG search @s logon $FSTYP:$keydesc)
>  	$KEYCTL_PROG revoke $keyid >>$seqres.full
>  }
> +
> +# Set an encryption policy on the specified directory.
> +_set_encpolicy()
> +{
> +	local dir=$1
> +	shift
> +
> +	$XFS_IO_PROG -c "set_encpolicy $*" "$dir"
> +}
> +
> +_user_do_set_encpolicy()
> +{
> +	local dir=$1
> +	shift
> +
> +	_user_do "$XFS_IO_PROG -c \"set_encpolicy $*\" \"$dir\""
> +}
> +
> +_require_get_encpolicy()
> +{
> +	_require_xfs_io_command "get_encpolicy"
> +}

This doesn't seem necessary to me, just calling

_require_xfs_io_command "get_encpolicy"

explicitly is fine to me.

Thanks,
Eryu



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux