NVME_GET_LOGICAL_BLOCK_SIZE(2)
β¨ NAME β¨
nvme_get_logical_block_size β bestie, this is the one that gets you the block size π
It lives in the libnvme API manual, section 2, and honestly? it's giving tiny-but-mighty.
πΈ SYNOPSIS πΈ
int nvme_get_logical_block_size (int fd , __u32 nsid , int *blksize );
Like. That's it. Three args. She's lowkey minimalist. π
π ARGUMENTS π
fdβ the file descriptor of your nvme device. Your little β¨portalβ¨ into the drive, fr fr.nsidβ the namespace id. Which namespace are we asking about, bestie? Gotta be specific. πblksizeβ a pointer to where the block size gets set on success. She doesn't return it to you, she writes it into your pointer. Main character energy, honestly. π«Ά
π RETURN π
So here's the vibe check on what comes back:
- If a response was received, you get the nvme command status β peep
enum nvme_status_fieldfor the whole menu of possibilities. - Otherwise you get
-1anderrnois set. Not a slay. π
Not me needing to remind you: always check your return value, bestie.-1without checkingerrnois a crime and I will be telling everyone. π
π SEE ALSO π
Nothing extra listed here, bestie β just enum nvme_status_field, which got a whole shoutout up in RETURN. Go read it. It's iconic. β
Okay that's the whole page, no cap. This little beauty comes from the libnvme API manual, and the version we're looking at is dated July 2026. π¦ Thanks for reading, mwah, go call nvme_get_logical_block_size and get your block size, queen. πβ¨π
π¦ 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