libnvme\_set\_test\_base\_dir(9) libnvme API manual libnvme\_set\_test\_base\_dir(9)

# [NAME](#NAME)

libnvme\_set\_test\_base\_dir - Reroot libnvme's on-disk files for testing

# [SYNOPSIS](#SYNOPSIS)

**int libnvme\_set\_test\_base\_dir** **(struct libnvme\_global\_ctx \*ctx ,** **const char \*path );**

# [ARGUMENTS](#ARGUMENTS)

[ctx](#ctx)

*struct libnvme\_global\_ctx* object

[path](#path)

Sandbox directory under /tmp, or NULL to restore defaults

# [DESCRIPTION](#DESCRIPTION)

Redirects the files libnvme reads and writes (the exclusion list, the ownership registry, ...) under *path* instead of their production locations, so a test can run against a throwaway directory. For safety *path* must be confined to /tmp and contain no ".." component; anything else is rejected. Passing NULL clears a previously set override.

# [RETURN](#RETURN)

0 on success, -EINVAL if *ctx* is NULL or *path* is not a valid sandbox path, -ENOMEM on allocation failure.

libnvme\_set\_test\_base\_dir September 2026

---

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