ENUM RING_BUFFER_TYPE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ enum ring_buffer_type(9) πŸ¦‹

okay so this is straight out of the Kernel API Manual, and it's genuinely one of those pages where the struct is tiny but the lore is deep. bestie, we're talking about the internal ring buffer types β€” the secret little type tags that live inside the kernel's ring buffer. let's get into it πŸ’…


✨ NAME ✨

enum ring_buffer_type β€” the internal ring buffer types, no cap πŸŽ€


🌸 SYNOPSIS 🌸

enum ring_buffer_type {
    RINGBUF_TYPE_DATA_TYPE_LEN_MAX ,
    RINGBUF_TYPE_PADDING ,
    RINGBUF_TYPE_TIME_EXTEND ,
    RINGBUF_TYPE_TIME_STAMP

};

that's the whole enum, icon behavior only ✨


πŸ’– Constants πŸ’–

  • RINGBUF_TYPE_DATA_TYPE_LEN_MAX β€” okay so the source literally says -- undescribed -- 😭 like not me being left on read by the documentation. that's all we get, fr fr.
  • RINGBUF_TYPE_PADDING β€” this one is for left over page padding or a discarded event 🫢 and it's giving conditional, so pay attention:
    • If time_delta is 0: the array is ignored, and the size is variable depending on how much padding is needed.
    • If time_delta is non zero: array[0] holds the actual length, and size = 4 + length (bytes).
  • RINGBUF_TYPE_TIME_EXTEND β€” used to extend the time delta πŸ’œ specifically array[0] = time delta (28 .. 59), and size = 8 bytes. cute, compact, slays.
  • RINGBUF_TYPE_TIME_STAMP β€” absolute timestamp ⭐ same format as TIME_EXTEND except that the value is an absolute timestamp, not a delta. okay so details: event.time_delta contains bottom 27 bits, array[0] = top (28 .. 59) bits, and size = 8 bytes. the way that this one is doing the most with 8 bytes, obsessed πŸ”₯

🌈 Description 🌈

okay so the big picture: <= RINGBUF_TYPE_DATA_TYPE_LEN_MAX means it's a Data record πŸ’« and then it splits into two paths, so listen up:

  • If type_len is zero:
    • array[0] holds the actual length
    • array[1..(length+3)/4] holds data
    • size = 4 + length (bytes)
  • else:
    • length = type_len << 2
    • array[0..(length+3)/4-1] holds data
    • size = 4 + length (bytes)

like, it's literally just bit math and array offsets, but it's our bit math and array offsets 😌 main character energy for real.

lowkey important: those length expressions are exact β€” don't go rounding or "fixing" them, the kernel is doing (length+3)/4 on purpose and it's not here for your vibes-based math πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘

  • Kernel file ./include/linux/ring_buffer.h β€” go read it, iykyk πŸ“–

and that's the page!! πŸŽ€ huge thanks to the source at ./include/linux, dated October 2026, for giving us this iconic little enum in the Kernel API Manual β€” go forth and read your ring buffer types responsibly, bestie πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from