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>