sas_port_alloc(9)
π sas_port_alloc(9) β the Kernel API Manual, bestie edition
okay so before we even start: yes this is the Kernel API Manual, section 9, and yes it's a whole page about one function. iconic of it honestly. let's get into it π
β¨ NAME β¨
sas_port_alloc β allocate and initialize a SAS port structure π
like, it makes one. from scratch. and then it wakes it up. that's the whole gig.
β¨ SYNOPSIS β¨
struct sas_port * sas_port_alloc (struct device *parent , int port_id );
look at her. two args. very demure. very mindful. π¦
β¨ ARGUMENTS β¨
parentβ the parent device π β like, the device this little port is gonna call mom.port_idβ the port number π’ β that's literally it, it's the number of the port, no cap.
β¨ DESCRIPTION β¨
So sas_port_alloc allocates a SAS port structure. simple as that. π
the tea though: it gets added to the device tree below the device you passed in as parent. so your parent isn't just vibes, it's actually load-bearing. π«Ά
β οΈ okay important, don't skip this:parentmust be either aScsi_Hostor asas_expander_device. anything else and it's not giving what it needs to give. that's a hard requirement, fr fr.
β¨ RETURN β¨
it returns NULL on error π
so like... if you get NULL back, something went wrong. that's the whole return contract. no extra lore, no secret codes. NULL = error. periodt. π
β¨ SEE ALSO β¨
Kernel file ./drivers/scsi/scsi_transport_sas.c β that's where she lives, that's her home address π β¨
and now the whole extended friend group, because SAS kernel stuff travels in a pack π:
sas_remove_children(9)sas_remove_host(9)sas_get_address(9)sas_tlr_supported(9)sas_disable_tlr(9)sas_enable_tlr(9)sas_ata_ncq_prio_supported(9)sas_phy_alloc(9)sas_phy_add(9)sas_phy_free(9)sas_phy_delete(9)scsi_is_sas_phy(9)sas_port_alloc_num(9)sas_port_add(9)sas_port_free(9)sas_port_delete(9)scsi_is_sas_port(9)sas_port_get_phy(9)sas_port_add_phy(9)sas_port_delete_phy(9)sas_rphy_initialize(9)sas_end_device_alloc(9)sas_expander_alloc(9)sas_rphy_add(9)sas_rphy_free(9)sas_rphy_delete(9)sas_rphy_unlink(9)sas_rphy_remove(9)scsi_is_sas_rphy(9)sas_attach_transport(9)sas_release_transport(9)
that's the whole group chat, nobody got left on read π«Άπ
π cute little sign-off π
this page lives in ./drivers/scsi and it's stamped October 2026 β so bestie, go forth, allocate that port, and remember: NULL means error, and error means come back and read the SEE ALSO list again. slay π
β¨πΈ
π¦ 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