NVME_MI_ADMIN_GET_ANA_LOG_ATOMIC(2)

✨ nvme_mi_admin_get_ana_log_atomic ✨

okay bestie, buckle up, because this is a little function from the libnvme API manual (that's section 2, the syscalls-and-library-calls girlies) and it's literally the way to yoink the Asymmetric Namespace Access log page β€” atomically, no cap. πŸ¦‹


🌸 NAME 🌸

nvme_mi_admin_get_ana_log_atomic β€” Retrieve Asymmetric Namespace Access log page atomically πŸ’…


🌈 SYNOPSIS 🌈

int nvme_mi_admin_get_ana_log_atomic (nvme_mi_ctrl_t ctrl , bool rgo ,
       bool rae , unsigned int retries , struct nvme_ana_log *log , __u32 *len
       );

πŸŽ€ ARGUMENTS πŸŽ€

  • ctrl β€” the Controller you wanna query, periodt. that's your main character.
  • rgo β€” whether to retrieve ANA groups only, like, no NSIDs invited to the party. πŸ™ˆ
  • rae β€” whether to retain asynchronous events. yes queen, hold onto those events.
  • retries β€” the maximum number of times to retry when the log page keeps changing on you. it's giving "try again bestie" energy. πŸ”₯
  • log β€” pointer to a buffer that's gonna receive the ANA log page. this is where the tea gets poured. πŸ“
  • len β€” okay so this one is doing double duty: on input it's the length of the log page buffer, and on output it's the actual length of the ANA log page. she contains multitudes. ✨

πŸ’– DESCRIPTION πŸ’–

See struct nvme_ana_log for the definition of the returned structure. that's the blueprint for what you're getting back, iykyk. 🫢


⭐ RETURN ⭐

  • If everything slays: returns 0 and sets *len to the actual log page length. πŸŽ‰
  • If it does NOT slay: returns the nvme command status if a response was received (see enum nvme_status_field), or -1 with errno set otherwise.

and now the errno drama, because there is so much:

  • Sets errno = EINVAL if retries == 0. like, you asked for zero retries, girl, be so fr. 😭
  • Sets errno = EAGAIN if it was unable to read the log page atomically because chgcnt changed during each of the retries attempts. the page kept moving. not me getting ghosted by a log page. πŸ’€
  • Sets errno = ENOSPC if the full log page does not fit in the provided buffer. your buffer is too small and the log page is too iconic for it. πŸ‘‘
heads up bestie: if the atomic read just cannot happen because chgcnt flips on every single retry, you're getting EAGAIN, and there is no magic fix, you just gotta go again. 🌈

July 2026 energy, libnvme API manual source, and that's the whole vibe check β€” go read that ANA log page atomically, you absolute legend. πŸ’œπŸ§š

πŸ“¦ where this page comes from