#include <linux/fs.h>
#include "ubifs.h"
enum attr_id_t { … };
struct ubifs_attr { … };
#define UBIFS_ATTR(_name, _mode, _id) …
#define UBIFS_ATTR_FUNC(_name, _mode) …
UBIFS_ATTR_FUNC(…);
UBIFS_ATTR_FUNC(…);
UBIFS_ATTR_FUNC(…);
#define ATTR_LIST(name) …
static struct attribute *ubifs_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static ssize_t ubifs_attr_show(struct kobject *kobj,
struct attribute *attr, char *buf)
{
struct ubifs_info *sbi = container_of(kobj, struct ubifs_info,
kobj);
struct ubifs_attr *a = container_of(attr, struct ubifs_attr, attr);
switch (a->attr_id) {
case attr_errors_magic:
return sysfs_emit(buf, "%u\n", sbi->stats->magic_errors);
case attr_errors_node:
return sysfs_emit(buf, "%u\n", sbi->stats->node_errors);
case attr_errors_crc:
return sysfs_emit(buf, "%u\n", sbi->stats->crc_errors);
}
return 0;
};
static void ubifs_sb_release(struct kobject *kobj)
{ … }
static const struct sysfs_ops ubifs_attr_ops = …;
static const struct kobj_type ubifs_sb_ktype = …;
static const struct kobj_type ubifs_ktype = …;
static struct kset ubifs_kset = …;
int ubifs_sysfs_register(struct ubifs_info *c)
{ … }
void ubifs_sysfs_unregister(struct ubifs_info *c)
{ … }
int __init ubifs_sysfs_init(void)
{ … }
void ubifs_sysfs_exit(void)
{ … }