translate_sense_reason(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… translate_sense_reason(9)

okay so bestie, welcome to the kernel API manual for translate_sense_reason β€” a little function living its best life in the <pink>Kernel API Manual</pink> section 9 of the man pages. Sit down, hydrate, and let's get into it 🫢


✨ NAME ✨

translate_sense_reason β€” translate a sense reason into T10 key, asc and ascq 🌸

Like, it takes your vibe-y internal reason code and turns it into the actual SCSI sense trio the world can read. It's giving translator bestie. πŸŽ€


✨ SYNOPSIS ✨

void translate_sense_reason (struct se_cmd *cmd , sense_reason_t reason );

No cap, that's the whole signature. Copy it exactly, don't get creative with it πŸ’…


✨ ARGUMENTS ✨

  • cmd β€” the SCSI command in which the resulting sense buffer or SCSI status will be stored. Basically it's the lucky little command struct that gets to hold the receipts πŸ“₯✨
  • reason β€” the LIO sense reason code. And okay, real talk, there's a spicy special case here: if this argument has the value TCM_CHECK_CONDITION_UNIT_ATTENTION, the function tries to dequeue a unit attention. But β€” and hear me β€” if dequeuing a unit attention fails because multiple commands are being processed concurrently, it sets the command status to BUSY. Concurrency said "not today" πŸ’€

✨ RETURN ✨

0 upon success, or -EINVAL if the sense buffer is too small 😭

So if the sense buffer is too small, that's a -EINVAL, not a crash, not a shrug. Respect the buffer size, bestie. πŸ™ˆ

✨ SEE ALSO ✨

The kernel file lives at ./drivers/target/target_core_transport.c β€” go say hi πŸ¦‹

and obviously the whole friend group 🫢:


that's the whole page, icon, go forth and translate those sense reasons ✨

sign-off incoming: this one's filed under ./drivers/target, dated October 2026 β€” mwah, bye bestie πŸ’–πŸ‘‘

πŸ“¦ where this page comes from