libnvme(2)
π libnvme(2) β the API manual, bestie edition π
okay so we're in the libnvme API manual, and today's main character is a struct. yes a struct. sit down, hydrate, we're doing this. π«Ά
β¨ NAME β¨
struct nvme_st_result β Self-test Result. that's it. that's the whole vibe. it's the little guy that holds the tea on what happened when your drive ran its self-test and something. went. wrong. π
β¨ SYNOPSIS β¨
look at her. no notes. genuinely iconic layout:
struct nvme_st_result {
__u8 dsts;
__u8 seg;
__u8 vdi;
__u8 rsvd;
__le64 poh;
__le32 nsid;
__le64 flba;
__u8 sct;
__u8 sc;
__u8 vs[2];
};
β¨ Members β¨
obsessed with this lineup, let's go one by one, no skipping, we do not skip in this house π
dstsβ Device Self-test Status. this is the moment: it tells you the device self-test code AND the status of the operation. if you wanna go deeper, checkenum nvme_status_resultandenum nvme_st_code. iykyk πsegβ Segment Number. it points at the segment number where the first self-test failure happened. BUT β and this is the important part bestie β if Device Self-test Status (dsts) is not set to#NVME_ST_RESULT_KNOWN_SEG_FAIL, then honestly? ignore this field. it's giving nothing. πvdiβ Valid Diagnostic Information. this is the receipts field: it tells you which diagnostic failure information is actually being reported. seeenum nvme_st_valid_diag_infofor the lore. β¨rsvdβ Reserved. it's reserved. we don't touch it. we don't look at it. we pretend it isn't there. periodt. πpohβ Power On Hours (POH). the number of power-on hours at the exact time the device self-test operation was completed or aborted. and important caveat: this does not include time where the controller was powered but chilling in a low power state. low power = not counted, no cap. πnsidβ Namespace Identifier (NSID). tells you which namespace the Failing LBA happened on. valid only when the NSID Valid bit (#NVME_ST_VALID_DIAG_INFO_NSID) is set in the Valid Diagnostic Information (vdi) field. no bit, no drama. πflbaβ Failing LBA. the LBA of the logical block that made the test flop. and here's the fine print: if the device hit more than one failed logical block during the test, this field only shows you one of them. just one. so don't come for it. valid only when the NSID Valid bit (#NVME_ST_VALID_DIAG_INFO_FLBA) is set in the Valid Diagnostic Information (vdi) field. πΈsctβ Status Code Type. this field may carry extra info about errors or conditions. bits2:0may contain extra info related to errors or conditions that popped off during the device self-test operation, in the exact same format used in the Status Code Type field of the completion queue entry (go look atenum nvme_status_field). valid only when the NSID Valid bit (#NVME_ST_VALID_DIAG_INFO_SCT) is set in the Valid Diagnostic Information (vdi) field. πscβ Status Code. same energy: may contain additional info about errors or conditions that occurred during the device self-test operation, formatted the same way as the Status Code field of the completion queue entry. valid only when the SCT Valid bit (#NVME_ST_VALID_DIAG_INFO_SC) is set in the Valid Diagnostic Information (vdi) field. π₯vsβ Vendor Specific. that's a you-and-your-vendor situation, not my business, not my problem. π¦
fr fr the theme of this whole struct: half these fields are only valid if the matching bit invdiis set. checkvdifirst or you're reading vibes, not data. π
okay that's the whole page! main character energy from start to finish πβ¨ππ¦πΈπ π«Ά
this lil masterpiece is struct nvme_st_result, from the libnvme(2) API Manual, dated July 2026 β love that for us, stan a maintained manpage, and bestie pls go run a self-test on your drive and check on it, it misses you π
π¦ 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