scsi_vpd_lun_id(9)
π 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 fridβ the buffer where the identification gets dropped π that's where the magic goesid_lenβ length of the buffer, aka how much roomidactually 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 π«Ά:
__scsi_queue_insert(9)scsi_queue_insert(9)scsi_failures_reset_retries(9)scsi_check_passthrough(9)scsi_execute_cmd(9)scsi_run_queue(9)scsi_result_to_blk_status(9)scsi_rq_err_bytes(9)scsi_io_completion(9)scsi_alloc_sgtables(9)scsi_initialize_rq(9)scsi_alloc_request(9)scsi_dispatch_cmd(9)scsi_get_internal_cmd(9)scsi_put_internal_cmd(9)scsi_device_from_queue(9)scsi_block_requests(9)scsi_unblock_requests(9)scsi_mode_select(9)scsi_mode_sense(9)scsi_test_unit_ready(9)scsi_device_set_state(9)scsi_evt_emit(9)scsi_evt_thread(9)sdev_evt_send(9)sdev_evt_alloc(9)sdev_evt_send_simple(9)scsi_device_quiesce(9)scsi_device_resume(9)scsi_internal_device_block_nowait(9)scsi_device_block(9)scsi_internal_device_unblock_nowait(9)scsi_internal_device_unblock(9)scsi_block_targets(9)scsi_host_block(9)scsi_kmap_atomic_sg(9)scsi_kunmap_atomic_sg(9)scsi_vpd_lun_serial(9)scsi_vpd_tpg_id(9)scsi_build_sense(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms