include/linux/mtio.h
Source file repositories/reference/linux-study-clean/include/linux/mtio.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/mtio.h- Extension
.h- Size
- 1317 bytes
- Lines
- 61
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/compat.huapi/linux/mtio.hlinux/uaccess.h
Detected Declarations
struct mtget32struct mtpos32function put_user_mtgetfunction put_user_mtpos
Annotated Snippet
struct mtget32 {
s32 mt_type;
s32 mt_resid;
s32 mt_dsreg;
s32 mt_gstat;
s32 mt_erreg;
s32 mt_fileno;
s32 mt_blkno;
};
#define MTIOCGET32 _IOR('m', 2, struct mtget32)
struct mtpos32 {
s32 mt_blkno;
};
#define MTIOCPOS32 _IOR('m', 3, struct mtpos32)
static inline int put_user_mtget(void __user *u, struct mtget *k)
{
struct mtget32 k32 = {
.mt_type = k->mt_type,
.mt_resid = k->mt_resid,
.mt_dsreg = k->mt_dsreg,
.mt_gstat = k->mt_gstat,
.mt_erreg = k->mt_erreg,
.mt_fileno = k->mt_fileno,
.mt_blkno = k->mt_blkno,
};
int ret;
if (in_compat_syscall())
ret = copy_to_user(u, &k32, sizeof(k32));
else
ret = copy_to_user(u, k, sizeof(*k));
return ret ? -EFAULT : 0;
}
static inline int put_user_mtpos(void __user *u, struct mtpos *k)
{
if (in_compat_syscall())
return put_user(k->mt_blkno, (u32 __user *)u);
else
return put_user(k->mt_blkno, (long __user *)u);
}
#endif
Annotation
- Immediate include surface: `linux/compat.h`, `uapi/linux/mtio.h`, `linux/uaccess.h`.
- Detected declarations: `struct mtget32`, `struct mtpos32`, `function put_user_mtget`, `function put_user_mtpos`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.