libnvmf_host_get_ids(9)
π libnvmf_host_get_ids(9) β your girl's guide to the libnvme API manual
okay so bestie, welcome to libnvmf_host_get_ids, a page from the libnvme API manual, and honestly it's giving "who am I and where do I come from" but for host IDs. let's go π
β¨ NAME β¨
libnvmf_host_get_ids β retrieve host ids from various sources π¦
β¨ SYNOPSIS β¨
int libnvmf_host_get_ids (struct libnvme_global_ctx *ctx , const char
*hostnqn_arg , const char *hostid_arg , char **hostnqn , char **hostid
);
like literally just copy that exactly, no cap π«Ά
β¨ ARGUMENTS β¨
ctxβ yourstruct libnvme_global_ctxobject, the main character of this whole function ngl πhostnqn_argβ the input hostnqn (command line) argument, aka the one you typed in βοΈhostid_argβ the input hostid (command line) argument, same vibe, different id πhostnqnβ output hostnqn; and listen, it may beNULLif the caller doesn't need it πhostidβ output hostid; also may beNULLif the caller doesn't need it, so no pressure π
β¨ DESCRIPTION β¨
so libnvmf_host_get_ids figures out which hostnqn/hostid is to be used. there are several sources where this information can be retrieved, and it checks them in order, like a little priority queue of identity π§
the order is:
- start with the hostnqn/hostid given on the command line (
hostnqn_arg,hostid_arg), if any πΈ - otherwise, use the first host already resolved in
ctx's host list, if any β - otherwise, use
ctx's own hostnqn/hostid default, or/etc/nvme/hostnqnand/etc/nvme/hostidifctxhas none π - otherwise, if hostnqn is known but hostid is not, and hostnqn has a
"uuid:"component, derive hostid from it π₯ - as a last resort, derive a still-missing hostid from DMI or device-tree information (or generate a random one), then build a hostnqn from that hostid if one is still missing π
the function also checks that hostnqn and hostid match, and logs a debug warning if they don't. the Linux NVMe implementation expects a 1:1 matching between the IDs β so yeah, they gotta be a matched set, periodt β¨
bestie be aware: mismatched IDs aren't an error here, you just get that debug warning logged. it's giving "we're not mad, we're just disappointed" π
β¨ RETURN β¨
0 on success β and when it succeeds, hostnqn and hostid contain valid strings which the caller needs to free, don't forget, that's your responsibility now π«Ά β or a negative error code otherwise π
and that's the whole page, bestie, you ate π
sign-off: this iconic little number lives in the libnvme API manual, dated October 2026, and it says libnvmf_host_get_ids at the bottom too, so you literally can't forget the name ππ see you in the next manpage, mwah π¦
π¦ where this page comes from
- arch rolling: nvme-cli 3.2-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms