fabrics: move URI data struct to private API#3278
Merged
igaw merged 2 commits intolinux-nvme:masterfrom Apr 16, 2026
Merged
Conversation
The next data structure to be moved out of the public API contains string arrays. Extend the generator to create getter/setters for this type. Signed-off-by: Daniel Wagner <wagi@kernel.org>
0d46064 to
8d7e57e
Compare
There was a problem hiding this comment.
Pull request overview
This PR makes the NVMe-oF URI parsed-data structure opaque (moved to private headers) and introduces generated getter/setter accessors so the URI representation can evolve without exposing its layout to public consumers.
Changes:
- Move the URI struct definition from the public fabrics header to
private-fabrics.hand forward-declare it publicly asstruct libnvmf_uri. - Rename/realign URI helper APIs (
libnvmf_uri_parse,libnvmf_uri_free) and update call sites/tests accordingly. - Extend the accessor generator to support
char **(NULL-terminated string arrays) and generate deep-copying setters.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| util/cleanup.h | Updates cleanup helper to free the renamed opaque URI type. |
| libnvme/tools/generator/generate-accessors.py | Adds char ** support and emits deep-copying setters + adjusted getters. |
| libnvme/tools/generator/generate-accessors.md | Documents new generator capability for string arrays. |
| libnvme/test/uriparser.c | Updates tests to use the new opaque URI API and accessors. |
| libnvme/src/nvme/private-fabrics.h | Introduces the private struct libnvmf_uri definition for internal use + accessor generation. |
| libnvme/src/nvme/fabrics.h | Removes public struct layout and exposes opaque type + renamed parse/free APIs. |
| libnvme/src/nvme/fabrics.c | Renames/updates the URI parser and free routine implementation and internal users. |
| libnvme/src/nvme/accessors-fabrics.h | Adds public accessor prototypes for struct libnvmf_uri. |
| libnvme/src/nvme/accessors-fabrics.c | Adds generated accessor implementations for struct libnvmf_uri. |
| libnvme/src/libnvmf.ld | Updates exported fabrics symbol names for the renamed URI APIs. |
| libnvme/src/libnvme.ld | Stops exporting libnvme_parse_uri. |
| libnvme/src/accessors-fabrics.ld | Exports the new libnvmf_uri_* accessors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Make the URI data structure opaque and provide getter/setters to allow modification and extension later. While at it, also rename it to match the naming scheme and update the helper functions accordingly. Signed-off-by: Daniel Wagner <wagi@kernel.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make the URI data structure opaque and provide getter/setters to allow modification and extension later.
While at it, also rename it to match the naming scheme and update the helper functions accordingly.