libnvme(2)

✨ libnvme β€” API Manual ✨

okay bestie, welcome to libnvme(2) πŸ’– this is the page where we meet struct nvme_passthru_cmd, aka the nvme passthrough command structure. yes it's a struct, yes it's giving main character energy, and yes you're gonna learn every single field, no skips, no cap 🫢


🌸 NAME 🌸

struct nvme_passthru_cmd β€” the nvme passthrough command structure, your lil' backstage pass to talking straight to a controller πŸŽ€


⭐ SYNOPSIS ⭐

struct nvme_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 result;
 };

look at her. seventeen fields. a whole queen πŸ‘‘ and now let's meet each one by name.


πŸ’… Members πŸ’…

this is the part where I introduce you to the whole squad, one by one, no one gets left out πŸ’œ
  • opcode β€” the Operation code, bestie. peek at enum nvme_io_opcodes and enum nvme_admin_opcodes to see your options πŸ‘€
  • flags β€” not supported: it's intended for command flags (for example: SGL, FUSE), but it's not actually a thing yet πŸ™ˆ
  • rsvd1 β€” Reserved for future use. she's just vibing. do not touch 🌈
  • nsid β€” Namespace Identifier, or the Fabrics type. yes, she does double duty, we love a multitasker ✨
  • cdw2 β€” Command Dword 2 (no spec defined use). literally no spec says what she does, iconic behavior πŸ’€
  • cdw3 β€” Command Dword 3 (no spec defined use). twin sister of cdw2, equally mysterious πŸ¦‹
  • metadata β€” the user space address to the metadata buffer (NULL if not used). no metadata? just pass NULL, we're chill 🌸
  • addr β€” the user space address to the data buffer (NULL if not used). same deal, no data means NULL honey 🫢
  • metadata_len β€” Metadata buffer transfer length. how much metadata are we moving, babes πŸ“
  • data_len β€” Data buffer transfer length. how much data are we moving, fr fr πŸ“¦
  • cdw10 β€” Command Dword 10 (command specific). she's special to her command and only her command πŸ’…
  • cdw11 β€” Command Dword 11 (command specific). again, command specific πŸŽ€
  • cdw12 β€” Command Dword 12 (command specific). you get the vibe by now ⭐
  • cdw13 β€” Command Dword 13 (command specific). yup πŸ“
  • cdw14 β€” Command Dword 14 (command specific). still going πŸ’œ
  • cdw15 β€” Command Dword 15 (command specific). the last of the command-specific dword girlies, we stan a full set 🧚
  • timeout_ms β€” if she's non-zero, she overrides the system default timeout, in milliseconds ⏱️ a little "actually, we're waiting this long" energy
  • result β€” gets set on completion to the command's CQE DWORD 0 controller response. that's the controller talking back to you, bestie πŸ—£οΈβœ¨

quick reminder: flags is not supported β€” so don't go building your whole personality on passing SGL or FUSE through it, okay? πŸ’–

that's the whole struct, you ate this πŸ½οΈπŸ’… iykyk β€” and if you didn't know before, now you literally do. periodt.


this page is part of the libnvme(2) API Manual, documenting struct nvme_passthru_cmd, dated July 2026 πŸŒ™ go forth and pass those commands through, bestie πŸ¦‹πŸ’–

πŸ“¦ where this page comes from