nvme_ns_detach_ctrls(2)

✨ nvme_ns_detach_ctrls ✨

okay so bestie, we're in the libnvme API manual today and this one is called nvme_ns_detach_ctrls πŸ’… it's a function, it's a whole vibe, and it does exactly one thing but it does it iconically.


🌸 NAME 🌸

nvme_ns_detach_ctrls β€” detach a namespace from controllers, no cap 🫢

like literally, it unhooks an nsid from the controllers you hand it. it's giving "we are no longer associated, periodt" πŸ’€


πŸŽ€ SYNOPSIS πŸŽ€

int nvme_ns_detach_ctrls (int fd , __u32 nsid , struct nvme_ctrl_list
*ctrlist );

three args, one int coming back at you, that's the whole story ✨


πŸ¦‹ ARGUMENTS πŸ¦‹

  • fd β€” the file descriptor of the nvme device, bestie. your golden ticket 🎫 it's an int, it's the door, walk through it.
  • nsid β€” the Namespace ID you wanna detach. it's a __u32 and it's the main character of this whole operation, honestly πŸ‘‘
  • ctrlist β€” a struct nvme_ctrl_list *, aka the controller list whose attachment state for nsid is getting modified. this is the guest list and you're the bouncer πŸšͺ✨

🌈 RETURN 🌈

here's the tea β˜• this function gives you back the nvme command status if a response was received β€” check enum nvme_status_field for the deets, iykyk.

but if it did not get a response? you get -1 and errno is set. so like, always check your errno, bestie, don't be that girl πŸ™ˆ


⚠️ real talk: -1 with errno set means the call itself flubbed before a proper command status could come back. don't go reading the return value as a status field when it's literally -1. vibe check your error path first πŸ’–

and that's the whole page, mwah 😘 no extra lore, no secret options, just these exact three args and that return value.

libnvme API manual energy, dated July 2026, and yeah the function shares its name with the page twice because manpages are extra like that πŸ’… slay, go detach some namespaces responsibly, ily πŸ«Άβœ¨πŸŒ™

πŸ“¦ where this page comes from