libnvme(9)

πŸ“¦ version 3.2, in arch rolling

πŸ’– NAME πŸ’–

struct libnvme_passthru_cmd β€” the nvme passthrough command structure, aka the little blueprint that lets you yeet a raw NVMe command straight through, bestie.

So this is libnvme we're talking about, and this page is literally just the one struct. Babygirl it is so important though β€” it's the whole "send whatever command I want" pipeline. πŸ”₯


✨ SYNOPSIS ✨

Okay so here's the struct in all its glory, every single field, no skips:

struct libnvme_passthru_cmd {
    __u8 opcode;
    __u8 flags;
    __u16 rsvd1;
    __u32 nsid;
    __u32 cdw2;
    __u32 cdw3;
    __u64 metadata;
    __u64 addr;
    __u32 metadata_len;
    __u32 data_len;
    __u32 cdw10;
    __u32 cdw11;
    __u32 cdw12;
    __u32 cdw13;
    __u32 cdw14;
    __u32 cdw15;
    __u32 timeout_ms;
    __u32 rsvd2;
    __u64 result;
 };

She's giving "long list of dwords" and honestly? We respect her for it. πŸ‘‘


🌸 Members 🌸

Breakdown time, one field at a time, no cap:

  • opcode β€” the Operation code, bestie. Go look at enum libnvme_io_opcodes and enum libnvme_admin_opcodes for the full menu. πŸ“
  • flags β€” Supported only for NVMe-MI. That's it, that's the note. πŸ™ˆ
  • rsvd1 β€” Reserved for future use. Not your business (yet). πŸŽ€
  • nsid β€” the Namespace Identifier, or a Fabrics type. Depends on the vibe. πŸ¦‹
  • cdw2 β€” Command Dword 2 (no spec defined use). It's just there, existing, main character energy of a placeholder. πŸ’…
  • cdw3 β€” Command Dword 3 (no spec defined use). Same situation, different dword. ✨
  • metadata β€” User space address to the metadata buffer (NULL if not used, so please don't point it at nonsense). 🧚
  • addr β€” User space address to the data buffer (NULL if not used). Same rules, same energy. ⭐
  • metadata_len β€” Metadata buffer transfer length. How much metadata is actually travelling, fr fr. πŸ“
  • data_len β€” Data buffer transfer length. How much data is actually travelling. 🌈
  • cdw10 β€” Command Dword 10 (command specific). Meaning lives in the command, not here. πŸ”₯
  • cdw11 β€” Command Dword 11 (command specific). Same deal. πŸ’œ
  • cdw12 β€” Command Dword 12 (command specific). Yep, again. 🫢
  • cdw13 β€” Command Dword 13 (command specific). The pattern is patterning. πŸ’€
  • cdw14 β€” Command Dword 14 (command specific). Still going. 🌸
  • cdw15 β€” Command Dword 15 (command specific). Last of the dword girlies, we love a finale. πŸ‘‘
  • timeout_ms β€” If non-zero, this overrides the system default timeout, in milliseconds. So if you set it, you are the timeout now. ⏰
  • rsvd2 β€” Reserved for future use (and fills an implicit struct pad β€” yes the parenthesis is literally never closed in the source, iykyk, that's just how it shipped πŸ’€). Still reserved though! πŸ™…β€β™€οΈ
  • result β€” Set on completion to the command's CQE DWORD 0-1 controller response. This is where you find out what actually happened. 😭
Ngl, a good chunk of this struct is "command specific" and "reserved for future use", so if you're confused, that's not a skill issue β€” the spec is just like that. 🫢

πŸŽ€ a lil sign-off πŸŽ€

That's the whole page, bestie β€” struct libnvme_passthru_cmd from the libnvme(9) API Manual, dated October 2026. Go forth and passthrough responsibly. Slay. πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from