Skip to content

libnvme: rename nvmf_ API prefix to libnvmf_#3263

Merged
igaw merged 1 commit intolinux-nvme:masterfrom
igaw:prefix-libnvmf
Apr 10, 2026
Merged

libnvme: rename nvmf_ API prefix to libnvmf_#3263
igaw merged 1 commit intolinux-nvme:masterfrom
igaw:prefix-libnvmf

Conversation

@igaw
Copy link
Copy Markdown
Collaborator

@igaw igaw commented Apr 10, 2026

Use the libnvme_ prefix for the library fabrics API. This makes this part of the library consistent with the other parts. The spec API uses nvme_, the rest libnvme_.

Use the libnvme_ prefix for the library fabrics API. This makes this
part of the library consistent with the other parts. The spec API uses
nvme_, the rest libnvme_.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR renames the NVMe-oF (fabrics) library API prefix from nvmf_ to libnvmf_ to align the fabrics layer with the rest of libnvme’s libnvme_*-prefixed APIs, while keeping the spec-facing API under nvme_*.

Changes:

  • Renamed public fabrics APIs and types (nvmf_*libnvmf_*) across headers, implementation, CLI, plugins, examples, and tests.
  • Renamed the generated fabrics accessor artifacts and corresponding Meson/tooling references (nvmf-accessors.* / nvmf-accessors.ldaccessors-fabrics.* / accessors-fabrics.ld).
  • Updated documentation to reflect the new filenames and API names.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
util/cleanup.h Updates URI/context cleanup helpers to call libnvmf_* APIs and use struct libnvmf_context.
README.md Updates accessor-generation documentation to new fabrics accessor filenames.
plugins/nbft/nbft-plugin.c Switches NBFT helper calls to libnvmf_nbft_*.
nvme-print-stdout.c Replaces discovery string helpers with libnvmf_* variants (stdout formatting paths).
nvme-print-json.c Replaces discovery string helpers with libnvmf_* variants (JSON formatting paths).
libnvme/tools/generator/meson.build Updates generator target outputs to accessors-fabrics.{h,c} and accessors-fabrics.ld.
libnvme/tools/check-public-symbols.py Updates symbol-check input list to accessors-fabrics.ld.
libnvme/test/uriparser.c Updates URI free call to libnvmf_free_uri.
libnvme/test/tree.c Renames fabrics context struct usage to struct libnvmf_context.
libnvme/test/ioctl/discovery.c Renames discovery args and discovery log APIs to libnvmf_*.
libnvme/src/nvme/util.h Renames exported EXAT iterator declaration to libnvmf_exat_ptr_next.
libnvme/src/nvme/util.c Renames exported EXAT iterator definition to libnvmf_exat_ptr_next.
libnvme/src/nvme/tree.c Renames fabrics config init and context type usage to libnvmf_*.
libnvme/src/nvme/private.h Renames internal fabrics context struct to struct libnvmf_context and updates callbacks/prototypes.
libnvme/src/nvme/private-fabrics.h Renames generated-accessors struct to struct libnvmf_discovery_args and updates comment references.
libnvme/src/nvme/json.c Updates local context type to struct libnvmf_context.
libnvme/src/nvme/fabrics.h Renames public fabrics API prototypes and related opaque types to libnvmf_*.
libnvme/src/nvme/fabrics.c Renames public fabrics API implementations and internal call sites to libnvmf_*.
libnvme/src/nvme/cleanup.h Updates URI cleanup helper to call libnvmf_free_uri.
libnvme/src/nvme/accessors-fabrics.h Updates generated accessor header guard and renames accessor APIs to libnvmf_*.
libnvme/src/nvme/accessors-fabrics.c Updates generated accessor implementation to include new header and rename accessor APIs.
libnvme/src/meson.build Switches build inputs to accessors-fabrics.{h,c} and updates fabrics include list.
libnvme/src/libnvmf.ld Renames exported fabrics symbols listed under the LIBNVMF_3 version block to libnvmf_*.
libnvme/src/accessors-fabrics.ld Renames exported accessor symbols under LIBNVMF_ACCESSORS_3 to libnvmf_*.
libnvme/README.md Updates accessor generation docs and .ld references to new fabrics filenames.
libnvme/libnvme/nvme.i Updates SWIG/Python bindings to call libnvmf_* APIs and use struct libnvmf_discovery_args.
libnvme/examples/discover-loop.c Updates example to use libnvmf_* discovery APIs.
fabrics.c Updates nvme-cli fabrics command implementation to use libnvmf_* APIs and struct libnvmf_context.
Comments suppressed due to low confidence (1)

libnvme/src/accessors-fabrics.ld:16

  • LIBNVMF_ACCESSORS_3 now exports only libnvmf_* accessor symbols. If LIBNVMF_ACCESSORS_3 is already part of a released ABI, removing the previous nvmf_* symbol names is ABI-breaking for existing consumers. Keep the old accessor symbol names under the existing version and add the new ones under a new symbol version, or provide exported compatibility aliases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +6654 to 6655
if (inet_ntop(af, libnvmf_adrfam_str(adrfam), dst, size))
printf("%s: %s\n", field, dst);
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print_traddr() ignores its traddr argument and passes libnvmf_adrfam_str(adrfam) (a decoded string like "ipv4") as the address buffer to inet_ntop(). This will produce incorrect output and may read unrelated memory. Use traddr (the raw address bytes) as the second argument to inet_ntop(); if traddr is already a NUL-terminated string, drop the inet_ntop() conversion entirely and print it directly.

Copilot uses AI. Check for mistakes.
}

if (inet_ntop(af, nvmf_adrfam_str(adrfam), dst, size))
if (inet_ntop(af, libnvmf_adrfam_str(adrfam), dst, size))
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

obj_add_traddr() ignores its traddr parameter and passes libnvmf_adrfam_str(adrfam) (a human-readable string) as the address buffer to inet_ntop(). This will yield invalid results. Pass traddr (raw address bytes) to inet_ntop() instead, or if traddr is already a string, skip inet_ntop() and add it directly.

Suggested change
if (inet_ntop(af, libnvmf_adrfam_str(adrfam), dst, size))
if (inet_ntop(af, traddr, dst, size))

Copilot uses AI. Check for mistakes.
@igaw igaw merged commit da2f1b1 into linux-nvme:master Apr 10, 2026
33 checks passed
@igaw igaw deleted the prefix-libnvmf branch April 10, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants