drivers/media/v4l2-core/v4l2-compat-ioctl32.c
Source file repositories/reference/linux-study-clean/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/v4l2-core/v4l2-compat-ioctl32.c- Extension
.c- Size
- 31380 bytes
- Lines
- 1208
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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.hlinux/module.hlinux/videodev2.hlinux/v4l2-subdev.hmedia/v4l2-dev.hmedia/v4l2-fh.hmedia/v4l2-ctrls.hmedia/v4l2-ioctl.h
Detected Declarations
struct v4l2_window32struct v4l2_format32struct v4l2_create_buffers32struct v4l2_standard32struct v4l2_plane32struct v4l2_buffer32struct v4l2_buffer32_time32struct v4l2_framebuffer32struct v4l2_input32struct v4l2_ext_controls32struct v4l2_ext_control32struct v4l2_event32struct v4l2_event32_time32struct v4l2_edid32function get_v4l2_window32function put_v4l2_window32function get_v4l2_format32function get_v4l2_create32function put_v4l2_format32function put_v4l2_create32function get_v4l2_standard32function put_v4l2_standard32function get_v4l2_plane32function put_v4l2_plane32function get_v4l2_buffer32function get_v4l2_buffer32_time32function put_v4l2_buffer32function put_v4l2_buffer32_time32function get_v4l2_framebuffer32function put_v4l2_framebuffer32function get_v4l2_input32function put_v4l2_input32function ctrl_is_pointerfunction get_v4l2_ext_controls32function put_v4l2_ext_controls32function put_v4l2_event32function put_v4l2_event32_time32function get_v4l2_edid32function put_v4l2_edid32function v4l2_compat_translate_cmdfunction v4l2_compat_get_userfunction v4l2_compat_put_userfunction v4l2_compat_get_array_argsfunction v4l2_compat_put_array_argsfunction v4l2_compat_ioctl32export v4l2_compat_ioctl32
Annotated Snippet
struct v4l2_window32 {
struct v4l2_rect w;
__u32 field; /* enum v4l2_field */
__u32 chromakey;
compat_caddr_t clips; /* always NULL */
__u32 clipcount; /* always 0 */
compat_caddr_t bitmap; /* always NULL */
__u8 global_alpha;
};
static int get_v4l2_window32(struct v4l2_window *p64,
struct v4l2_window32 __user *p32)
{
struct v4l2_window32 w32;
if (copy_from_user(&w32, p32, sizeof(w32)))
return -EFAULT;
*p64 = (struct v4l2_window) {
.w = w32.w,
.field = w32.field,
.chromakey = w32.chromakey,
.clips = NULL,
.clipcount = 0,
.bitmap = NULL,
.global_alpha = w32.global_alpha,
};
return 0;
}
static int put_v4l2_window32(struct v4l2_window *p64,
struct v4l2_window32 __user *p32)
{
struct v4l2_window32 w32;
memset(&w32, 0, sizeof(w32));
w32 = (struct v4l2_window32) {
.w = p64->w,
.field = p64->field,
.chromakey = p64->chromakey,
.clips = 0,
.clipcount = 0,
.bitmap = 0,
.global_alpha = p64->global_alpha,
};
if (copy_to_user(p32, &w32, sizeof(w32)))
return -EFAULT;
return 0;
}
struct v4l2_format32 {
__u32 type; /* enum v4l2_buf_type */
union {
struct v4l2_pix_format pix;
struct v4l2_pix_format_mplane pix_mp;
struct v4l2_window32 win;
struct v4l2_vbi_format vbi;
struct v4l2_sliced_vbi_format sliced;
struct v4l2_sdr_format sdr;
struct v4l2_meta_format meta;
__u8 raw_data[200]; /* user-defined */
} fmt;
};
/**
* struct v4l2_create_buffers32 - VIDIOC_CREATE_BUFS32 argument
* @index: on return, index of the first created buffer
* @count: entry: number of requested buffers,
* return: number of created buffers
* @memory: buffer memory type
* @format: frame format, for which buffers are requested
* @capabilities: capabilities of this buffer type.
* @flags: additional buffer management attributes (ignored unless the
* queue has V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS capability and
* configured for MMAP streaming I/O).
* @max_num_buffers: if V4L2_BUF_CAP_SUPPORTS_MAX_NUM_BUFFERS capability flag is set
* this field indicate the maximum possible number of buffers
* for this queue.
* @reserved: future extensions
*/
struct v4l2_create_buffers32 {
__u32 index;
__u32 count;
__u32 memory; /* enum v4l2_memory */
struct v4l2_format32 format;
__u32 capabilities;
__u32 flags;
Annotation
- Immediate include surface: `linux/compat.h`, `linux/module.h`, `linux/videodev2.h`, `linux/v4l2-subdev.h`, `media/v4l2-dev.h`, `media/v4l2-fh.h`, `media/v4l2-ctrls.h`, `media/v4l2-ioctl.h`.
- Detected declarations: `struct v4l2_window32`, `struct v4l2_format32`, `struct v4l2_create_buffers32`, `struct v4l2_standard32`, `struct v4l2_plane32`, `struct v4l2_buffer32`, `struct v4l2_buffer32_time32`, `struct v4l2_framebuffer32`, `struct v4l2_input32`, `struct v4l2_ext_controls32`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration 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.