arch/s390/hypfs/inode.c
Source file repositories/reference/linux-study-clean/arch/s390/hypfs/inode.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/hypfs/inode.c- Extension
.c- Size
- 10904 bytes
- Lines
- 449
- Domain
- Architecture Layer
- Bucket
- arch/s390
- Inferred role
- Architecture Layer: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/types.hlinux/errno.hlinux/fs.hlinux/fs_context.hlinux/fs_parser.hlinux/namei.hlinux/vfs.hlinux/slab.hlinux/pagemap.hlinux/time.hlinux/sysfs.hlinux/init.hlinux/kobject.hlinux/seq_file.hlinux/uio.hasm/machine.hasm/ebcdic.hhypfs.h
Detected Declarations
struct hypfs_sb_infofunction hypfs_update_updatefunction hypfs_add_dentryfunction hypfs_delete_treefunction hypfs_evict_inodefunction hypfs_openfunction hypfs_read_iterfunction hypfs_write_iterfunction hypfs_releasefunction hypfs_parse_paramfunction hypfs_show_optionsfunction hypfs_fill_superfunction hypfs_get_treefunction hypfs_free_fcfunction hypfs_init_fs_contextfunction hypfs_kill_superfunction hypfs_create_u64function hypfs_create_strfunction __hypfs_fs_init
Annotated Snippet
static const struct file_operations hypfs_file_ops;
static struct file_system_type hypfs_type;
static const struct super_operations hypfs_s_ops;
/* start of list of all dentries, which have to be deleted on update */
static struct dentry *hypfs_last_dentry;
static void hypfs_update_update(struct super_block *sb)
{
struct hypfs_sb_info *sb_info = sb->s_fs_info;
struct inode *inode = d_inode(sb_info->update_file);
sb_info->last_update = ktime_get_seconds();
simple_inode_init_ts(inode);
}
/* directory tree removal functions */
static void hypfs_add_dentry(struct dentry *dentry)
{
if (IS_ROOT(dentry->d_parent)) {
dentry->d_fsdata = hypfs_last_dentry;
hypfs_last_dentry = dentry;
}
}
static void hypfs_delete_tree(void)
{
while (hypfs_last_dentry) {
struct dentry *next_dentry = hypfs_last_dentry->d_fsdata;
simple_recursive_removal(hypfs_last_dentry, NULL);
hypfs_last_dentry = next_dentry;
}
}
static struct inode *hypfs_make_inode(struct super_block *sb, umode_t mode)
{
struct inode *ret = new_inode(sb);
if (ret) {
struct hypfs_sb_info *hypfs_info = sb->s_fs_info;
ret->i_ino = get_next_ino();
ret->i_mode = mode;
ret->i_uid = hypfs_info->uid;
ret->i_gid = hypfs_info->gid;
simple_inode_init_ts(ret);
if (S_ISDIR(mode))
set_nlink(ret, 2);
}
return ret;
}
static void hypfs_evict_inode(struct inode *inode)
{
clear_inode(inode);
kfree(inode->i_private);
}
static int hypfs_open(struct inode *inode, struct file *filp)
{
char *data = file_inode(filp)->i_private;
struct hypfs_sb_info *fs_info;
if (filp->f_mode & FMODE_WRITE) {
if (!(inode->i_mode & S_IWUGO))
return -EACCES;
}
if (filp->f_mode & FMODE_READ) {
if (!(inode->i_mode & S_IRUGO))
return -EACCES;
}
fs_info = inode->i_sb->s_fs_info;
if(data) {
mutex_lock(&fs_info->lock);
filp->private_data = kstrdup(data, GFP_KERNEL);
if (!filp->private_data) {
mutex_unlock(&fs_info->lock);
return -ENOMEM;
}
mutex_unlock(&fs_info->lock);
}
return nonseekable_open(inode, filp);
}
static ssize_t hypfs_read_iter(struct kiocb *iocb, struct iov_iter *to)
{
struct file *file = iocb->ki_filp;
char *data = file->private_data;
size_t available = strlen(data);
Annotation
- Immediate include surface: `linux/types.h`, `linux/errno.h`, `linux/fs.h`, `linux/fs_context.h`, `linux/fs_parser.h`, `linux/namei.h`, `linux/vfs.h`, `linux/slab.h`.
- Detected declarations: `struct hypfs_sb_info`, `function hypfs_update_update`, `function hypfs_add_dentry`, `function hypfs_delete_tree`, `function hypfs_evict_inode`, `function hypfs_open`, `function hypfs_read_iter`, `function hypfs_write_iter`, `function hypfs_release`, `function hypfs_parse_param`.
- Atlas domain: Architecture Layer / arch/s390.
- Implementation status: pattern 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.