libnvmf\_context\_set\_devid\_file(9) libnvme API manual libnvmf\_context\_set\_devid\_file(9)

# [NAME](#NAME)

libnvmf\_context\_set\_devid\_file - Set devid file for context

# [SYNOPSIS](#SYNOPSIS)

**int libnvmf\_context\_set\_devid\_file** **(struct libnvmf\_context \*fctx ,** **const char \*devid\_file );**

# [ARGUMENTS](#ARGUMENTS)

[fctx](#fctx)

Fabrics context

[devid\_file](#devid_file)

Path to the output file

# [DESCRIPTION](#DESCRIPTION)

Configure a file that **libnvmf\_connect** uses to record the kernel-assigned device name (for example, "nvme0").

If the controller is already connected, the existing device name is written. Otherwise, the device name is written after the controller is connected.

The output file is created before attempting the connection. If the file cannot be created, for example because the parent directory does not exist, **libnvmf\_connect** fails without attempting the connection.

This is intended for applications that need to identify the device associated with a connection, for example to disconnect it later.

# [RETURN](#RETURN)

0 on success, negative error code otherwise.

libnvmf\_context\_set\_devid\_file September 2026

---

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