Re: [PATCH v2 2/4] fscrypt: update fscrypt_prepare_setflags() to use xflags
From: Amir Goldstein
Date: Fri Nov 27 2026 - 06:36:03 EST
On Thu, Nov 26, 2026 at 5:31 PM koraynilay <koray.fra@xxxxxxxxx> wrote:
>
> Update fscrypt_prepare_setflags() to use FS_XFLAG_* xflags instead of
> legacy FS_*_FL flags.
>
> Signed-off-by: koraynilay <koray.fra@xxxxxxxxx>
> ---
> fs/crypto/hooks.c | 10 +++++-----
> fs/file_attr.c | 2 +-
> include/linux/fscrypt.h | 6 +++---
> 3 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/fs/crypto/hooks.c b/fs/crypto/hooks.c
> index 149498bdab94..52d6a33fc9e9 100644
> --- a/fs/crypto/hooks.c
> +++ b/fs/crypto/hooks.c
> @@ -182,10 +182,10 @@ int __fscrypt_prepare_setattr(struct dentry *dentry, struct iattr *attr)
> EXPORT_SYMBOL_GPL(__fscrypt_prepare_setattr);
>
> /**
> - * fscrypt_prepare_setflags() - prepare to change flags with FS_IOC_SETFLAGS
> + * fscrypt_prepare_setflags() - prepare to change xflags
prepare to change the file attributes with file_setattr() or one of
the legacy ioctls
> * @inode: the inode on which flags are being changed
> - * @oldflags: the old flags
> - * @flags: the new flags
> + * @oldxflags: the old xflags
> + * @xflags: the new xflags
> *
> * The caller should be holding i_rwsem for write.
> *
> @@ -193,7 +193,7 @@ EXPORT_SYMBOL_GPL(__fscrypt_prepare_setattr);
> * another error occurs.
> */
> int fscrypt_prepare_setflags(struct inode *inode,
> - unsigned int oldflags, unsigned int flags)
> + unsigned int oldxflags, unsigned int xflags)
This here is a backporting landmine -
Changing the semantics drastically without changing the helper name
or signature.
Please rename the helper something like fscrypt_prepare_fileattr_set()
so that backporting mistakes will be caught at build time.
Thanks,
Amir.