scsi_vpd_lun_id(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– scsi_vpd_lun_id πŸ’–

okay so bestie, we're in the Kernel API Manual today and the star of the show is scsi_vpd_lun_id β€” the little function that goes "here's your unique device identification, mwah" πŸŽ€


✨ SYNOPSIS ✨

int scsi_vpd_lun_id (struct scsi_device *sdev , char *id , size_t id_len
);

like, that's the whole vibe. three args, one int coming back at you. slay. πŸ’…


🌸 ARGUMENTS 🌸

  • sdev β€” the SCSI device in question πŸ¦‹ the main character, fr fr
  • id β€” the buffer where the identification gets dropped πŸŽ€ that's where the magic goes
  • id_len β€” length of the buffer, aka how much room id actually has to work with πŸ“

πŸ’œ DESCRIPTION πŸ’œ

So what it does: it copies a unique device identification into id, based on the info chilling in VPD page 0x83 of the device. The string gets formatted as a SCSI name string. no cap, that's the format ✨

Then it returns the length of the identification β€” or an error if something went sideways 😭

and here's the part where you gotta pay attention bestie πŸ‘€ if the identifier is longer than the buffer you supplied, the function returns the actual identifier length and the buffer is not zero-padded. not me being dramatic, that's literally just what it does. so like, size your buffer right or don't come crying to me πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./drivers/scsi/scsi_lib.c, plus this whole friend group right here 🫢:


and that's the page, bestie!! this one comes to you from ./drivers/scsi and it's dated October 2026 β€” go read it again whenever you need a lil unique device identification in your life. periodt. πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from