btrfs: parameter constification in ioctl.c

Add const to function parameters that are not changed.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2025-03-03 15:55:15 +01:00
parent 306a75e647
commit 5e54f9420f

View File

@ -118,8 +118,8 @@ struct btrfs_ioctl_encoded_io_args_32 {
#endif
/* Mask out flags that are inappropriate for the given type of inode. */
static unsigned int btrfs_mask_fsflags_for_type(struct inode *inode,
unsigned int flags)
static unsigned int btrfs_mask_fsflags_for_type(const struct inode *inode,
unsigned int flags)
{
if (S_ISDIR(inode->i_mode))
return flags;
@ -133,7 +133,7 @@ static unsigned int btrfs_mask_fsflags_for_type(struct inode *inode,
* Export internal inode flags to the format expected by the FS_IOC_GETFLAGS
* ioctl.
*/
static unsigned int btrfs_inode_flags_to_fsflags(struct btrfs_inode *binode)
static unsigned int btrfs_inode_flags_to_fsflags(const struct btrfs_inode *binode)
{
unsigned int iflags = 0;
u32 flags = binode->flags;
@ -219,7 +219,7 @@ static int check_fsflags(unsigned int old_flags, unsigned int flags)
return 0;
}
static int check_fsflags_compatible(struct btrfs_fs_info *fs_info,
static int check_fsflags_compatible(const struct btrfs_fs_info *fs_info,
unsigned int flags)
{
if (btrfs_is_zoned(fs_info) && (flags & FS_NOCOW_FL))
@ -248,7 +248,7 @@ static int btrfs_check_ioctl_vol_args2_subvol_name(const struct btrfs_ioctl_vol_
*/
int btrfs_fileattr_get(struct dentry *dentry, struct fileattr *fa)
{
struct btrfs_inode *binode = BTRFS_I(d_inode(dentry));
const struct btrfs_inode *binode = BTRFS_I(d_inode(dentry));
fileattr_fill_flags(fa, btrfs_inode_flags_to_fsflags(binode));
return 0;
@ -404,7 +404,7 @@ update_flags:
return ret;
}
static int btrfs_ioctl_getversion(struct inode *inode, int __user *arg)
static int btrfs_ioctl_getversion(const struct inode *inode, int __user *arg)
{
return put_user(inode->i_generation, arg);
}
@ -476,7 +476,7 @@ static noinline int btrfs_ioctl_fitrim(struct btrfs_fs_info *fs_info,
* Calculate the number of transaction items to reserve for creating a subvolume
* or snapshot, not including the inode, directory entries, or parent directory.
*/
static unsigned int create_subvol_num_items(struct btrfs_qgroup_inherit *inherit)
static unsigned int create_subvol_num_items(const struct btrfs_qgroup_inherit *inherit)
{
/*
* 1 to add root block
@ -879,7 +879,7 @@ static int btrfs_may_delete(struct mnt_idmap *idmap,
/* copy of may_create in fs/namei.c() */
static inline int btrfs_may_create(struct mnt_idmap *idmap,
struct inode *dir, struct dentry *child)
struct inode *dir, const struct dentry *child)
{
if (d_really_is_positive(child))
return -EEXIST;
@ -1448,8 +1448,8 @@ out:
return ret;
}
static noinline int key_in_sk(struct btrfs_key *key,
struct btrfs_ioctl_search_key *sk)
static noinline int key_in_sk(const struct btrfs_key *key,
const struct btrfs_ioctl_search_key *sk)
{
struct btrfs_key test;
int ret;
@ -1474,7 +1474,7 @@ static noinline int key_in_sk(struct btrfs_key *key,
static noinline int copy_to_sk(struct btrfs_path *path,
struct btrfs_key *key,
struct btrfs_ioctl_search_key *sk,
const struct btrfs_ioctl_search_key *sk,
u64 *buf_size,
char __user *ubuf,
unsigned long *sk_offset,
@ -2764,7 +2764,7 @@ out_free:
return ret;
}
static long btrfs_ioctl_fs_info(struct btrfs_fs_info *fs_info,
static long btrfs_ioctl_fs_info(const struct btrfs_fs_info *fs_info,
void __user *arg)
{
struct btrfs_ioctl_fs_info_args *fi_args;
@ -2818,7 +2818,7 @@ static long btrfs_ioctl_fs_info(struct btrfs_fs_info *fs_info,
return ret;
}
static long btrfs_ioctl_dev_info(struct btrfs_fs_info *fs_info,
static long btrfs_ioctl_dev_info(const struct btrfs_fs_info *fs_info,
void __user *arg)
{
BTRFS_DEV_LOOKUP_ARGS(args);
@ -4249,7 +4249,7 @@ static int btrfs_ioctl_get_features(struct btrfs_fs_info *fs_info,
return 0;
}
static int check_feature_bits(struct btrfs_fs_info *fs_info,
static int check_feature_bits(const struct btrfs_fs_info *fs_info,
enum btrfs_feature_set set,
u64 change_mask, u64 flags, u64 supported_flags,
u64 safe_set, u64 safe_clear)