libnvme(2)

πŸ’– NAME πŸ’–

struct nvme_passthru_cmd64 β€” the 64-bit nvme passthrough command structure πŸ¦‹

ok so bestie, welcome to section 2 of the libnvme API Manual β€” yes, the actual manual, manual name and all, and today's main character is a struct. A whole struct. And honestly? She deserves it. πŸ’…

If you've ever wanted to just... tell an NVMe drive exactly what to do, no vibes-filtering, no fancy abstraction layer, no "the library will handle it" β€” that's what passthrough is. You hand the kernel a command basically as-is, and it goes straight to the controller. And this struct is the 64-bit version of that envelope. ✨


✨ SYNOPSIS ✨

struct nvme_passthru_cmd64 {
    __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;
 };

look at her. so many __u32s. so many dwords. iconic. 🧚


πŸŽ€ Members πŸŽ€

okay bestie, let's go field by field, no skipping, I see you trying to scroll past cdw13 πŸ™ˆ

  • opcode β€” the operation code. which command are we even doing? check enum nvme_io_opcodes and enum nvme_admin_opcodes, that's where the answers live. πŸ‘‘
  • flags β€” not supported. like, the field is there but it's meant for command flags (eg: SGL, FUSE) and it doesn't do that. don't @ it. πŸ’€
  • rsvd1 β€” reserved for future use. basically a little seat saved for a future era. πŸŽ€
  • nsid β€” Namespace Identifier, or a Fabrics type, depending on the situation. she contains multitudes. 🌸
  • cdw2 β€” Command Dword 2, and there is no spec defined use for this one. it's just... hanging out. πŸ¦‹
  • cdw3 β€” Command Dword 3, same situation, no spec defined use. her and cdw2 are a duo fr fr. πŸ’œ
  • metadata β€” user space address to the metadata buffer. if you're not using it, it's NULL. periodt. ✨
  • addr β€” user space address to the data buffer. also NULL if you're not using it. πŸ’…
  • metadata_len β€” Metadata buffer transfer length. how much metadata are we moving, bestie. πŸ“
  • data_len β€” Data buffer transfer length. how much data are we moving. πŸ“¦
  • cdw10 β€” Command Dword 10, and this one is command specific, so its meaning depends on opcode. iykyk. 🧚
  • cdw11 β€” Command Dword 11, also command specific. πŸ”₯
  • cdw12 β€” Command Dword 12, command specific, still going. ⭐
  • cdw13 β€” Command Dword 13, command specific, the one you tried to skip. I saw that. πŸ‘€
  • cdw14 β€” Command Dword 14, command specific. 🌈
  • cdw15 β€” Command Dword 15, command specific. and that's the whole dword lineup, slay. πŸŽ‰
  • timeout_ms β€” if this is non-zero, it overrides the system default timeout, measured in milliseconds. non-zero = you're the boss now. ⏰
  • rsvd2 β€” reserved for future use (and fills an implicit struct pad β€” yeah the paren never closes, that's how the source text is, and honestly? she's valid to me. 🫢)
  • result β€” set on completion to the command's CQE DWORD 0-1 controller response. this is where you find out how it went. πŸ’Œ
heads up bestie β€” flags being unsupported and rsvd1 / rsvd2 being reserved are not suggestions. leave reserved stuff alone and don't expect flags to do anything, no cap. 🚫

and that's the whole struct, every single field, nothing skipped, because you deserve to know all of her πŸ₯Ή

cute lil sign-off moment: this page came from the struct nvme_passthru_cmd64 entry in the libnvme(2) manual, and it's dated July 2026 β€” so yeah, she's from the future and she's still out here describing a 64-bit passthrough command. timeless. go forth and pass commands through, bestie πŸ’–βœ¨

πŸ“¦ where this page comes from