nvme_io_passthru64(2)

✨ nvme_io_passthru64(2) ✨

okay so bestie, welcome to nvme_io_passthru64 β€” it's a function from the libnvme API manual and it is literally the "send whatever raw command I want down to the NVMe device" button. it's giving backstage pass energy. πŸŽ€


🌸 NAME 🌸

nvme_io_passthru64 β€” submit an nvme io passthrough command. yes that's it, that's the whole vibe. πŸ’…


🌈 SYNOPSIS 🌈

int nvme_io_passthru64 (int fd , __u8 opcode , __u8 flags , __u16 rsvd ,
__u32 nsid , __u32 cdw2 , __u32 cdw3 , __u32 cdw10 , __u32 cdw11 , __u32
cdw12 , __u32 cdw13 , __u32 cdw14 , __u32 cdw15 , __u32 data_len , void
*data , __u32 metadata_len , void *metadata , __u32 timeout_ms , __u64
*result );

look at all those parameters. she's got a lot going on and honestly? we respect it. πŸ‘‘


πŸ¦‹ ARGUMENTS πŸ¦‹

here's the cast of characters, no cap. every single one, exactly as the original says, because we do not skip details in this house. πŸ’–

  • fd β€” the file descriptor of the nvme device. your little handle to the hardware, your main character's front door. πŸ”‘
  • opcode β€” the nvme io command to send. this is which command you're yeeting at the device.
  • flags β€” NVMe command flags (not used). she's on the list but she's lowkey not doing anything rn. 😭
  • rsvd β€” reserved for future use. don't touch, it's saving that seat for later. πŸ™ˆ
  • nsid β€” namespace identifier. which namespace we're talking to.
  • cdw2 β€” Command dword 2.
  • cdw3 β€” Command dword 3.
  • cdw10 β€” Command dword 10.
  • cdw11 β€” Command dword 11.
  • cdw12 β€” Command dword 12.
  • cdw13 β€” Command dword 13.
  • cdw14 β€” Command dword 14.
  • cdw15 β€” Command dword 15.

(yes, they really just go cdw2, cdw3, then straight to cdw10 through cdw15. iconic gaps. no notes. that's just how NVMe do. πŸ’€)

  • data_len β€” length of the data transferred in this command, in bytes. πŸ“
  • data β€” pointer to user address of the data buffer. where the actual payload lives.
  • metadata_len β€” length of metadata transferred in this command.
  • metadata β€” pointer to user address of the metadata buffer.
  • timeout_ms β€” how long the kernel waits for the command to complete. the patience meter. ⏳
  • result β€” optional field to return the result from the CQE dword 0. optional bestie, so you can pass what you wanna pass here. ✨

πŸ’œ DESCRIPTION πŸ’œ

okay so here's the tea: this is the parameterized form of nvme_submit_io_passthru64. 🫢

that means it sets up and submits a struct nvme_passthru_cmd64 for you. it's the ~fancy wrapper~ version of the thing, and it's doing all the assembling of that struct so you don't have to.

and the known values for opcode? those are defined in enum nvme_io_opcode. so if you're sitting there like "what number do I even put in the opcode slot", go look at that enum, bestie, that's where the answers live. πŸ“–

also just like, a gentle nudge: passthrough commands are the raw, low-level, talk-directly-to-the-device kind of deal. they are powerful and the device will absolutely do what you tell it. be the responsible main character. 🫑

⭐ RETURN ⭐

the function gives you back the nvme command status if a response was received β€” see enum nvme_status_field for what the status values mean, iykyk.

or, if things went sideways and no response showed up, it returns -1 with errno set. so check that errno, she's telling you what happened. 😭


πŸŽ€ SEE ALSO πŸŽ€

no SEE ALSO section on this page, bestie β€” the references you do get live right up in the text: nvme_submit_io_passthru64, struct nvme_passthru_cmd64, enum nvme_io_opcode, and enum nvme_status_field. go read those for the full lore. πŸ“š


okay that's the whole page, you ate it, you understood it, periodt. πŸ’… this one's nvme_io_passthru64 from the libnvme API manual, and it dropped in July 2026. mwah, go submit some commands responsibly, bye bestie πŸ«ΆπŸ’–βœ¨

πŸ“¦ where this page comes from