mirror of
https://github.com/versity/scoutfs.git
synced 2026-06-08 04:32:35 +00:00
scoutfs: add rid sysfs file
Add a "rid" file along the "fsid" file in the per-mount sysfs dir that gives the mounts rid. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -43,10 +43,20 @@ static ssize_t fsid_show(struct kobject *kobj, struct attribute *attr,
|
||||
struct super_block *sb = KOBJ_TO_SB(kobj, sb_id_kobj);
|
||||
struct scoutfs_super_block *super = &SCOUTFS_SB(sb)->super;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%llx\n", le64_to_cpu(super->hdr.fsid));
|
||||
return snprintf(buf, PAGE_SIZE, "%016llx\n",
|
||||
le64_to_cpu(super->hdr.fsid));
|
||||
}
|
||||
ATTR_FUNCS_RO(fsid);
|
||||
|
||||
static ssize_t rid_show(struct kobject *kobj, struct attribute *attr, char *buf)
|
||||
{
|
||||
struct super_block *sb = KOBJ_TO_SB(kobj, sb_id_kobj);
|
||||
struct scoutfs_sb_info *sbi = SCOUTFS_SB(sb);
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%016llx\n", sbi->rid);
|
||||
}
|
||||
ATTR_FUNCS_RO(rid);
|
||||
|
||||
/*
|
||||
* ops are defined per type, not per attribute. To have attributes with
|
||||
* different types that want different funcs we wrap them with a struct
|
||||
@@ -82,6 +92,7 @@ static ssize_t attr_funcs_show(struct kobject *kobj, struct attribute *attr,
|
||||
|
||||
static struct attribute *sb_id_attrs[] = {
|
||||
&fsid_attr_funcs.attr,
|
||||
&rid_attr_funcs.attr,
|
||||
NULL,
|
||||
};
|
||||
KTYPE(sb_id);
|
||||
|
||||
Reference in New Issue
Block a user