Files
scoutfs/kmod/src/sysfs.h
Zach Brown a239f6093d 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>
2019-06-05 14:30:11 -07:00

52 lines
1.4 KiB
C

#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.
*/
#define SCOUTFS_ATTR_RO(_name) \
static struct kobj_attribute scoutfs_attr_##_name = __ATTR_RO(_name)
#define SCOUTFS_ATTR_PTR(_name) \
&scoutfs_attr_##_name.attr
struct scoutfs_sysfs_attrs {
struct super_block *sb;
char *name;
struct completion comp;
struct kobject kobj;
struct kobj_type ktype;
};
#define SCOUTFS_SYSFS_ATTRS(kobj) \
container_of(kobj, struct scoutfs_sysfs_attrs, kobj)
#define SCOUTFS_SYSFS_ATTRS_SB(kobj) \
(SCOUTFS_SYSFS_ATTRS(kobj)->sb)
#define DECLARE_SCOUTFS_SYSFS_ATTRS(name, kobj) \
struct scoutfs_sysfs_attrs *ssa = SCOUTFS_SYSFS_ATTRS(kobj)
void scoutfs_sysfs_init_attrs(struct super_block *sb,
struct scoutfs_sysfs_attrs *ssa);
int scoutfs_sysfs_create_attrs(struct super_block *sb,
struct scoutfs_sysfs_attrs *ssa,
struct attribute **attrs, char *fmt, ...);
void scoutfs_sysfs_destroy_attrs(struct super_block *sb,
struct scoutfs_sysfs_attrs *ssa);
struct kobject *scoutfs_sysfs_sb_dir(struct super_block *sb);
int scoutfs_setup_sysfs(struct super_block *sb);
void scoutfs_destroy_sysfs(struct super_block *sb);
int __init scoutfs_sysfs_init(void);
void __exit scoutfs_sysfs_exit(void);
#endif