include/media/v4l2-fh.h
Source file repositories/reference/linux-study-clean/include/media/v4l2-fh.h
File Facts
- System
- Linux kernel
- Corpus path
include/media/v4l2-fh.h- Extension
.h- Size
- 4978 bytes
- Lines
- 182
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fs.hlinux/kconfig.hlinux/list.hlinux/videodev2.h
Detected Declarations
struct video_devicestruct v4l2_ctrl_handlerstruct v4l2_fhfunction v4l2_fh_is_singular
Annotated Snippet
struct v4l2_fh {
struct list_head list;
struct video_device *vdev;
struct v4l2_ctrl_handler *ctrl_handler;
enum v4l2_priority prio;
/* Events */
wait_queue_head_t wait;
struct mutex subscribe_lock;
struct list_head subscribed;
struct list_head available;
unsigned int navailable;
u32 sequence;
struct v4l2_m2m_ctx *m2m_ctx;
};
/**
* file_to_v4l2_fh - Return the v4l2_fh associated with a struct file
*
* @filp: pointer to &struct file
*
* This function should be used by drivers to retrieve the &struct v4l2_fh
* instance pointer stored in the file private_data instead of accessing the
* private_data field directly.
*/
static inline struct v4l2_fh *file_to_v4l2_fh(struct file *filp)
{
return filp->private_data;
}
/**
* v4l2_fh_init - Initialise the file handle.
*
* @fh: pointer to &struct v4l2_fh
* @vdev: pointer to &struct video_device
*
* Parts of the V4L2 framework using the
* file handles should be initialised in this function. Must be called
* from driver's v4l2_file_operations->open\(\) handler if the driver
* uses &struct v4l2_fh.
*/
void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev);
/**
* v4l2_fh_add - Add the fh to the list of file handles on a video_device.
*
* @fh: pointer to &struct v4l2_fh
* @filp: pointer to &struct file associated with @fh
*
* The function sets filp->private_data to point to @fh.
*
* .. note::
* The @fh file handle must be initialised first.
*/
void v4l2_fh_add(struct v4l2_fh *fh, struct file *filp);
/**
* v4l2_fh_open - Ancillary routine that can be used as the open\(\) op
* of v4l2_file_operations.
*
* @filp: pointer to struct file
*
* It allocates a v4l2_fh and inits and adds it to the &struct video_device
* associated with the file pointer.
*
* On error filp->private_data will be %NULL, otherwise it will point to
* the &struct v4l2_fh.
*/
int v4l2_fh_open(struct file *filp);
/**
* v4l2_fh_del - Remove file handle from the list of file handles.
*
* @fh: pointer to &struct v4l2_fh
* @filp: pointer to &struct file associated with @fh
*
* The function resets filp->private_data to NULL.
*
* .. note::
* Must be called in v4l2_file_operations->release\(\) handler if the driver
* uses &struct v4l2_fh.
*/
void v4l2_fh_del(struct v4l2_fh *fh, struct file *filp);
/**
* v4l2_fh_exit - Release resources related to a file handle.
*
* @fh: pointer to &struct v4l2_fh
*
Annotation
- Immediate include surface: `linux/fs.h`, `linux/kconfig.h`, `linux/list.h`, `linux/videodev2.h`.
- Detected declarations: `struct video_device`, `struct v4l2_ctrl_handler`, `struct v4l2_fh`, `function v4l2_fh_is_singular`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: source implementation candidate.
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.