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 fromCDW3. 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
- ubuntu stonking: libnvme-dev 1.16.2-1build1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms