sd_format_disk_name(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ sd_format_disk_name β€” the Kernel API Manual glow-up πŸŽ€

okay so bestie, this is a page from the Kernel API Manual, and it's about the little function that literally names your SCSI disks. yes, the sda, sdb... sdaa girlies. she's iconic, she's tiny, she's doing base-26 math in a trench coat. πŸ’…


✨ NAME ✨

sd_format_disk_name β€” format disk name πŸ’–


✨ SYNOPSIS ✨

int sd_format_disk_name (char *prefix , int index , char *buf , int
buflen );

that's the whole vibe right there. 🫢


✨ ARGUMENTS ✨

  • prefix β€” the name prefix, like, the starter pack of the name. the manpage's example is "sd" for SCSI disks. πŸŽ€
  • index β€” the index of the disk you want to format a name for, i.e. which number in the lineup she is.
  • buf β€” the output buffer. this is where the finished name gets dropped. ✨
  • buflen β€” the length of the output buffer, bestie. gotta know how much room you have.

✨ DESCRIPTION ✨

okay so SCSI disk names start at sda. πŸ‘‘

the 26th device is sdz, and the 27th is sdaa. the last one with a two-lettered suffix is sdzz, and after that comes sdaaa. the way she just keeps going... main character energy fr fr. 🌈

this is basically 26 base counting with one extra 'nil' entry at the beginning, starting from the second digit on. and it can be determined using a similar method as 26 base conversion, with the index shifted -1 after each digit is computed. no cap, that's the actual algorithm described here. 🧚


✨ CONTEXT ✨

"Don't care." πŸ’€ that's it. that's the whole context section. she said not my problem, and honestly? respect. πŸ™ˆ


✨ RETURN ✨

  • 0 on success 🌸
  • -errno on failure 😭

✨ SEE ALSO ✨

before you go, the kernel file is at ./drivers/scsi/sd.c and she's got a whole friend group β€” go say hi to:

sd_group_number(9), sd_open(9), sd_release(9), sd_ioctl(9), sd_check_events(9), sd_eh_reset(9), sd_eh_action(9), sd_done(9), sd_read_block_provisioning(9), sd_read_cpr(9), sd_revalidate_disk(9), sd_unlock_native_capacity(9), sd_probe(9), sd_remove(9), init_sd(9), exit_sd(9) πŸ”₯


and that's the whole page, bestie! this one's hanging out under ./drivers/scsi, dated October 2026, and yeah β€” she's still sd_format_disk_name(9) in the Kernel API Manual. periodt. πŸ’œπŸ¦‹

πŸ“¦ where this page comes from