NILFS_MAX_VOLUME_NAME(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… NILFS_MAX_VOLUME_NAME(9) β€” a little kernel-API moment, from the Kernel API Manual ✨

okay so bestie, come sit with me, because today's main character is a macro and honestly? she's iconic in the most lowkey way πŸŽ€

🌸 NAME 🌸

NILFS_MAX_VOLUME_NAME β€” the maximum number of characters (bytes) that can fit in a file system volume name πŸ¦‹

✨ SYNOPSIS ✨

NILFS_MAX_VOLUME_NAME

that's it. that's the whole vibe. no args, no drama, just a constant living her life πŸ’…

πŸ’– DESCRIPTION πŸ’–

so where does this number even come from? it's defined by the size of the volume name field in the on-disk superblocks β€” aka the actual space reserved on disk, no cap πŸ’€

and here's the part you cannot skip, bestie: this volume name does not include the terminating NULL byte if the string length matches the field size. read that again. the NULL is not included when the string is exactly as long as the field. rude? maybe. true? absolutely πŸ™ˆ

so if you're building a buffer that actually needs a NULL byte termination, you gotta do the little +1 dance and use (NILFS_MAX_VOLUME_NAME + 1) as your buffer size. one extra byte, zero extra stress, periodt πŸ‘‘

bestie warning fr fr: forget the +1 and your buffer's NULL terminator has nowhere to live. it's giving "undefined behavior at 3am" 😭

🌈 SEE ALSO 🌈

  • Kernel file ./fs/nilfs2/nilfs.h struct nilfs_inode_info(9), struct nilfs_transaction_info(9) β€” go look at the source, it's cute over there 🫢

and that's the page, bestie! πŸ’œ this lil' gem comes from ./fs/nilfs2 and it's dated October 2026 β€” okay slay, see you in the next NILFS_MAX_VOLUME_NAME(9) moment βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from