linux/fs/f2fs/sysfs.c

// SPDX-License-Identifier: GPL-2.0
/*
 * f2fs sysfs interface
 *
 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
 *             http://www.samsung.com/
 * Copyright (c) 2017 Chao Yu <[email protected]>
 */
#include <linux/compiler.h>
#include <linux/proc_fs.h>
#include <linux/f2fs_fs.h>
#include <linux/seq_file.h>
#include <linux/unicode.h>
#include <linux/ioprio.h>
#include <linux/sysfs.h>

#include "f2fs.h"
#include "segment.h"
#include "gc.h"
#include "iostat.h"
#include <trace/events/f2fs.h>

static struct proc_dir_entry *f2fs_proc_root;

/* Sysfs support for f2fs */
enum {};

static const char *gc_mode_names[MAX_GC_MODE] =;

struct f2fs_attr {};

static ssize_t f2fs_sbi_show(struct f2fs_attr *a,
			     struct f2fs_sb_info *sbi, char *buf);

static unsigned char *__struct_ptr(struct f2fs_sb_info *sbi, int struct_type)
{}

static ssize_t dirty_segments_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t free_segments_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t ovp_segments_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t lifetime_write_kbytes_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t sb_status_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t cp_status_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t pending_discard_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t issued_discard_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t queued_discard_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t undiscard_blks_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t gc_mode_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t features_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t current_reserved_blocks_show(struct f2fs_attr *a,
					struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t unusable_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t encoding_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t mounted_time_sec_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}

