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_field for the whole menu of possibilities.
  • Otherwise you get -1 and errno is set. Not a slay. 😭
Not me needing to remind you: always check your return value, bestie. -1 without checking errno is 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