viortc_msg_init(9)
β¨ viortc_msg_init(9) β¨
okay so bestie, welcome to the kernel API manual for viortc_msg_init β it's a 9-section (kernel internals) page and honestly? lowkey iconic. sit down, grab a strawberry π, and let's get into it.
π NAME π
viortc_msg_init β allocate and initialize a requestq message. that's it, that's the vibe. π
β¨ SYNOPSIS β¨
struct viortc_msg * viortc_msg_init (struct viortc_dev *viortc , u16
msg_type , unsigned int req_size , unsigned int resp_cap );
literally just one function call, copy it exactly, do not freestyle it π
πΈ ARGUMENTS πΈ
viortcβ the device data. like, the device's whole personality. π«Άmsg_typeβ the virtio_rtc message type. the flavor of message we're making. πreq_sizeβ size of the request buffer to be allocated. how much room the ask gets. β¨resp_capβ size of the response buffer to be allocated. how much room the answer gets. π
π¦ DESCRIPTION π¦
okay so what it actually does: it initializes the message refcnt to 2. yes, two. not one. two. write that down. π
the way the refcnt works is highkey important β it gets decremented once in the virtqueue callback, and once in the thread that's waiting on the message (that's on completion or on timeout, whichever happens first). so like, two independent parties each drop a ref, and that's the whole balancing act. main character refcounting energy π
π CONTEXT π
Process context. no funny business, no interrupt context, we're behaving today. ng-ngl, respect it. π
β RETURN β
non-NULL on success. that's the whole return story, bestie β that's the good outcome. πβ¨
π SEE ALSO π
Kernel file ./drivers/virtio/virtio_rtc_driver.c, plus the whole friend group:
struct viortc_vq(9)struct viortc_dev(9)struct viortc_msg(9)viortc_class_from_dev(9)viortc_alarms_supported(9)viortc_feed_vq(9)viortc_msg_release(9)viortc_do_cb(9)viortc_requestq_hdlr(9)viortc_cb_requestq(9)viortc_alarmq_hdlr(9)viortc_cb_alarmq(9)viortc_get_resp_errno(9)viortc_msg_xfer(9)VIORTC_DECLARE_MSG_HDL_ONSTACK(9)VIORTC_MSG(9)VIORTC_MSG_INIT(9)VIORTC_MSG_WRITE(9)VIORTC_MSG_READ(9)viortc_read(9)viortc_read_cross(9)viortc_cfg(9)viortc_clock_cap(9)viortc_cross_cap(9)viortc_read_alarm(9)viortc_set_alarm(9)viortc_set_alarm_enabled(9)viortc_init_rtc_class_clock(9)viortc_init_ptp_clock(9)viortc_init_clock(9)viortc_clocks_deinit(9)viortc_clocks_init(9)viortc_populate_vq(9)viortc_alloc_vq_bufs(9)viortc_init_vqs(9)viortc_probe(9)viortc_remove(9)
that's the whole group chat, iykyk π
and that's the page!! π this one lives in ./drivers/virtio, it's dated October 2026, and the headline is ofc viortc_msg_init(9) β slay, go init some messages bestie π
β¨π¦
π¦ 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