mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-09 21:27:25 +00:00
scoutfs: add mount_options/ sysfs dir
Add a directory per mount that shows the values of all the mount options. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -143,6 +143,21 @@ static int scoutfs_show_options(struct seq_file *seq, struct dentry *root)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t uniq_name_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr, char *buf)
|
||||
{
|
||||
struct super_block *sb = SCOUTFS_SYSFS_ATTRS_SB(kobj);
|
||||
struct mount_options *opts = &SCOUTFS_SB(sb)->opts;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%s\n", opts->uniq_name);
|
||||
}
|
||||
SCOUTFS_ATTR_RO(uniq_name);
|
||||
|
||||
static struct attribute *mount_options_attrs[] = {
|
||||
SCOUTFS_ATTR_PTR(uniq_name),
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int scoutfs_sync_fs(struct super_block *sb, int wait)
|
||||
{
|
||||
trace_scoutfs_sync_fs(sb, wait);
|
||||
@@ -185,6 +200,7 @@ static void scoutfs_put_super(struct super_block *sb)
|
||||
scoutfs_item_destroy(sb);
|
||||
scoutfs_destroy_triggers(sb);
|
||||
scoutfs_options_destroy(sb);
|
||||
scoutfs_sysfs_destroy_attrs(sb, &sbi->mopts_ssa);
|
||||
debugfs_remove(sbi->debug_root);
|
||||
scoutfs_destroy_counters(sb);
|
||||
scoutfs_destroy_sysfs(sb);
|
||||
@@ -357,6 +373,7 @@ static int scoutfs_fill_super(struct super_block *sb, void *data, int silent)
|
||||
spin_lock_init(&sbi->trans_write_lock);
|
||||
INIT_DELAYED_WORK(&sbi->trans_write_work, scoutfs_trans_write_func);
|
||||
init_waitqueue_head(&sbi->trans_write_wq);
|
||||
scoutfs_sysfs_init_attrs(sb, &sbi->mopts_ssa);
|
||||
|
||||
ret = scoutfs_parse_options(sb, data, &opts);
|
||||
if (ret)
|
||||
@@ -376,6 +393,8 @@ static int scoutfs_fill_super(struct super_block *sb, void *data, int silent)
|
||||
scoutfs_read_super(sb, &SCOUTFS_SB(sb)->super) ?:
|
||||
scoutfs_debugfs_setup(sb) ?:
|
||||
scoutfs_options_setup(sb) ?:
|
||||
scoutfs_sysfs_create_attrs(sb, &sbi->mopts_ssa,
|
||||
mount_options_attrs, "mount_options") ?:
|
||||
scoutfs_setup_triggers(sb) ?:
|
||||
scoutfs_seg_setup(sb) ?:
|
||||
scoutfs_item_setup(sb) ?:
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "format.h"
|
||||
#include "options.h"
|
||||
#include "data.h"
|
||||
#include "sysfs.h"
|
||||
|
||||
struct scoutfs_counters;
|
||||
struct scoutfs_triggers;
|
||||
@@ -75,6 +76,7 @@ struct scoutfs_sb_info {
|
||||
|
||||
struct mount_options opts;
|
||||
struct options_sb_info *options;
|
||||
struct scoutfs_sysfs_attrs mopts_ssa;
|
||||
|
||||
struct dentry *debug_root;
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef _SCOUTFS_SYSFS_H_
|
||||
#define _SCOUTFS_SYSFS_H_
|
||||
|
||||
#include <linux/kobject.h>
|
||||
|
||||
/*
|
||||
* We have some light wrappers around sysfs attributes to make it safe
|
||||
* to tear down the attributes before freeing the data they describe.
|
||||
|
||||
Reference in New Issue
Block a user