mirror of
https://github.com/torvalds/linux.git
synced 2026-10-23 15:32:04 +02:00
fs: port ->get_acl() to pass const mnt_idmap
Convert to const struct mnt_idmap. A mount's idmapping is immutable. The only thing that is allowed to be modified afterwards is the reference count and that is hidden behind mnt_idmap_get() and mnt_idmap_put(). Everything else only ever reads from the idmapping. This is the same model that struct cred uses and the idmapping is also rather sensitive. So make the idmap argument const wherever we can. The conversion is done from the bottom up so callers can continue to pass a non-const pointer to a const parameter until the conversion is finished. No functional changes. Link: https://patch.msgid.link/20260901-work-idmap-const-v1-16-54ccd48e100b@kernel.org Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Seth Forshee <sforshee@kernel.org> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
This commit is contained in:
parent
737362c701
commit
03a56ee341
|
|
@ -91,7 +91,7 @@ prototypes::
|
|||
int (*fileattr_set)(const struct mnt_idmap *idmap,
|
||||
struct dentry *dentry, struct file_kattr *fa);
|
||||
int (*fileattr_get)(struct dentry *dentry, struct file_kattr *fa);
|
||||
struct posix_acl * (*get_acl)(struct mnt_idmap *, struct dentry *, int);
|
||||
struct posix_acl * (*get_acl)(const struct mnt_idmap *, struct dentry *, int);
|
||||
struct offset_ctx *(*get_offset_ctx)(struct inode *inode);
|
||||
|
||||
locking rules:
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@ As of kernel 2.6.22, the following members are defined:
|
|||
int (*atomic_open)(struct inode *, struct dentry *, struct file *,
|
||||
unsigned open_flag, umode_t create_mode);
|
||||
int (*tmpfile) (struct mnt_idmap *, struct inode *, struct file *, umode_t);
|
||||
struct posix_acl * (*get_acl)(struct mnt_idmap *, struct dentry *, int);
|
||||
struct posix_acl * (*get_acl)(const struct mnt_idmap *, struct dentry *, int);
|
||||
int (*set_acl)(const struct mnt_idmap *, struct dentry *, struct posix_acl *, int);
|
||||
int (*fileattr_set)(const struct mnt_idmap *idmap,
|
||||
struct dentry *dentry, struct file_kattr *fa);
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ struct posix_acl *v9fs_iop_get_inode_acl(struct inode *inode, int type, bool rcu
|
|||
|
||||
}
|
||||
|
||||
struct posix_acl *v9fs_iop_get_acl(struct mnt_idmap *idmap,
|
||||
struct posix_acl *v9fs_iop_get_acl(const struct mnt_idmap *idmap,
|
||||
struct dentry *dentry, int type)
|
||||
{
|
||||
struct v9fs_session_info *v9ses;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
int v9fs_get_acl(struct inode *inode, struct p9_fid *fid);
|
||||
struct posix_acl *v9fs_iop_get_inode_acl(struct inode *inode, int type,
|
||||
bool rcu);
|
||||
struct posix_acl *v9fs_iop_get_acl(struct mnt_idmap *idmap,
|
||||
struct posix_acl *v9fs_iop_get_acl(const struct mnt_idmap *idmap,
|
||||
struct dentry *dentry, int type);
|
||||
int v9fs_iop_set_acl(const struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct posix_acl *acl, int type);
|
||||
|
|
|
|||
|
|
@ -1090,7 +1090,7 @@ static int ecryptfs_fileattr_set(const struct mnt_idmap *idmap,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static struct posix_acl *ecryptfs_get_acl(struct mnt_idmap *idmap,
|
||||
static struct posix_acl *ecryptfs_get_acl(const struct mnt_idmap *idmap,
|
||||
struct dentry *dentry, int type)
|
||||
{
|
||||
return vfs_get_acl(idmap, ecryptfs_dentry_to_lower(dentry),
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static inline bool fuse_no_acl(const struct fuse_conn *fc,
|
|||
return !fc->posix_acl && (i_user_ns(inode) != &init_user_ns);
|
||||
}
|
||||
|
||||
struct posix_acl *fuse_get_acl(struct mnt_idmap *idmap,
|
||||
struct posix_acl *fuse_get_acl(const struct mnt_idmap *idmap,
|
||||
struct dentry *dentry, int type)
|
||||
{
|
||||
struct inode *inode = d_inode(dentry);
|
||||
|
|
|
|||
|
|
@ -1205,7 +1205,7 @@ extern const struct xattr_handler * const fuse_xattr_handlers[];
|
|||
|
||||
struct posix_acl;
|
||||
struct posix_acl *fuse_get_inode_acl(struct inode *inode, int type, bool rcu);
|
||||
struct posix_acl *fuse_get_acl(struct mnt_idmap *idmap,
|
||||
struct posix_acl *fuse_get_acl(const struct mnt_idmap *idmap,
|
||||
struct dentry *dentry, int type);
|
||||
int fuse_set_acl(const struct mnt_idmap *, struct dentry *dentry,
|
||||
struct posix_acl *acl, int type);
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ int may_write_xattr(const struct mnt_idmap *idmap, struct inode *inode);
|
|||
#ifdef CONFIG_FS_POSIX_ACL
|
||||
int do_set_acl(const struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
const char *acl_name, const void *kvalue, size_t size);
|
||||
ssize_t do_get_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
ssize_t do_get_acl(const struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
const char *acl_name, void *kvalue, size_t size);
|
||||
#else
|
||||
static inline int do_set_acl(const struct mnt_idmap *idmap,
|
||||
|
|
@ -313,7 +313,7 @@ static inline int do_set_acl(const struct mnt_idmap *idmap,
|
|||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
static inline ssize_t do_get_acl(struct mnt_idmap *idmap,
|
||||
static inline ssize_t do_get_acl(const struct mnt_idmap *idmap,
|
||||
struct dentry *dentry, const char *acl_name,
|
||||
void *kvalue, size_t size)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -954,7 +954,7 @@ const struct xattr_handler * const ntfs_xattr_handlers[] = {
|
|||
// clang-format on
|
||||
|
||||
#ifdef CONFIG_NTFS_FS_POSIX_ACL
|
||||
struct posix_acl *ntfs_get_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct posix_acl *ntfs_get_acl(const struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
int type)
|
||||
{
|
||||
struct inode *inode = d_inode(dentry);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ int ntfs_ea_set_wsl_inode(struct inode *inode, dev_t rdev, __le16 *ea_size,
|
|||
ssize_t ntfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
|
||||
|
||||
#ifdef CONFIG_NTFS_FS_POSIX_ACL
|
||||
struct posix_acl *ntfs_get_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct posix_acl *ntfs_get_acl(const struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
int type);
|
||||
int ntfs_set_acl(const struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct posix_acl *acl, int type);
|
||||
|
|
|
|||
|
|
@ -963,7 +963,7 @@ unsigned long ntfs_names_hash(const u16 *name, size_t len, const u16 *upcase,
|
|||
|
||||
/* globals from xattr.c */
|
||||
#ifdef CONFIG_NTFS3_FS_POSIX_ACL
|
||||
struct posix_acl *ntfs_get_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct posix_acl *ntfs_get_acl(const struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
int type);
|
||||
int ntfs_set_acl(const struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct posix_acl *acl, int type);
|
||||
|
|
|
|||
|
|
@ -543,7 +543,7 @@ static noinline int ntfs_set_ea(struct inode *inode, const char *name,
|
|||
/*
|
||||
* ntfs_get_acl - inode_operations::get_acl
|
||||
*/
|
||||
struct posix_acl *ntfs_get_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct posix_acl *ntfs_get_acl(const struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
int type)
|
||||
{
|
||||
struct inode *inode = d_inode(dentry);
|
||||
|
|
|
|||
|
|
@ -814,7 +814,7 @@ static inline struct posix_acl *ovl_get_inode_acl(struct inode *inode, int type,
|
|||
{
|
||||
return do_ovl_get_acl(&nop_mnt_idmap, inode, type, rcu, true);
|
||||
}
|
||||
static inline struct posix_acl *ovl_get_acl(struct mnt_idmap *idmap,
|
||||
static inline struct posix_acl *ovl_get_acl(const struct mnt_idmap *idmap,
|
||||
struct dentry *dentry, int type)
|
||||
{
|
||||
return do_ovl_get_acl(idmap, d_inode(dentry), type, false, false);
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ void forget_all_cached_acls(struct inode *inode)
|
|||
}
|
||||
EXPORT_SYMBOL(forget_all_cached_acls);
|
||||
|
||||
static struct posix_acl *__get_acl(struct mnt_idmap *idmap,
|
||||
static struct posix_acl *__get_acl(const struct mnt_idmap *idmap,
|
||||
struct dentry *dentry, struct inode *inode,
|
||||
int type)
|
||||
{
|
||||
|
|
@ -1168,7 +1168,7 @@ EXPORT_SYMBOL_GPL(vfs_set_acl);
|
|||
*
|
||||
* Return: On success POSIX ACLs in VFS format, on error negative errno.
|
||||
*/
|
||||
struct posix_acl *vfs_get_acl(struct mnt_idmap *idmap,
|
||||
struct posix_acl *vfs_get_acl(const struct mnt_idmap *idmap,
|
||||
struct dentry *dentry, const char *acl_name)
|
||||
{
|
||||
struct inode *inode = d_inode(dentry);
|
||||
|
|
@ -1286,7 +1286,7 @@ int do_set_acl(const struct mnt_idmap *idmap, struct dentry *dentry,
|
|||
return error;
|
||||
}
|
||||
|
||||
ssize_t do_get_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
ssize_t do_get_acl(const struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
const char *acl_name, void *kvalue, size_t size)
|
||||
{
|
||||
ssize_t error;
|
||||
|
|
|
|||
|
|
@ -1867,7 +1867,7 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode,
|
|||
return rc;
|
||||
}
|
||||
|
||||
struct posix_acl *cifs_get_acl(struct mnt_idmap *idmap,
|
||||
struct posix_acl *cifs_get_acl(const struct mnt_idmap *idmap,
|
||||
struct dentry *dentry, int type)
|
||||
{
|
||||
#if defined(CONFIG_CIFS_ALLOW_INSECURE_LEGACY) && defined(CONFIG_CIFS_POSIX)
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ struct smb_ntsd *get_cifs_acl(struct cifs_sb_info *cifs_sb,
|
|||
struct smb_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
|
||||
const struct cifs_fid *cifsfid,
|
||||
u32 *pacllen, u32 info);
|
||||
struct posix_acl *cifs_get_acl(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct posix_acl *cifs_get_acl(const struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
int type);
|
||||
int cifs_set_acl(const struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct posix_acl *acl, int type);
|
||||
|
|
|
|||
|
|
@ -787,7 +787,7 @@ SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name,
|
|||
* Extended attribute GET operations
|
||||
*/
|
||||
static ssize_t
|
||||
do_getxattr(struct mnt_idmap *idmap, struct dentry *d,
|
||||
do_getxattr(const struct mnt_idmap *idmap, struct dentry *d,
|
||||
struct kernel_xattr_ctx *ctx)
|
||||
{
|
||||
ssize_t error;
|
||||
|
|
|
|||
|
|
@ -2026,7 +2026,7 @@ struct inode_operations {
|
|||
umode_t create_mode);
|
||||
int (*tmpfile) (struct mnt_idmap *, struct inode *,
|
||||
struct file *, umode_t);
|
||||
struct posix_acl *(*get_acl)(struct mnt_idmap *, struct dentry *,
|
||||
struct posix_acl *(*get_acl)(const struct mnt_idmap *, struct dentry *,
|
||||
int);
|
||||
int (*set_acl)(const struct mnt_idmap *, struct dentry *,
|
||||
struct posix_acl *, int);
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ static inline void cache_no_acl(struct inode *inode)
|
|||
|
||||
int vfs_set_acl(const struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
const char *acl_name, struct posix_acl *kacl);
|
||||
struct posix_acl *vfs_get_acl(struct mnt_idmap *idmap,
|
||||
struct posix_acl *vfs_get_acl(const struct mnt_idmap *idmap,
|
||||
struct dentry *dentry, const char *acl_name);
|
||||
int vfs_remove_acl(const struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
const char *acl_name);
|
||||
|
|
@ -148,7 +148,7 @@ static inline int vfs_set_acl(const struct mnt_idmap *idmap,
|
|||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline struct posix_acl *vfs_get_acl(struct mnt_idmap *idmap,
|
||||
static inline struct posix_acl *vfs_get_acl(const struct mnt_idmap *idmap,
|
||||
struct dentry *dentry,
|
||||
const char *acl_name)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user