fs/xfs/xfs_sysfs.c
Source file repositories/reference/linux-study-clean/fs/xfs/xfs_sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/xfs_sysfs.c- Extension
.c- Size
- 18167 bytes
- Lines
- 893
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
xfs_platform.hxfs_shared.hxfs_format.hxfs_log_format.hxfs_trans_resv.hxfs_sysfs.hxfs_log.hxfs_log_priv.hxfs_mount.hxfs_zone_priv.hxfs_zones.hxfs_zone_alloc.h
Detected Declarations
struct xfs_sysfs_attrstruct xfs_error_initfunction to_attrfunction xfs_sysfs_object_showfunction xfs_sysfs_object_storefunction bug_on_assert_storefunction bug_on_assert_showfunction log_recovery_delay_storefunction log_recovery_delay_showfunction mount_delay_storefunction mount_delay_showfunction always_cow_storefunction always_cow_showfunction pwork_threads_storefunction pwork_threads_showfunction larp_storefunction larp_showfunction bload_leaf_slack_storefunction bload_leaf_slack_showfunction bload_node_slack_storefunction bload_node_slack_showfunction to_xstatsfunction stats_showfunction stats_clear_storefunction to_xlogfunction log_head_lsn_showfunction log_tail_lsn_showfunction reserve_grant_head_bytes_showfunction write_grant_head_bytes_showfunction IOfunction err_to_mpfunction max_retries_showfunction max_retries_storefunction retry_timeout_seconds_showfunction retry_timeout_seconds_storefunction fail_at_unmount_showfunction fail_at_unmount_storefunction xfs_error_sysfs_init_classfunction max_open_zones_showfunction nr_open_zones_showfunction zonegc_low_space_storefunction zonegc_low_space_showfunction xfs_mount_sysfs_initfunction xfs_mount_sysfs_delfunction xfs_error_get_cfg
Annotated Snippet
struct xfs_sysfs_attr {
struct attribute attr;
ssize_t (*show)(struct kobject *kobject, char *buf);
ssize_t (*store)(struct kobject *kobject, const char *buf,
size_t count);
};
static inline struct xfs_sysfs_attr *
to_attr(struct attribute *attr)
{
return container_of(attr, struct xfs_sysfs_attr, attr);
}
#define XFS_SYSFS_ATTR_RW(name) \
static struct xfs_sysfs_attr xfs_sysfs_attr_##name = __ATTR_RW(name)
#define XFS_SYSFS_ATTR_RO(name) \
static struct xfs_sysfs_attr xfs_sysfs_attr_##name = __ATTR_RO(name)
#define XFS_SYSFS_ATTR_WO(name) \
static struct xfs_sysfs_attr xfs_sysfs_attr_##name = __ATTR_WO(name)
#define ATTR_LIST(name) &xfs_sysfs_attr_##name.attr
STATIC ssize_t
xfs_sysfs_object_show(
struct kobject *kobject,
struct attribute *attr,
char *buf)
{
struct xfs_sysfs_attr *xfs_attr = to_attr(attr);
return xfs_attr->show ? xfs_attr->show(kobject, buf) : 0;
}
STATIC ssize_t
xfs_sysfs_object_store(
struct kobject *kobject,
struct attribute *attr,
const char *buf,
size_t count)
{
struct xfs_sysfs_attr *xfs_attr = to_attr(attr);
return xfs_attr->store ? xfs_attr->store(kobject, buf, count) : 0;
}
static const struct sysfs_ops xfs_sysfs_ops = {
.show = xfs_sysfs_object_show,
.store = xfs_sysfs_object_store,
};
static struct attribute *xfs_mp_attrs[] = {
NULL,
};
ATTRIBUTE_GROUPS(xfs_mp);
static const struct kobj_type xfs_mp_ktype = {
.release = xfs_sysfs_release,
.sysfs_ops = &xfs_sysfs_ops,
.default_groups = xfs_mp_groups,
};
#ifdef DEBUG
/* debug */
STATIC ssize_t
bug_on_assert_store(
struct kobject *kobject,
const char *buf,
size_t count)
{
int ret;
int val;
ret = kstrtoint(buf, 0, &val);
if (ret)
return ret;
if (val == 1)
xfs_globals.bug_on_assert = true;
else if (val == 0)
xfs_globals.bug_on_assert = false;
else
return -EINVAL;
return count;
}
STATIC ssize_t
bug_on_assert_show(
struct kobject *kobject,
Annotation
- Immediate include surface: `xfs_platform.h`, `xfs_shared.h`, `xfs_format.h`, `xfs_log_format.h`, `xfs_trans_resv.h`, `xfs_sysfs.h`, `xfs_log.h`, `xfs_log_priv.h`.
- Detected declarations: `struct xfs_sysfs_attr`, `struct xfs_error_init`, `function to_attr`, `function xfs_sysfs_object_show`, `function xfs_sysfs_object_store`, `function bug_on_assert_store`, `function bug_on_assert_show`, `function log_recovery_delay_store`, `function log_recovery_delay_show`, `function mount_delay_store`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.