include/media/dvb_vb2.h
Source file repositories/reference/linux-study-clean/include/media/dvb_vb2.h
File Facts
- System
- Linux kernel
- Corpus path
include/media/dvb_vb2.h- Extension
.h- Size
- 7884 bytes
- Lines
- 282
- 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.
- 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/mutex.hlinux/poll.hlinux/dvb/dmx.hmedia/videobuf2-core.hmedia/videobuf2-dma-contig.hmedia/videobuf2-vmalloc.h
Detected Declarations
struct dvb_bufferstruct dvb_vb2_ctxenum dvb_buf_typeenum dvb_vb2_statesfunction dvb_vb2_initfunction dvb_vb2_releasefunction dvb_vb2_poll
Annotated Snippet
struct dvb_buffer {
struct vb2_buffer vb;
struct list_head list;
};
/**
* struct dvb_vb2_ctx - control struct for VB2 handler
* @vb_q: pointer to &struct vb2_queue with videobuf2 queue.
* @slock: spin lock used to protect buffer filling at dvb_vb2.c.
* @dvb_q: List of buffers that are not filled yet.
* @buf: Pointer to the buffer that are currently being filled.
* @offset: index to the next position at the @buf to be filled.
* @remain: How many bytes are left to be filled at @buf.
* @state: bitmask of buffer states as defined by &enum dvb_vb2_states.
* @buf_siz: size of each VB2 buffer.
* @buf_cnt: number of VB2 buffers.
* @nonblocking:
* If different than zero, device is operating on non-blocking
* mode.
* @flags: buffer flags as defined by &enum dmx_buffer_flags.
* Filled only at &DMX_DQBUF. &DMX_QBUF should zero this field.
* @count: monotonic counter for filled buffers. Helps to identify
* data stream loses. Filled only at &DMX_DQBUF. &DMX_QBUF should
* zero this field.
*
* @name: name of the device type. Currently, it can either be
* "dvr" or "demux_filter".
*/
struct dvb_vb2_ctx {
struct vb2_queue vb_q;
spinlock_t slock;
struct list_head dvb_q;
struct dvb_buffer *buf;
int offset;
int remain;
int state;
int buf_siz;
int buf_cnt;
int nonblocking;
enum dmx_buffer_flags flags;
u32 count;
char name[DVB_VB2_NAME_MAX + 1];
};
#ifndef CONFIG_DVB_MMAP
static inline int dvb_vb2_init(struct dvb_vb2_ctx *ctx, const char *name,
struct mutex *mutex, int non_blocking)
{
return 0;
};
static inline int dvb_vb2_release(struct dvb_vb2_ctx *ctx)
{
return 0;
};
#define dvb_vb2_is_streaming(ctx) (0)
#define dvb_vb2_fill_buffer(ctx, file, wait, flags, flush) (0)
static inline __poll_t dvb_vb2_poll(struct dvb_vb2_ctx *ctx,
struct file *file,
poll_table *wait)
{
return 0;
}
#else
/**
* dvb_vb2_init - initializes VB2 handler
*
* @ctx: control struct for VB2 handler
* @name: name for the VB2 handler
* @mutex: pointer to the mutex that serializes vb2 ioctls
* @non_blocking:
* if not zero, it means that the device is at non-blocking mode
*/
int dvb_vb2_init(struct dvb_vb2_ctx *ctx, const char *name,
struct mutex *mutex, int non_blocking);
/**
* dvb_vb2_release - Releases the VB2 handler allocated resources and
* put @ctx at DVB_VB2_STATE_NONE state.
* @ctx: control struct for VB2 handler
*/
int dvb_vb2_release(struct dvb_vb2_ctx *ctx);
/**
* dvb_vb2_is_streaming - checks if the VB2 handler is streaming
* @ctx: control struct for VB2 handler
*
* Return: 0 if not streaming, 1 otherwise.
Annotation
- Immediate include surface: `linux/mutex.h`, `linux/poll.h`, `linux/dvb/dmx.h`, `media/videobuf2-core.h`, `media/videobuf2-dma-contig.h`, `media/videobuf2-vmalloc.h`.
- Detected declarations: `struct dvb_buffer`, `struct dvb_vb2_ctx`, `enum dvb_buf_type`, `enum dvb_vb2_states`, `function dvb_vb2_init`, `function dvb_vb2_release`, `function dvb_vb2_poll`.
- 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.