scsi_ioctl(9)
π scsi_ioctl β like, the kernel API manual page, bestie
okay so this is scsi_ioctl(9) from the Kernel API Manual, and honestly? she's iconic, she's a little different from the other ioctls, and we're gonna get into all of it. grab a snack π
β¨ NAME β¨
scsi_ioctl β dispatch ioctl to scsi device
like, she takes your ioctl and yeets it to the right scsi device. that's the whole job. main character energy fr fr π
π¦ SYNOPSIS π¦
int scsi_ioctl (struct scsi_device *sdev , bool open_for_write , int cmd
, void __user *arg );
copy it exactly, don't @ me β the spacing in there is canon π
πΈ ARGUMENTS πΈ
sdevβ the scsi device receiving the ioctl. she's the one getting the message π«Άopen_for_writeβ is the file / block device opened for writing? yes/no, that's the whole vibe check herecmdβ which ioctl is it. like, which one. be specific πargβ the data associated with the ioctl. what she's carrying in her little bag β¨
π DESCRIPTION π
okay so here's the thing that makes scsi_ioctl lowkey special: it differs from most ioctls in that it does not take a major/minor number as the dev field. nope. not her.
rather, it takes a pointer to a struct scsi_device. that's it. that's the flex. instead of the usual dev-number situation, you hand her the actual struct scsi_device pointer and she's like "got it, say less" π
ngl it's giving "different from the other girls" and I mean that in the best way π
π₯ RETURN π₯
varies depending on the cmd ππ
like... it literally varies. depends on which cmd you passed. no single answer, bestie. that's just how she is. check your specific cmd and act accordingly β no cap π
β SEE ALSO β
- Kernel file
./drivers/scsi/scsi_ioctl.cβ the source, go read her π ioctl_probe(9)scsi_set_medium_removal(9)scsi_cmd_allowed(9)sg_scsi_ioctl(9)scsi_ioctl_block_when_processing_errors(9)
all of these are the girlies you should also be looking at, iykyk π
π§ sign-off π§
this lil page lives under ./drivers/scsi, dated October 2026 β that's the source/version and date, and yes I'm telling you about them instead of copy-pasting the footer line, because we're cute like that π
now go dispatch some ioctls, you absolute icon βππ
π¦ 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