#ifdef CONFIG_F2FS_STAT_FS
static ssize_t moved_blocks_foreground_show(struct f2fs_attr *a,
				struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t moved_blocks_background_show(struct f2fs_attr *a,
				struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t avg_vblocks_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}
#endif

static ssize_t main_blkaddr_show(struct f2fs_attr *a,
				struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t f2fs_sbi_show(struct f2fs_attr *a,
			struct f2fs_sb_info *sbi, char *buf)
{}

static ssize_t __sbi_store(struct f2fs_attr *a,
			struct f2fs_sb_info *sbi,
			const char *buf, size_t count)
{}

static ssize_t f2fs_sbi_store(struct f2fs_attr *a,
			struct f2fs_sb_info *sbi,
			const char *buf, size_t count)
{}

static ssize_t f2fs_attr_show(struct kobject *kobj,
				struct attribute *attr, char *buf)
{}

static ssize_t f2fs_attr_store(struct kobject *kobj, struct attribute *attr,
						const char *buf, size_t len)
{}

static void f2fs_sb_release(struct kobject *kobj)
{}

/*
 * Note that there are three feature list entries:
 * 1) /sys/fs/f2fs/features
 *   : shows runtime features supported by in-kernel f2fs along with Kconfig.
 *     - ref. F2FS_FEATURE_RO_ATTR()
 *
 * 2) /sys/fs/f2fs/$s_id/features <deprecated>
 *   : shows on-disk features enabled by mkfs.f2fs, used for old kernels. This
 *     won't add new feature anymore, and thus, users should check entries in 3)
 *     instead of this 2).
 *
 * 3) /sys/fs/f2fs/$s_id/feature_list
 *   : shows on-disk features enabled by mkfs.f2fs per instance, which follows
 *     sysfs entry rule where each entry should expose single value.
 *     This list covers old feature list provided by 2) and beyond. Therefore,
 *     please add new on-disk feature in this list only.
 *     - ref. F2FS_SB_FEATURE_RO_ATTR()
 */
static ssize_t f2fs_feature_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}

#define F2FS_FEATURE_RO_ATTR(_name)

static ssize_t f2fs_sb_feature_show(struct f2fs_attr *a,
		struct f2fs_sb_info *sbi, char *buf)
{}

#define F2FS_SB_FEATURE_RO_ATTR(_name, _feat)

#define F2FS_ATTR_OFFSET(_struct_type, _name, _mode, _show, _store, _offset)

#define F2FS_RO_ATTR(struct_type, struct_name, name, elname)

#define F2FS_RW_ATTR(struct_type, struct_name, name, elname)

#define F2FS_GENERAL_RO_ATTR(name)

#ifdef CONFIG_F2FS_STAT_FS
#define STAT_INFO_RO_ATTR(name, elname)
#endif

#define GC_THREAD_RW_ATTR(name, elname)

#define SM_INFO_RW_ATTR(name, elname)

#define SM_INFO_GENERAL_RW_ATTR(elname)

#define DCC_INFO_RW_ATTR(name, elname)

#define DCC_INFO_GENERAL_RW_ATTR(elname)

#define NM_INFO_RW_ATTR(name, elname)

#define NM_INFO_GENERAL_RW_ATTR(elname)

#define F2FS_SBI_RW_ATTR(name, elname)

#define F2FS_SBI_GENERAL_RW_ATTR(elname)

#define F2FS_SBI_GENERAL_RO_ATTR(elname)

#ifdef CONFIG_F2FS_FAULT_INJECTION
#define FAULT_INFO_GENERAL_RW_ATTR(type, elname)
#endif

#define RESERVED_BLOCKS_GENERAL_RW_ATTR(elname)

#define CPRC_INFO_GENERAL_RW_ATTR(elname)

#define ATGC_INFO_RW_ATTR(name, elname)

/* GC_THREAD ATTR */
GC_THREAD_RW_ATTR();
GC_THREAD_RW_ATTR();
GC_THREAD_RW_ATTR();
GC_THREAD_RW_ATTR();

/* SM_INFO ATTR */
SM_INFO_RW_ATTR();
SM_INFO_GENERAL_RW_ATTR();
SM_INFO_GENERAL_RW_ATTR();
SM_INFO_GENERAL_RW_ATTR();
SM_INFO_GENERAL_RW_ATTR();
SM_INFO_GENERAL_RW_ATTR();
SM_INFO_GENERAL_RW_ATTR();

/* DCC_INFO ATTR */
DCC_INFO_RW_ATTR();
DCC_INFO_GENERAL_RW_ATTR();
DCC_INFO_GENERAL_RW_ATTR();
DCC_INFO_GENERAL_RW_ATTR();
DCC_INFO_GENERAL_RW_ATTR();
DCC_INFO_GENERAL_RW_ATTR();
DCC_INFO_GENERAL_RW_ATTR();
DCC_INFO_GENERAL_RW_ATTR();
DCC_INFO_GENERAL_RW_ATTR();
DCC_INFO_GENERAL_RW_ATTR();

/* NM_INFO ATTR */
NM_INFO_RW_ATTR();
NM_INFO_GENERAL_RW_ATTR();
NM_INFO_GENERAL_RW_ATTR();
NM_INFO_GENERAL_RW_ATTR();

/* F2FS_SBI ATTR */
F2FS_RW_ATTR();
F2FS_SBI_RW_ATTR();
F2FS_SBI_RW_ATTR();
F2FS_SBI_RW_ATTR();
F2FS_SBI_RW_ATTR();
F2FS_SBI_RW_ATTR();
F2FS_SBI_RW_ATTR();
F2FS_SBI_RW_ATTR();
F2FS_SBI_RW_ATTR();
F2FS_SBI_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
#ifdef CONFIG_F2FS_IOSTAT
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
#endif
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
#ifdef CONFIG_F2FS_FS_COMPRESSION
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
#endif
/* atomic write */
F2FS_SBI_GENERAL_RO_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
/* block age extent cache */
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
F2FS_SBI_GENERAL_RW_ATTR();
#ifdef CONFIG_BLK_DEV_ZONED
F2FS_SBI_GENERAL_RO_ATTR();
#endif

/* STAT_INFO ATTR */
#ifdef CONFIG_F2FS_STAT_FS
STAT_INFO_RO_ATTR();
STAT_INFO_RO_ATTR();
STAT_INFO_RO_ATTR();
STAT_INFO_RO_ATTR();
#endif

/* FAULT_INFO ATTR */
#ifdef CONFIG_F2FS_FAULT_INJECTION
FAULT_INFO_GENERAL_RW_ATTR();
FAULT_INFO_GENERAL_RW_ATTR();
#endif

/* RESERVED_BLOCKS ATTR */
RESERVED_BLOCKS_GENERAL_RW_ATTR();

/* CPRC_INFO ATTR */
CPRC_INFO_GENERAL_RW_ATTR();

/* ATGC_INFO ATTR */
ATGC_INFO_RW_ATTR();
ATGC_INFO_RW_ATTR();
ATGC_INFO_RW_ATTR();
ATGC_INFO_RW_ATTR();

F2FS_GENERAL_RO_ATTR();
F2FS_GENERAL_RO_ATTR();
F2FS_GENERAL_RO_ATTR();
F2FS_GENERAL_RO_ATTR();
F2FS_GENERAL_RO_ATTR();
F2FS_GENERAL_RO_ATTR();
F2FS_GENERAL_RO_ATTR();
F2FS_GENERAL_RO_ATTR();
F2FS_GENERAL_RO_ATTR();
F2FS_GENERAL_RO_ATTR();
F2FS_GENERAL_RO_ATTR();
F2FS_GENERAL_RO_ATTR();
#ifdef CONFIG_F2FS_STAT_FS
F2FS_GENERAL_RO_ATTR();
F2FS_GENERAL_RO_ATTR();
F2FS_GENERAL_RO_ATTR();
#endif

#ifdef CONFIG_FS_ENCRYPTION
F2FS_FEATURE_RO_ATTR();
F2FS_FEATURE_RO_ATTR();
#if IS_ENABLED(CONFIG_UNICODE)
F2FS_FEATURE_RO_ATTR();
#endif
#endif /* CONFIG_FS_ENCRYPTION */
#ifdef CONFIG_BLK_DEV_ZONED
F2FS_FEATURE_RO_ATTR();
#endif
F2FS_FEATURE_RO_ATTR();
F2FS_FEATURE_RO_ATTR();
F2FS_FEATURE_RO_ATTR();
F2FS_FEATURE_RO_ATTR();
F2FS_FEATURE_RO_ATTR();
F2FS_FEATURE_RO_ATTR();
F2FS_FEATURE_RO_ATTR();
F2FS_FEATURE_RO_ATTR();
#ifdef CONFIG_FS_VERITY
F2FS_FEATURE_RO_ATTR();
#endif
F2FS_FEATURE_RO_ATTR();
#if IS_ENABLED(CONFIG_UNICODE)
F2FS_FEATURE_RO_ATTR();
#endif
F2FS_FEATURE_RO_ATTR();
#ifdef CONFIG_F2FS_FS_COMPRESSION
F2FS_FEATURE_RO_ATTR();
#endif
F2FS_FEATURE_RO_ATTR();

#define ATTR_LIST(name)
static struct attribute *f2fs_attrs[] =;
ATTRIBUTE_GROUPS();

static struct attribute *f2fs_feat_attrs[] =;
ATTRIBUTE_GROUPS();

F2FS_GENERAL_RO_ATTR();
F2FS_GENERAL_RO_ATTR();
F2FS_GENERAL_RO_ATTR();
F2FS_GENERAL_RO_ATTR();
F2FS_GENERAL_RO_ATTR();

static struct attribute *f2fs_stat_attrs[] =;
ATTRIBUTE_GROUPS();

F2FS_SB_FEATURE_RO_ATTR();
F2FS_SB_FEATURE_RO_ATTR();
F2FS_SB_FEATURE_RO_ATTR();
F2FS_SB_FEATURE_RO_ATTR();
F2FS_SB_FEATURE_RO_ATTR();
F2FS_SB_FEATURE_RO_ATTR();
F2FS_SB_FEATURE_RO_ATTR();
F2FS_SB_FEATURE_RO_ATTR();
F2FS_SB_FEATURE_RO_ATTR();
F2FS_SB_FEATURE_RO_ATTR();
F2FS_SB_FEATURE_RO_ATTR();
F2FS_SB_FEATURE_RO_ATTR();
F2FS_SB_FEATURE_RO_ATTR();
F2FS_SB_FEATURE_RO_ATTR();

static struct attribute *f2fs_sb_feat_attrs[] =;
ATTRIBUTE_GROUPS();

static const struct sysfs_ops f2fs_attr_ops =;

static const struct kobj_type f2fs_sb_ktype =;

static const struct kobj_type f2fs_ktype =;

static struct kset f2fs_kset =;

static const struct kobj_type f2fs_feat_ktype =;

static struct kobject f2fs_feat =;

static ssize_t f2fs_stat_attr_show(struct kobject *kobj,
				struct attribute *attr, char *buf)
{}

static ssize_t f2fs_stat_attr_store(struct kobject *kobj, struct attribute *attr,
						const char *buf, size_t len)
{}

static void f2fs_stat_kobj_release(struct kobject *kobj)
{}

static const struct sysfs_ops f2fs_stat_attr_ops =;

static const struct kobj_type f2fs_stat_ktype =;

static ssize_t f2fs_sb_feat_attr_show(struct kobject *kobj,
				struct attribute *attr, char *buf)
{}

static void f2fs_feature_list_kobj_release(struct kobject *kobj)
{}

static const struct sysfs_ops f2fs_feature_list_attr_ops =;

static const struct kobj_type f2fs_feature_list_ktype =;

static int __maybe_unused segment_info_seq_show(struct seq_file *seq,
						void *offset)
{}

static int __maybe_unused segment_bits_seq_show(struct seq_file *seq,
						void *offset)
{}

static int __maybe_unused victim_bits_seq_show(struct seq_file *seq,
						void *offset)
{}

static int __maybe_unused discard_plist_seq_show(struct seq_file *seq,
						void *offset)
{}

static int __maybe_unused disk_map_seq_show(struct seq_file *seq,
						void *offset)
{}

int __init f2fs_init_sysfs(void)
{}

void f2fs_exit_sysfs(void)
{}

int f2fs_register_sysfs(struct f2fs_sb_info *sbi)
{}

void f2fs_unregister_sysfs(struct f2fs_sb_info *sbi)
{}