target_init_cmd(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« target_init_cmd(9) β€” like, the glow-up era of se_cmd πŸ’«

okay so bestie, welcome to the Kernel API Manual, section 9 β€” yes we're in the kernel functions section, we're fancy now πŸŽ€. This is the page for target_init_cmd, and honestly? It's giving "set up the command descriptor before anything else happens." Main character energy for sure ✨


🌸 NAME 🌸

target_init_cmd β€” initialize se_cmd πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

int target_init_cmd (struct se_cmd *se_cmd , struct se_session *se_sess
, unsigned char *sense , u64 unpacked_lun , u32 data_length , int
task_attr , int data_dir , int flags );

Like, that's a lot of arguments babe, but every single one of them is doing its job, no cap. 🫢


✨ ARGUMENTS ✨

  • se_cmd β€” the command descriptor you're init-ing. She's the one getting set up πŸŽ€
  • se_sess β€” the associated se_sess for the endpoint.
  • sense β€” pointer to the SCSI sense buffer.
  • unpacked_lun β€” the unpacked LUN to reference for struct se_lun.
  • data_length β€” the fabric expected data transfer length.
  • task_attr β€” the SAM task attribute.
  • data_dir β€” the DMA data direction.
  • flags β€” flags for command submission, from target_sc_flags_tables.

πŸ’œ DESCRIPTION πŸ’œ

Task tags are supported if the caller has set se_cmd->tag. iykyk 😌

Now this next bit is important, so listen up bestie πŸ‘‘ β€” if the fabric driver calls target_stop_session, then it must check the return code and handle failures. Like, actually handle them, not just vibe past them πŸ™ˆ. This will never fail for other drivers, and for those the return code can just be ignored. Casual. πŸ’…


πŸ”₯ RETURN πŸ”₯

  • less than zero β†’ signals an active I/O shutdown failure 😭
  • zero β†’ success, we ate, periodt ⭐

🌈 SEE ALSO 🌈

Kernel file ./drivers/target/target_core_transport.c

transport_init_session(9), transport_alloc_session(9), transport_alloc_session_tags(9), transport_init_session_tags(9), target_cmd_size_check(9), target_submit_prep(9), target_submit_cmd(9), target_queue_submission(9), target_submit(9), target_submit_tmr(9), target_get_sess_cmd(9), target_put_sess_cmd(9), target_stop_cmd_counter(9), target_stop_session(9), target_wait_for_cmds(9), target_wait_for_sess_cmds(9), transport_wait_for_tasks(9), translate_sense_reason(9), target_send_busy(9)


ok that's the whole page bestie, go forth and init those commands πŸ’–

🌷 that's a wrap! brought to you by the source tree at /drivers/target πŸ’–, dated October 2026, slaying in section 9 of the Kernel API Manual β€” mwah, ily, bye 🫢✨🌸

πŸ“¦ where this page comes from