]> www.infradead.org Git - users/hch/xfsprogs.git/commit
xfs_io/encrypt: extend 'get_encpolicy' to support v2 policies
authorEric Biggers <ebiggers@google.com>
Mon, 30 Sep 2019 19:27:35 +0000 (15:27 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Mon, 30 Sep 2019 19:27:35 +0000 (15:27 -0400)
commitc304c84feb4fecc8b72768fc43d59a0d8dc8fdb3
treee832beeec5d93ac7263480bc2a3afa045382db19
parent7cde2c28cf0e3181f6c185cb5c767985e3a22173
xfs_io/encrypt: extend 'get_encpolicy' to support v2 policies

get_encpolicy uses the FS_IOC_GET_ENCRYPTION_POLICY ioctl to retrieve
the file's encryption policy, then displays it.  But that only works for
v1 encryption policies.  A new ioctl, FS_IOC_GET_ENCRYPTION_POLICY_EX,
has been introduced which is more flexible and can retrieve both v1 and
v2 encryption policies.

Make get_encpolicy use the new ioctl if the kernel supports it and
display the resulting the v1 or v2 encryption policy.  Otherwise, fall
back to the old ioctl and display the v1 policy.

Also add new options:

  -1: Use the old ioctl only.  This will be used to test the old ioctl
      even when the kernel supports the new one.

  -t: Test whether the new ioctl is supported.  This will be useful to
      determine whether v2 policies should be tested or not.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
io/encrypt.c
man/man8/xfs_io.8