On Tue 01-09-26 14:14:34, Christian Brauner wrote:
> 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.
> 
> Signed-off-by: Christian Brauner (Amutable) <[email protected]>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <[email protected]>

                                                                Honza

> ---
>  fs/btrfs/ioctl.c   | 2 +-
>  fs/ext4/ioctl.c    | 2 +-
>  fs/inode.c         | 2 +-
>  include/linux/fs.h | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index 72bc9d4f7708..b34c6a8247e4 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -3886,7 +3886,7 @@ static long btrfs_ioctl_quota_rescan_wait(struct 
> btrfs_fs_info *fs_info)
>  }
>  
>  static long _btrfs_ioctl_set_received_subvol(struct file *file,
> -                                         struct mnt_idmap *idmap,
> +                                         const struct mnt_idmap *idmap,
>                                           struct 
> btrfs_ioctl_received_subvol_args *sa)
>  {
>       struct inode *inode = file_inode(file);
> diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
> index c8387e6a2c6e..6de77da4203c 100644
> --- a/fs/ext4/ioctl.c
> +++ b/fs/ext4/ioctl.c
> @@ -373,7 +373,7 @@ void ext4_reset_inode_seed(struct inode *inode)
>   *
>   */
>  static long swap_inode_boot_loader(struct super_block *sb,
> -                             struct mnt_idmap *idmap,
> +                             const struct mnt_idmap *idmap,
>                               struct inode *inode)
>  {
>       handle_t *handle;
> diff --git a/fs/inode.c b/fs/inode.c
> index 72a8bbe38d62..4313e9735c5c 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -2746,7 +2746,7 @@ EXPORT_SYMBOL(inode_init_owner);
>   * On non-idmapped mounts or if permission checking is to be performed on the
>   * raw inode simply pass @nop_mnt_idmap.
>   */
> -bool inode_owner_or_capable(struct mnt_idmap *idmap,
> +bool inode_owner_or_capable(const struct mnt_idmap *idmap,
>                           const struct inode *inode)
>  {
>       vfsuid_t vfsuid;
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 7c82d7aaa775..e2babddf755d 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -1755,7 +1755,7 @@ static inline bool file_write_not_started(const struct 
> file *file)
>       return sb_write_not_started(file_inode(file)->i_sb);
>  }
>  
> -bool inode_owner_or_capable(struct mnt_idmap *idmap,
> +bool inode_owner_or_capable(const struct mnt_idmap *idmap,
>                           const struct inode *inode);
>  
>  /*
> 
> -- 
> 2.53.0
> 
-- 
Jan Kara <[email protected]>
SUSE Labs, CR

Reply via email to