scsi_device_lookup(9)
β¨ scsi_device_lookup(9) β¨
okay so real talk, this one is from the Kernel API Manual (yes, the kernel has lore π
) and it's genuinely iconic: scsi_device_lookup β find a device given the host. bestie, it's giving "where's my SCSI device" but make it a function call π¦
πΈ NAME πΈ
scsi_device_lookup β find a device given the host π
π SYNOPSIS π
struct scsi_device * scsi_device_lookup (struct Scsi_Host *shost , uint
channel , uint id , u64 lun );
π ARGUMENTS π
shostβ the SCSI host pointer, aka the main character of this whole operation πchannelβ the SCSI channel (it'szeroif there's only one channel, so don't overthink it)idβ the SCSI target number (the physical unit number, for the record)lunβ the SCSI Logical Unit Number, no cap
π DESCRIPTION π
So what it does: it looks up the scsi_device with the specified channel, id, lun for a given host. literally that's it, that's the vibe check β¨
β οΈ okay listen, this part is important: the returnedscsi_devicehas an additional reference that needs to be released withscsi_device_putonce you're done with it. not me reminding you to clean up your references π if you forget, that's a leak and the kernel will simply not be slaying. release it, periodt π
π¦ SEE ALSO π¦
Kernel file ./drivers/scsi/scsi.c β and like, all of these besties:
scsi_finish_command(9)scsi_change_queue_depth(9)scsi_track_queue_full(9)scsi_vpd_inquiry(9)scsi_get_vpd_page(9)scsi_get_vpd_buf(9)scsi_attach_vpd(9)scsi_report_opcode(9)scsi_cdl_check(9)scsi_cdl_enable(9)scsi_device_get(9)scsi_device_put(9)starget_for_each_device(9)__starget_for_each_device(9)__scsi_device_lookup_by_target(9)scsi_device_lookup_by_target(9)__scsi_device_lookup(9)
and that's the whole page, bestie π«Ά this one lives in ./drivers/scsi and it's dated October 2026 β so mark your calendars, screenshot it, whatever you gotta do π iykyk π§
π¦ 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