#ifndef _LINUX_FS_SUPER_TYPES_H
#define _LINUX_FS_SUPER_TYPES_H
#include <linux/fs_dirent.h>
#include <linux/errseq.h>
#include <linux/list_lru.h>
#include <linux/list.h>
#include <linux/list_bl.h>
#include <linux/llist.h>
#include <linux/uidgid.h>
#include <linux/uuid.h>
#include <linux/percpu-rwsem.h>
#include <linux/workqueue_types.h>
#include <linux/quota.h>
struct backing_dev_info;
struct block_device;
struct dentry;
struct dentry_operations;
struct dquot_operations;
struct export_operations;
struct file;
struct file_system_type;
struct fscrypt_operations;
struct fsnotify_sb_info;
struct fsverity_operations;
struct kstatfs;
struct mount;
struct mtd_info;
struct quotactl_ops;
struct shrinker;
struct unicode_map;
struct user_namespace;
struct workqueue_struct;
struct writeback_control;
struct xattr_handler;
struct fserror_event;
extern struct super_block *blockdev_superblock;
enum {
SB_UNFROZEN = 0,
SB_FREEZE_WRITE = 1,
SB_FREEZE_PAGEFAULT = 2,
SB_FREEZE_FS = 3,
SB_FREEZE_COMPLETE = 4,
};
#define SB_FREEZE_LEVELS (SB_FREEZE_COMPLETE - 1)
struct sb_writers {
unsigned short frozen;
int freeze_kcount;
int freeze_ucount;
const void *freeze_owner;
struct percpu_rw_semaphore rw_sem[SB_FREEZE_LEVELS];
};
enum freeze_holder {
FREEZE_HOLDER_KERNEL = (1U << 0),
FREEZE_HOLDER_USERSPACE = (1U << 1),
FREEZE_MAY_NEST = (1U << 2),
FREEZE_EXCL = (1U << 3),
};
struct super_operations {
struct inode *(*alloc_inode)(struct super_block *sb);
void (*destroy_inode)(struct inode *inode);
void (*free_inode)(struct inode *inode);
void (*dirty_inode)(struct inode *inode, int flags);
int (*write_inode)(struct inode *inode, struct writeback_control *wbc);
int (*drop_inode)(struct inode *inode);
void (*evict_inode)(struct inode *inode);
void (*put_super)(struct super_block *sb);
int (*sync_fs)(struct super_block *sb, int wait);
int (*freeze_super)(struct super_block *sb, enum freeze_holder who,
const void *owner);
int (*freeze_fs)(struct super_block *sb);
int (*thaw_super)(struct super_block *sb, enum freeze_holder who,
const void *owner);
int (*unfreeze_fs)(struct super_block *sb);
int (*statfs)(struct dentry *dentry, struct kstatfs *kstatfs);
void (*umount_begin)(struct super_block *sb);
int (*show_options)(struct seq_file *seq, struct dentry *dentry);
int (*show_devname)(struct seq_file *seq, struct dentry *dentry);
int (*show_path)(struct seq_file *seq, struct dentry *dentry);
int (*show_stats)(struct seq_file *seq, struct dentry *dentry);
#ifdef CONFIG_QUOTA
ssize_t (*quota_read)(struct super_block *sb, int type, char *data,
size_t len, loff_t off);
ssize_t (*quota_write)(struct super_block *sb, int type,
const char *data, size_t len, loff_t off);
struct dquot __rcu **(*get_dquots)(struct inode *inode);
#endif
long (*nr_cached_objects)(struct super_block *sb,
struct shrink_control *sc);
long (*free_cached_objects)(struct super_block *sb,
struct shrink_control *sc);
int (*remove_bdev)(struct super_block *sb, struct block_device *bdev);
void (*shutdown)(struct super_block *sb);
void (*report_error)(const struct fserror_event *event);
};
struct super_block {
struct list_head s_list;
dev_t s_dev;
unsigned char s_blocksize_bits;
unsigned long s_blocksize;
loff_t s_maxbytes;
struct file_system_type *s_type;
const struct super_operations *s_op;
const struct dquot_operations *dq_op;
const struct quotactl_ops *s_qcop;
const struct export_operations *s_export_op;
unsigned long s_flags;
unsigned long s_iflags;
unsigned long s_magic;
struct dentry *s_root;
struct rw_semaphore s_umount;
int s_count;
atomic_t s_active;
#ifdef CONFIG_SECURITY
void *s_security;
#endif
const struct xattr_handler *const *s_xattr;
#ifdef CONFIG_FS_ENCRYPTION
const struct fscrypt_operations *s_cop;
struct fscrypt_keyring *s_master_keys;
#endif
#ifdef CONFIG_FS_VERITY
const struct fsverity_operations *s_vop;
#endif
#if IS_ENABLED(CONFIG_UNICODE)
struct unicode_map *s_encoding;
__u16 s_encoding_flags;
#endif
struct hlist_bl_head s_roots;
struct mount *s_mounts;
struct block_device *s_bdev;
struct file *s_bdev_file;
struct backing_dev_info *s_bdi;
struct mtd_info *s_mtd;
struct hlist_node s_instances;
unsigned int s_quota_types;
struct quota_info s_dquot;
struct sb_writers s_writers;
void *s_fs_info;
u32 s_time_gran;
time64_t s_time_min;
time64_t s_time_max;
#ifdef CONFIG_FSNOTIFY
u32 s_fsnotify_mask;
struct fsnotify_sb_info *s_fsnotify_info;
#endif
char s_id[32];
uuid_t s_uuid;
u8 s_uuid_len;
char s_sysfs_name[UUID_STRING_LEN + 1];
unsigned int s_max_links;
unsigned int s_d_flags;
struct mutex s_vfs_rename_mutex;
const char *s_subtype;
const struct dentry_operations *__s_d_op;
struct shrinker *s_shrink;
atomic_long_t s_remove_count;
int s_readonly_remount;
errseq_t s_wb_err;
struct workqueue_struct *s_dio_done_wq;
struct hlist_head s_pins;
struct user_namespace *s_user_ns;
struct list_lru s_dentry_lru;
struct list_lru s_inode_lru;
struct rcu_head rcu;
struct work_struct destroy_work;
struct mutex s_sync_lock;
int s_stack_depth;
spinlock_t s_inode_list_lock ____cacheline_aligned_in_smp;
struct list_head s_inodes;
spinlock_t s_inode_wblist_lock;
struct list_head s_inodes_wb;
long s_min_writeback_pages;
refcount_t s_pending_errors;
} __randomize_layout;
#define SB_RDONLY BIT(0)
#define SB_NOSUID BIT(1)
#define SB_NODEV BIT(2)
#define SB_NOEXEC BIT(3)
#define SB_SYNCHRONOUS BIT(4)
#define SB_MANDLOCK BIT(6)
#define SB_DIRSYNC BIT(7)
#define SB_NOATIME BIT(10)
#define SB_NODIRATIME BIT(11)
#define SB_SILENT BIT(15)
#define SB_POSIXACL BIT(16)
#define SB_INLINECRYPT BIT(17)
#define SB_KERNMOUNT BIT(22)
#define SB_I_VERSION BIT(23)
#define SB_LAZYTIME BIT(25)
#define SB_DEAD BIT(21)
#define SB_DYING BIT(24)
#define SB_FORCE BIT(27)
#define SB_NOSEC BIT(28)
#define SB_BORN BIT(29)
#define SB_ACTIVE BIT(30)
#define SB_NOUSER BIT(31)
#define SB_ENC_STRICT_MODE_FL (1 << 0)
#define SB_ENC_NO_COMPAT_FALLBACK_FL (1 << 1)
#define sb_has_strict_encoding(sb) \
(sb->s_encoding_flags & SB_ENC_STRICT_MODE_FL)
#if IS_ENABLED(CONFIG_UNICODE)
#define sb_no_casefold_compat_fallback(sb) \
(sb->s_encoding_flags & SB_ENC_NO_COMPAT_FALLBACK_FL)
#else
#define sb_no_casefold_compat_fallback(sb) (1)
#endif
#define SB_I_CGROUPWB 0x00000001
#define SB_I_NOEXEC 0x00000002
#define SB_I_NODEV 0x00000004
#define SB_I_STABLE_WRITES 0x00000008
#define SB_I_USERNS_VISIBLE 0x00000010
#define SB_I_IMA_UNVERIFIABLE_SIGNATURE 0x00000020
#define SB_I_UNTRUSTED_MOUNTER 0x00000040
#define SB_I_EVM_HMAC_UNSUPPORTED 0x00000080
#define SB_I_SKIP_SYNC 0x00000100
#define SB_I_PERSB_BDI 0x00000200
#define SB_I_TS_EXPIRY_WARNED 0x00000400
#define SB_I_RETIRED 0x00000800
#define SB_I_NOUMASK 0x00001000
#define SB_I_NOIDMAP 0x00002000
#define SB_I_ALLOW_HSM 0x00004000
#define SB_I_NO_DATA_INTEGRITY 0x00008000
#endif