#include <linux/kernel.h>
#include <linux/bio.h>
#include <linux/file.h>
#include <linux/fs.h>
#include <linux/fsnotify.h>
#include <linux/pagemap.h>
#include <linux/highmem.h>
#include <linux/time.h>
#include <linux/string.h>
#include <linux/backing-dev.h>
#include <linux/mount.h>
#include <linux/namei.h>
#include <linux/writeback.h>
#include <linux/compat.h>
#include <linux/security.h>
#include <linux/xattr.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/blkdev.h>
#include <linux/uuid.h>
#include <linux/btrfs.h>
#include <linux/uaccess.h>
#include <linux/iversion.h>
#include <linux/fileattr.h>
#include <linux/fsverity.h>
#include <linux/sched/xacct.h>
#include "ctree.h"
#include "disk-io.h"
#include "export.h"
#include "transaction.h"
#include "btrfs_inode.h"
#include "volumes.h"
#include "locking.h"
#include "backref.h"
#include "send.h"
#include "dev-replace.h"
#include "props.h"
#include "sysfs.h"
#include "qgroup.h"
#include "tree-log.h"
#include "compression.h"
#include "space-info.h"
#include "block-group.h"
#include "fs.h"
#include "accessors.h"
#include "extent-tree.h"
#include "root-tree.h"
#include "defrag.h"
#include "dir-item.h"
#include "uuid-tree.h"
#include "ioctl.h"
#include "file.h"
#include "scrub.h"
#include "super.h"
#ifdef CONFIG_64BIT
struct btrfs_ioctl_timespec_32 { … } __attribute__ ((packed));
struct btrfs_ioctl_received_subvol_args_32 { … } __attribute__ ((packed));
#define BTRFS_IOC_SET_RECEIVED_SUBVOL_32 …
#endif
#if defined(CONFIG_64BIT) && defined(CONFIG_COMPAT)
struct btrfs_ioctl_send_args_32 { … } __attribute__ ((packed));
#define BTRFS_IOC_SEND_32 …
struct btrfs_ioctl_encoded_io_args_32 { … };
#define BTRFS_IOC_ENCODED_READ_32 …
#define BTRFS_IOC_ENCODED_WRITE_32 …
#endif
static unsigned int btrfs_mask_fsflags_for_type(struct inode *inode,
unsigned int flags)
{ … }
static unsigned int btrfs_inode_flags_to_fsflags(struct btrfs_inode *binode)
{ … }
void btrfs_sync_inode_flags_to_i_flags(struct inode *inode)
{ … }
static int check_fsflags(unsigned int old_flags, unsigned int flags)
{ … }
static int check_fsflags_compatible(struct btrfs_fs_info *fs_info,
unsigned int flags)
{ … }
int btrfs_check_ioctl_vol_args_path(const struct btrfs_ioctl_vol_args *vol_args)
{ … }
static int btrfs_check_ioctl_vol_args2_subvol_name(const struct btrfs_ioctl_vol_args_v2 *vol_args2)
{ … }
int btrfs_fileattr_get(struct dentry *dentry, struct fileattr *fa)
{ … }
int btrfs_fileattr_set(struct mnt_idmap *idmap,
struct dentry *dentry, struct fileattr *fa)
{ … }
bool btrfs_exclop_start(struct btrfs_fs_info *fs_info,
enum btrfs_exclusive_operation type)
{ … }
bool btrfs_exclop_start_try_lock(struct btrfs_fs_info *fs_info,
enum btrfs_exclusive_operation type)
{ … }
void btrfs_exclop_start_unlock(struct btrfs_fs_info *fs_info)
{ … }
void btrfs_exclop_finish(struct btrfs_fs_info *fs_info)
{ … }
void btrfs_exclop_balance(struct btrfs_fs_info *fs_info,
enum btrfs_exclusive_operation op)
{ … }
static int btrfs_ioctl_getversion(struct inode *inode, int __user *arg)
{ … }
static noinline int btrfs_ioctl_fitrim(struct btrfs_fs_info *fs_info,
void __user *arg)
{ … }
int __pure btrfs_is_empty_uuid(const u8 *uuid)
{ … }
static unsigned int create_subvol_num_items(struct btrfs_qgroup_inherit *inherit)
{ … }
static noinline int create_subvol(struct mnt_idmap *idmap,
struct inode *dir, struct dentry *dentry,
struct btrfs_qgroup_inherit *inherit)
{ … }
static int create_snapshot(struct btrfs_root *root, struct inode *dir,
struct dentry *dentry, bool readonly,
struct btrfs_qgroup_inherit *inherit)
{ … }
static int btrfs_may_delete(struct mnt_idmap *idmap,
struct inode *dir, struct dentry *victim, int isdir)
{ … }
static inline int btrfs_may_create(struct mnt_idmap *idmap,
struct inode *dir, struct dentry *child)
{ … }
static noinline int btrfs_mksubvol(const struct path *parent,
struct mnt_idmap *idmap,
const char *name, int namelen,
struct btrfs_root *snap_src,
bool readonly,
struct btrfs_qgroup_inherit *inherit)
{ … }
static noinline int btrfs_mksnapshot(const struct path *parent,
struct mnt_idmap *idmap,
const char *name, int namelen,
struct btrfs_root *root,
bool readonly,
struct btrfs_qgroup_inherit *inherit)
{ … }
static int exclop_start_or_cancel_reloc(struct btrfs_fs_info *fs_info,
enum btrfs_exclusive_operation type, bool cancel)
{ … }
static noinline int btrfs_ioctl_resize(struct file *file,
void __user *arg)
{ … }
static noinline int __btrfs_ioctl_snap_create(struct file *file,
struct mnt_idmap *idmap,
const char *name, unsigned long fd, int subvol,
bool readonly,
struct btrfs_qgroup_inherit *inherit)
{ … }
static noinline int btrfs_ioctl_snap_create(struct file *file,
void __user *arg, int subvol)
{ … }
static noinline int btrfs_ioctl_snap_create_v2(struct file *file,
void __user *arg, int subvol)
{ … }
static noinline int btrfs_ioctl_subvol_getflags(struct inode *inode,
void __user *arg)
{ … }
static noinline int btrfs_ioctl_subvol_setflags(struct file *file,
void __user *arg)
{ … }
static noinline int key_in_sk(struct btrfs_key *key,
struct btrfs_ioctl_search_key *sk)
{ … }
static noinline int copy_to_sk(struct btrfs_path *path,
struct btrfs_key *key,
struct btrfs_ioctl_search_key *sk,
u64 *buf_size,
char __user *ubuf,
unsigned long *sk_offset,
int *num_found)
{ … }
static noinline int search_ioctl(struct inode *inode,
struct btrfs_ioctl_search_key *sk,
u64 *buf_size,
char __user *ubuf)
{ … }
static noinline int btrfs_ioctl_tree_search(struct inode *inode,
void __user *argp)
{ … }
static noinline int btrfs_ioctl_tree_search_v2(struct inode *inode,
void __user *argp)
{ … }
static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info,
u64 tree_id, u64 dirid, char *name)
{ … }
static int btrfs_search_path_in_tree_user(struct mnt_idmap *idmap,
struct inode *inode,
struct btrfs_ioctl_ino_lookup_user_args *args)
{ … }
static noinline int btrfs_ioctl_ino_lookup(struct btrfs_root *root,
void __user *argp)
{ … }
static int btrfs_ioctl_ino_lookup_user(struct file *file, void __user *argp)
{ … }
static int btrfs_ioctl_get_subvol_info(struct inode *inode, void __user *argp)
{ … }
static int btrfs_ioctl_get_subvol_rootref(struct btrfs_root *root,
void __user *argp)
{ … }
static noinline int btrfs_ioctl_snap_destroy(struct file *file,
void __user *arg,
bool destroy_v2)
{ … }
static int btrfs_ioctl_defrag(struct file *file, void __user *argp)
{ … }
static long btrfs_ioctl_add_dev(struct btrfs_fs_info *fs_info, void __user *arg)
{ … }
static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg)
{ … }
static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg)
{ … }
static long btrfs_ioctl_fs_info(struct btrfs_fs_info *fs_info,
void __user *arg)
{ … }
static long btrfs_ioctl_dev_info(struct btrfs_fs_info *fs_info,
void __user *arg)
{ … }
static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
{ … }
static void get_block_group_info(struct list_head *groups_list,
struct btrfs_ioctl_space_info *space)
{ … }
static long btrfs_ioctl_space_info(struct btrfs_fs_info *fs_info,
void __user *arg)
{ … }
static noinline long btrfs_ioctl_start_sync(struct btrfs_root *root,
void __user *argp)
{ … }
static noinline long btrfs_ioctl_wait_sync(struct btrfs_fs_info *fs_info,
void __user *argp)
{ … }
static long btrfs_ioctl_scrub(struct file *file, void __user *arg)
{ … }
static long btrfs_ioctl_scrub_cancel(struct btrfs_fs_info *fs_info)
{ … }
static long btrfs_ioctl_scrub_progress(struct btrfs_fs_info *fs_info,
void __user *arg)
{ … }
static long btrfs_ioctl_get_dev_stats(struct btrfs_fs_info *fs_info,
void __user *arg)
{ … }
static long btrfs_ioctl_dev_replace(struct btrfs_fs_info *fs_info,
void __user *arg)
{ … }
static long btrfs_ioctl_ino_to_path(struct btrfs_root *root, void __user *arg)
{ … }
static long btrfs_ioctl_logical_to_ino(struct btrfs_fs_info *fs_info,
void __user *arg, int version)
{ … }
void btrfs_update_ioctl_balance_args(struct btrfs_fs_info *fs_info,
struct btrfs_ioctl_balance_args *bargs)
{ … }
static int btrfs_try_lock_balance(struct btrfs_fs_info *fs_info, bool *excl_acquired)
{ … }
static long btrfs_ioctl_balance(struct file *file, void __user *arg)
{ … }
static long btrfs_ioctl_balance_ctl(struct btrfs_fs_info *fs_info, int cmd)
{ … }
static long btrfs_ioctl_balance_progress(struct btrfs_fs_info *fs_info,
void __user *arg)
{ … }
static long btrfs_ioctl_quota_ctl(struct file *file, void __user *arg)
{ … }
static bool qgroup_enabled(struct btrfs_fs_info *fs_info)
{ … }
static long btrfs_ioctl_qgroup_assign(struct file *file, void __user *arg)
{ … }
static long btrfs_ioctl_qgroup_create(struct file *file, void __user *arg)
{ … }
static long btrfs_ioctl_qgroup_limit(struct file *file, void __user *arg)
{ … }
static long btrfs_ioctl_quota_rescan(struct file *file, void __user *arg)
{ … }
static long btrfs_ioctl_quota_rescan_status(struct btrfs_fs_info *fs_info,
void __user *arg)
{ … }
static long btrfs_ioctl_quota_rescan_wait(struct btrfs_fs_info *fs_info,
void __user *arg)
{ … }
static long _btrfs_ioctl_set_received_subvol(struct file *file,
struct mnt_idmap *idmap,
struct btrfs_ioctl_received_subvol_args *sa)
{ … }
#ifdef CONFIG_64BIT
static long btrfs_ioctl_set_received_subvol_32(struct file *file,
void __user *arg)
{ … }
#endif
static long btrfs_ioctl_set_received_subvol(struct file *file,
void __user *arg)
{ … }
static int btrfs_ioctl_get_fslabel(struct btrfs_fs_info *fs_info,
void __user *arg)
{ … }
static int btrfs_ioctl_set_fslabel(struct file *file, void __user *arg)
{ … }
#define INIT_FEATURE_FLAGS(suffix) …
int btrfs_ioctl_get_supported_features(void __user *arg)
{ … }
static int btrfs_ioctl_get_features(struct btrfs_fs_info *fs_info,
void __user *arg)
{ … }
static int check_feature_bits(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)
{ … }
#define check_feature(fs_info, change_mask, flags, mask_base) …
static int btrfs_ioctl_set_features(struct file *file, void __user *arg)
{ … }
static int _btrfs_ioctl_send(struct btrfs_inode *inode, void __user *argp, bool compat)
{ … }
static int btrfs_ioctl_encoded_read(struct file *file, void __user *argp,
bool compat)
{ … }
static int btrfs_ioctl_encoded_write(struct file *file, void __user *argp, bool compat)
{ … }
long btrfs_ioctl(struct file *file, unsigned int
cmd, unsigned long arg)
{ … }
#ifdef CONFIG_COMPAT
long btrfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ … }
#endif