STRUCT MEDIA_REQUEST(9)
π struct media_request(9) π
okay so bestie, welcome to the Kernel API Manual β¨ β yes, THE Kernel API Manual, the one we all gagged over. today's main character is struct media_request, aka Media device request. she's giving kernel-internals-realness and honestly? obsessed π
πΈ NAME πΈ
struct media_request β Media device request π¦
like, that's her. that's the whole name. periodt.
β¨ SYNOPSIS β¨
no cap, here's the literal struct, copied with love and zero typos π:
struct media_request {
struct media_device *mdev;
struct kref kref;
char debug_str[TASK_COMM_LEN + 11];
enum media_request_state state;
unsigned int updating_count;
unsigned int access_count;
struct list_head objects;
unsigned int num_incomplete_objects;
bool manual_completion;
wait_queue_head_t poll_wait;
spinlock_t lock;
};
she's a whole vibe check in struct form, iykyk π
π§ Members π§
okay so this is the part where we meet the squad, one field at a time β every single one, no skipping, fr fr:
mdevβ the Media device this request belongs to π«Ά like, her home base, her origin story.krefβ Reference count β the classic "how many people are holding hands with me right now" counter.debug_strβ Prefix for debug messages (process name:fd) π so when she talks in debug logs, she introduces herself properly,process name:fdstyle.stateβ The state of the request π literally what mood she's in, structurally speaking. the type isenum media_request_state, in case you were wondering πupdating_countβ count the number of request updates that are in progress π₯ keeping track of how many update situations are currently mid-happening.access_countβ count the number of request accesses that are in progress π same energy, but for accesses. very "how many people are looking at me rn" of her.objectsβ List ofstruct media_request_objectrequest objects π it's astruct list_head, and it's exactly what it sounds like: the guest list.num_incomplete_objectsβ The number of incomplete objects in the request π the little counter of things that aren't done yet. she's tracking them, don't worry.manual_completionβ if true, then the request won't be marked as completed whennum_incomplete_objectsreaches 0. Callmedia_request_manual_completeto complete the request afternum_incomplete_objects == 0. π so like, she does NOT auto-complete herself and that's a whole thing β you have to do it by hand withmedia_request_manual_complete, and only afternum_incomplete_objects == 0. read that twice bestie, it matters πpoll_waitβ Wait queue for poll β³ the waiting room where poll hangs out.lockβ Serializes access to this struct π the bouncer at the door. nobody gets in out of order.
lowkey important: manual_completion being a "no auto-complete" switch is real behavior, not a fun fact. don't be out here expecting her to finish herself π
π SEE ALSO π
the whole friend group, linked with love β Kernel file ./include/media/media-request.h plus every single one of these π:
enum media_request_state(9)media_request_lock_for_access(9)media_request_unlock_for_access(9)media_request_lock_for_update(9)media_request_unlock_for_update(9)media_request_get(9)media_request_put(9)media_request_get_by_fd(9)media_request_alloc(9)media_request_mark_manual_completion(9)media_request_manual_complete(9)struct media_request_object_ops(9)struct media_request_object(9)media_request_object_get(9)media_request_object_put(9)media_request_object_find(9)media_request_object_init(9)media_request_object_bind(9)media_request_object_unbind(9)media_request_object_complete(9)
π that's the whole page, bestie. you ate that. and for the record, this lil masterpiece lives in ./include/media and it's dated October 2026 β so yeah, future icon behavior ππ¦β¨ periodt.
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms