]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
fscrypt: make "#define fscrypt_policy" user-only
authorEric Biggers <ebiggers@google.com>
Thu, 17 Sep 2020 04:11:33 +0000 (21:11 -0700)
committerEric Biggers <ebiggers@google.com>
Tue, 22 Sep 2020 13:48:44 +0000 (06:48 -0700)
commitc7f0207b613033c56b1217032d2f6326d0c69217
treef521e25c106fbf65d80541730febe15179edad84
parent9dad5feb49a5c3b99838b102555cdbedf244320a
fscrypt: make "#define fscrypt_policy" user-only

The fscrypt UAPI header defines fscrypt_policy to fscrypt_policy_v1,
for source compatibility with old userspace programs.

Internally, the kernel doesn't want that compatibility definition.
Instead, fscrypt_private.h #undefs it and re-defines it to a union.

That works for now.  However, in order to add
fscrypt_operations::get_dummy_policy(), we'll need to forward declare
'union fscrypt_policy' in include/linux/fscrypt.h.  That would cause
build errors because "fscrypt_policy" is used in ioctl numbers.

To avoid this, modify the UAPI header to make the fscrypt_policy
compatibility definition conditional on !__KERNEL__, and make the ioctls
use fscrypt_policy_v1 instead of fscrypt_policy.

Note that this doesn't change the actual ioctl numbers.

Acked-by: Jeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/20200917041136.178600-11-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
fs/crypto/fscrypt_private.h
include/uapi/linux/fscrypt.h