drivers/misc/ibmasm/ibmasmfs.c
Source file repositories/reference/linux-study-clean/drivers/misc/ibmasm/ibmasmfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/ibmasm/ibmasmfs.c- Extension
.c- Size
- 14339 bytes
- Lines
- 605
- Domain
- Driver Families
- Bucket
- drivers/misc
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/fs_context.hlinux/pagemap.hlinux/slab.hlinux/uaccess.hasm/io.hibmasm.hremote.hdot_command.h
Detected Declarations
struct ibmasmfs_command_datastruct ibmasmfs_event_datastruct ibmasmfs_heartbeat_datafunction ibmasmfs_get_treefunction ibmasmfs_init_fs_contextfunction ibmasmfs_fill_superfunction ibmasmfs_create_filefunction ibmasmfs_registerfunction ibmasmfs_unregisterfunction ibmasmfs_add_spfunction command_file_openfunction command_file_closefunction command_file_readfunction command_file_writefunction event_file_openfunction event_file_closefunction event_file_readfunction event_file_writefunction r_heartbeat_file_openfunction r_heartbeat_file_closefunction r_heartbeat_file_readfunction r_heartbeat_file_writefunction remote_settings_file_closefunction remote_settings_file_readfunction remote_settings_file_writefunction ibmasmfs_create_filesfunction list_for_each
Annotated Snippet
const struct file_operations *fops,
void *data,
int mode)
{
struct dentry *dentry;
struct inode *inode;
dentry = d_alloc_name(parent, name);
if (!dentry)
return -ENOMEM;
inode = ibmasmfs_make_inode(parent->d_sb, S_IFREG | mode);
if (!inode) {
dput(dentry);
return -ENOMEM;
}
inode->i_fop = fops;
inode->i_private = data;
d_make_persistent(dentry, inode);
dput(dentry);
return 0;
}
static struct dentry *ibmasmfs_create_dir(struct dentry *parent,
const char *name)
{
struct dentry *dentry;
struct inode *inode;
dentry = d_alloc_name(parent, name);
if (!dentry)
return NULL;
inode = ibmasmfs_make_inode(parent->d_sb, S_IFDIR | 0500);
if (!inode) {
dput(dentry);
return NULL;
}
inode->i_op = &simple_dir_inode_operations;
inode->i_fop = &simple_dir_operations;
d_make_persistent(dentry, inode);
dput(dentry);
return dentry; // borrowed
}
int ibmasmfs_register(void)
{
return register_filesystem(&ibmasmfs_type);
}
void ibmasmfs_unregister(void)
{
unregister_filesystem(&ibmasmfs_type);
}
void ibmasmfs_add_sp(struct service_processor *sp)
{
list_add(&sp->node, &service_processors);
}
/* struct to save state between command file operations */
struct ibmasmfs_command_data {
struct service_processor *sp;
struct command *command;
};
/* struct to save state between event file operations */
struct ibmasmfs_event_data {
struct service_processor *sp;
struct event_reader reader;
int active;
};
/* struct to save state between reverse heartbeat file operations */
struct ibmasmfs_heartbeat_data {
struct service_processor *sp;
struct reverse_heartbeat heartbeat;
int active;
};
static int command_file_open(struct inode *inode, struct file *file)
{
struct ibmasmfs_command_data *command_data;
if (!inode->i_private)
return -ENODEV;
Annotation
- Immediate include surface: `linux/fs.h`, `linux/fs_context.h`, `linux/pagemap.h`, `linux/slab.h`, `linux/uaccess.h`, `asm/io.h`, `ibmasm.h`, `remote.h`.
- Detected declarations: `struct ibmasmfs_command_data`, `struct ibmasmfs_event_data`, `struct ibmasmfs_heartbeat_data`, `function ibmasmfs_get_tree`, `function ibmasmfs_init_fs_context`, `function ibmasmfs_fill_super`, `function ibmasmfs_create_file`, `function ibmasmfs_register`, `function ibmasmfs_unregister`, `function ibmasmfs_add_sp`.
- Atlas domain: Driver Families / drivers/misc.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.