libnvmf\_registry\_device\_for\_each(9) libnvme API manual libnvmf\_registry\_device\_for\_each(9)

# [NAME](#NAME)

libnvmf\_registry\_device\_for\_each - Iterate over live controller registry entries

# [SYNOPSIS](#SYNOPSIS)

**int libnvmf\_registry\_device\_for\_each** **(struct libnvme\_global\_ctx \*ctx ,** **int (\*callback)(const char \*device, void \*user\_data) ,** **void \*user\_data );**

# [ARGUMENTS](#ARGUMENTS)

[ctx](#ctx)

libnvme global context; must not be NULL

[callback](#callback)

Callback invoked for each live entry

[user\_data](#user_data)

User data passed to *callback*

# [DESCRIPTION](#DESCRIPTION)

Scans the registry directory and invokes *callback* for each entry whose corresponding /dev/nvmeN device node exists. Stale entries left behind after a controller is removed are silently skipped. The existence check is advisory: a device may be removed between the check and callback invocation; callers should handle ENOENT gracefully.

# [RETURN](#RETURN)

0 on success, negative errno if the registry directory cannot be opened. Returns 0 when the directory does not exist (nothing registered).

libnvmf\_registry\_device\_for\_each October 2026

---

Document: libnvmf_registry_device_for_each-libnvme3(2) from nvme-cli 3.2-r0 (Chainguard OS)
Source: https://github.com/linux-nvme/nvme-cli
