scsi_mode_sense(9)
π scsi_mode_sense β the kernel API manual, bestie edition π
okay so real talk, this is scsi_mode_sense(9), a page from the Kernel API Manual, and it is genuinely about issuing a mode sense β and, icon behavior, it falls back from ten bytes to six bytes if it has to. lowkey resilient. we stan a flexible king π
β¨ SYNOPSIS β¨
int scsi_mode_sense (struct scsi_device *sdev , int dbd , int modepage ,
int subpage , unsigned char *buffer , int len , int timeout , int
retries , struct scsi_mode_data *data , struct scsi_sense_hdr *sshdr );
like, ten arguments. ten. she's high maintenance but she delivers π and yes, that signature is copied exactly, do not come for me.
πΈ ARGUMENTS πΈ
okay bestie, here's the whole lineup, every single one, no skipping:
sdevβ the SCSI device we're querying. the main character of this operation π«Άdbdβ set this bad boy to prevent mode sense from returning block descriptors. it's giving "no block descriptors, please" πmodepageβ which mode page you're requesting. like ordering off a menu, but scarier.subpageβ the sub-page of the mode page you requested. yes there's a sub-level, it's very inception π«bufferβ your request buffer. heads up: it may not be smaller than eight bytes. eight! that's the floor, no exceptions, she will not budge β οΈlenβ length of the request buffer. (yes, the period is in the original, we keep the period, periodt π)timeoutβ command timeout, i.e. how long we're willing to sit here waiting and hoping β¨retriesβ number of retries before failing. how many chances we give it before we accept reality πdataβ returns a structure abstracting the mode header data. she returns things. a giver πsshdrβ where to put the sense data (orNULLif no sense is to be collected). must beSCSI_SENSE_BUFFERSIZEbig β no cap, that's a hard requirement, do not mess with the sizing π₯
π¦ DESCRIPTION π¦
Returns zero if successful, or a negative error number on failure. that's it, that's the whole description. iconic minimalism honestly. zero = slay, negative = not slay π
π SEE ALSO π
this list is LONG and we are NOT skipping a single one, so buckle up bestie, they're all living in the kernel file ./drivers/scsi/scsi_lib.c:
__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_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_id(9)scsi_vpd_lun_serial(9)scsi_vpd_tpg_id(9)scsi_build_sense(9)
like, forty-ish functions. she has a LOT of friends, and honestly? good for her π
okay that's the whole page, you made it, I'm so proud π«Ά this one lives in ./drivers/scsi and it's dated October 2026, so go forth and mode sense responsibly, bestie. mwah πβ¨π
π¦ 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