drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c- Extension
.c- Size
- 8148 bytes
- Lines
- 320
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- 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
rtrs-pri.hrtrs-srv.hrtrs-log.h
Detected Declarations
function Copyrightfunction rtrs_srv_disconnect_showfunction rtrs_srv_disconnect_storefunction rtrs_srv_hca_port_showfunction rtrs_srv_hca_name_showfunction rtrs_srv_src_addr_showfunction rtrs_srv_dst_addr_showfunction rtrs_srv_create_once_sysfs_root_foldersfunction rtrs_srv_destroy_once_sysfs_root_foldersfunction rtrs_srv_path_stats_releasefunction rtrs_srv_create_stats_filesfunction rtrs_srv_create_path_filesfunction rtrs_srv_destroy_path_files
Annotated Snippet
err = device_add(&srv->dev);
if (err) {
pr_err("device_add(): %pe\n", ERR_PTR(err));
put_device(&srv->dev);
goto unlock;
}
srv->kobj_paths = kobject_create_and_add("paths", &srv->dev.kobj);
if (!srv->kobj_paths) {
err = -ENOMEM;
pr_err("kobject_create_and_add(): %pe\n", ERR_PTR(err));
device_del(&srv->dev);
put_device(&srv->dev);
goto unlock;
}
dev_set_uevent_suppress(&srv->dev, false);
kobject_uevent(&srv->dev.kobj, KOBJ_ADD);
unlock:
mutex_unlock(&srv->paths_mutex);
return err;
}
static void
rtrs_srv_destroy_once_sysfs_root_folders(struct rtrs_srv_path *srv_path)
{
struct rtrs_srv_sess *srv = srv_path->srv;
mutex_lock(&srv->paths_mutex);
if (!--srv->dev_ref) {
kobject_put(srv->kobj_paths);
mutex_unlock(&srv->paths_mutex);
device_del(&srv->dev);
put_device(&srv->dev);
} else {
put_device(&srv->dev);
mutex_unlock(&srv->paths_mutex);
}
}
static void rtrs_srv_path_stats_release(struct kobject *kobj)
{
struct rtrs_srv_stats *stats;
stats = container_of(kobj, struct rtrs_srv_stats, kobj_stats);
free_percpu(stats->rdma_stats);
kfree(stats);
}
static struct kobj_type ktype_stats = {
.sysfs_ops = &kobj_sysfs_ops,
.release = rtrs_srv_path_stats_release,
};
static int rtrs_srv_create_stats_files(struct rtrs_srv_path *srv_path)
{
int err;
struct rtrs_path *s = &srv_path->s;
err = kobject_init_and_add(&srv_path->stats->kobj_stats, &ktype_stats,
&srv_path->kobj, "stats");
if (err) {
rtrs_err(s, "kobject_init_and_add(): %pe\n", ERR_PTR(err));
kobject_put(&srv_path->stats->kobj_stats);
return err;
}
err = sysfs_create_group(&srv_path->stats->kobj_stats,
&rtrs_srv_stats_attr_group);
if (err) {
rtrs_err(s, "sysfs_create_group(): %pe\n", ERR_PTR(err));
goto err;
}
return 0;
err:
kobject_del(&srv_path->stats->kobj_stats);
kobject_put(&srv_path->stats->kobj_stats);
return err;
}
int rtrs_srv_create_path_files(struct rtrs_srv_path *srv_path)
{
struct rtrs_srv_sess *srv = srv_path->srv;
struct rtrs_path *s = &srv_path->s;
char str[NAME_MAX];
int err;
struct rtrs_addr path = {
Annotation
- Immediate include surface: `rtrs-pri.h`, `rtrs-srv.h`, `rtrs-log.h`.
- Detected declarations: `function Copyright`, `function rtrs_srv_disconnect_show`, `function rtrs_srv_disconnect_store`, `function rtrs_srv_hca_port_show`, `function rtrs_srv_hca_name_show`, `function rtrs_srv_src_addr_show`, `function rtrs_srv_dst_addr_show`, `function rtrs_srv_create_once_sysfs_root_folders`, `function rtrs_srv_destroy_once_sysfs_root_folders`, `function rtrs_srv_path_stats_release`.
- Atlas domain: Driver Families / drivers/infiniband.
- 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.