arch/s390/hypfs/hypfs_sprp.c
Source file repositories/reference/linux-study-clean/arch/s390/hypfs/hypfs_sprp.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/hypfs/hypfs_sprp.c- Extension
.c- Size
- 3251 bytes
- Lines
- 148
- Domain
- Architecture Layer
- Bucket
- arch/s390
- Inferred role
- Architecture Layer: implementation source
- Status
- source 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/errno.hlinux/gfp.hlinux/string.hlinux/types.hlinux/uaccess.hasm/diag.hasm/sclp.hhypfs.h
Detected Declarations
function Authorfunction hypfs_sprp_diag304function hypfs_sprp_freefunction hypfs_sprp_createfunction __hypfs_sprp_ioctlfunction hypfs_sprp_ioctlfunction hypfs_sprp_initfunction hypfs_sprp_exit
Annotated Snippet
if (copy_to_user(udata, data, PAGE_SIZE)) {
rc = -EFAULT;
goto out;
}
rc = copy_to_user(user_area, diag304, sizeof(*diag304)) ? -EFAULT : 0;
out:
kfree(diag304);
free_page((unsigned long) data);
return rc;
}
static long hypfs_sprp_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
void __user *argp;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
argp = (void __user *)arg;
switch (cmd) {
case HYPFS_DIAG304:
return __hypfs_sprp_ioctl(argp);
default: /* unknown ioctl number */
return -ENOTTY;
}
return 0;
}
static struct hypfs_dbfs_file hypfs_sprp_file = {
.name = "diag_304",
.data_create = hypfs_sprp_create,
.data_free = hypfs_sprp_free,
.unlocked_ioctl = hypfs_sprp_ioctl,
};
void hypfs_sprp_init(void)
{
if (!sclp.has_sprp)
return;
hypfs_dbfs_create_file(&hypfs_sprp_file);
}
void hypfs_sprp_exit(void)
{
if (!sclp.has_sprp)
return;
hypfs_dbfs_remove_file(&hypfs_sprp_file);
}
Annotation
- Immediate include surface: `linux/errno.h`, `linux/gfp.h`, `linux/string.h`, `linux/types.h`, `linux/uaccess.h`, `asm/diag.h`, `asm/sclp.h`, `hypfs.h`.
- Detected declarations: `function Author`, `function hypfs_sprp_diag304`, `function hypfs_sprp_free`, `function hypfs_sprp_create`, `function __hypfs_sprp_ioctl`, `function hypfs_sprp_ioctl`, `function hypfs_sprp_init`, `function hypfs_sprp_exit`.
- Atlas domain: Architecture Layer / arch/s390.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.