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.

Dependency Surface

Detected Declarations

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

Implementation Notes