libnvme(2)

πŸ’– NAME πŸ’–

enum nvme_status_type β€” bestie, this is the type encoding for NVMe return values when they're being represented as an int. That's it. That's the whole job. She's small but she's doing SO much. πŸ’…


✨ SYNOPSIS ✨

enum nvme_status_type {
    NVME_STATUS_TYPE_SHIFT ,
    NVME_STATUS_TYPE_MASK ,
    NVME_STATUS_TYPE_NVME ,
    NVME_STATUS_TYPE_MI

};

πŸŽ€ Constants πŸŽ€

Okay so these four are the whole girl group, and they each have a role, no filler members fr fr 🫢

  • NVME_STATUS_TYPE_SHIFT β€” the shift value for the status bits. That's her whole thing, she shifts. Iconic.
  • NVME_STATUS_TYPE_MASK β€” the mask value for the status bits. Masking, but make it fashion πŸ’„
  • NVME_STATUS_TYPE_NVME β€” NVMe command status value, typically coming from CDW3. Yes queen, straight out of CDW3, no cap πŸ‘‘
  • NVME_STATUS_TYPE_MI β€” NVMe-MI header status. Miss MI said "I'll have my own status type, thank you" and honestly? Valid. πŸ¦‹

🌸 Description 🌸

So here's the tea, bestie: the nvme_* api returns an int, and that int is doing three different jobs at once, which is a lot for one little integer, iykyk 😭

  • negative values = an internal error or a syscall error (bad vibes)
  • zero = success (slay, we ate ✨)
  • positive values = the NVMe status itself

Now that positive case β€” the NVMe status β€” is the interesting one. It can represent status values from different parts of the transport / controller / etc., and it's at most 16 bits of data. Sixteen. That's it. She's compact. She's lowkey efficient. 🫢

So the way we make this work? We take the most-significant 3 bits of that signed int and use them to say which type of status we're looking at. The other bits get to do their own thing. Vibe check passed, the layout is giving "we planned ahead" πŸ’€βœ¨

Note to future you: those top 3 bits aren't decoration, they're the whole routing system. Don't touch, don't reuse, don't get cute with them.

okay that's the page!! this came from the API Manual for libnvme, and the page itself is dated July 2026 β€” so yes, we are reading future mail, main character energy only πŸ‘‘πŸ’–

πŸ“¦ where this page comes from