fs/orangefs/orangefs-sysfs.c
Source file repositories/reference/linux-study-clean/fs/orangefs/orangefs-sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
fs/orangefs/orangefs-sysfs.c- Extension
.c- Size
- 34932 bytes
- Lines
- 1317
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fs.hlinux/kobject.hlinux/string.hlinux/sysfs.hlinux/module.hlinux/init.hprotocol.horangefs-kernel.horangefs-sysfs.h
Detected Declarations
struct orangefs_attributefunction orangefs_attr_showfunction orangefs_attr_storefunction sysfs_int_showfunction sysfs_int_storefunction sysfs_service_op_showfunction sysfs_service_op_storefunction strcmpfunction orangefs_obj_releasefunction acache_orangefs_obj_releasefunction capcache_orangefs_obj_releasefunction ccache_orangefs_obj_releasefunction ncache_orangefs_obj_releasefunction pc_orangefs_obj_releasefunction stats_orangefs_obj_releasefunction orangefs_sysfs_initfunction orangefs_sysfs_exit
Annotated Snippet
struct orangefs_attribute {
struct attribute attr;
ssize_t (*show)(struct kobject *kobj,
struct orangefs_attribute *attr,
char *buf);
ssize_t (*store)(struct kobject *kobj,
struct orangefs_attribute *attr,
const char *buf,
size_t count);
};
static ssize_t orangefs_attr_show(struct kobject *kobj,
struct attribute *attr,
char *buf)
{
struct orangefs_attribute *attribute;
attribute = container_of(attr, struct orangefs_attribute, attr);
if (!attribute->show)
return -EIO;
return attribute->show(kobj, attribute, buf);
}
static ssize_t orangefs_attr_store(struct kobject *kobj,
struct attribute *attr,
const char *buf,
size_t len)
{
struct orangefs_attribute *attribute;
if (!strcmp(kobj->name, PC_KOBJ_ID) ||
!strcmp(kobj->name, STATS_KOBJ_ID))
return -EPERM;
attribute = container_of(attr, struct orangefs_attribute, attr);
if (!attribute->store)
return -EIO;
return attribute->store(kobj, attribute, buf, len);
}
static const struct sysfs_ops orangefs_sysfs_ops = {
.show = orangefs_attr_show,
.store = orangefs_attr_store,
};
static ssize_t sysfs_int_show(struct kobject *kobj,
struct orangefs_attribute *attr, char *buf)
{
int rc = -EIO;
gossip_debug(GOSSIP_SYSFS_DEBUG, "sysfs_int_show: id:%s:\n",
kobj->name);
if (!strcmp(kobj->name, ORANGEFS_KOBJ_ID)) {
if (!strcmp(attr->attr.name, "op_timeout_secs")) {
rc = sysfs_emit(buf,
"%d\n",
op_timeout_secs);
goto out;
} else if (!strcmp(attr->attr.name,
"slot_timeout_secs")) {
rc = sysfs_emit(buf,
"%d\n",
slot_timeout_secs);
goto out;
} else if (!strcmp(attr->attr.name,
"cache_timeout_msecs")) {
rc = sysfs_emit(buf,
"%d\n",
orangefs_cache_timeout_msecs);
goto out;
} else if (!strcmp(attr->attr.name,
"dcache_timeout_msecs")) {
rc = sysfs_emit(buf,
"%d\n",
orangefs_dcache_timeout_msecs);
goto out;
} else if (!strcmp(attr->attr.name,
"getattr_timeout_msecs")) {
rc = sysfs_emit(buf,
"%d\n",
orangefs_getattr_timeout_msecs);
goto out;
} else {
goto out;
}
} else if (!strcmp(kobj->name, STATS_KOBJ_ID)) {
if (!strcmp(attr->attr.name, "reads")) {
rc = sysfs_emit(buf,
Annotation
- Immediate include surface: `linux/fs.h`, `linux/kobject.h`, `linux/string.h`, `linux/sysfs.h`, `linux/module.h`, `linux/init.h`, `protocol.h`, `orangefs-kernel.h`.
- Detected declarations: `struct orangefs_attribute`, `function orangefs_attr_show`, `function orangefs_attr_store`, `function sysfs_int_show`, `function sysfs_int_store`, `function sysfs_service_op_show`, `function sysfs_service_op_store`, `function strcmp`, `function orangefs_obj_release`, `function acache_orangefs_obj_release`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
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.