libnvme: add check-public-headers test and fix missing prototypes#3298
Merged
igaw merged 2 commits intolinux-nvme:masterfrom Apr 22, 2026
Merged
libnvme: add check-public-headers test and fix missing prototypes#3298igaw merged 2 commits intolinux-nvme:masterfrom
igaw merged 2 commits intolinux-nvme:masterfrom
Conversation
Three __public symbols were listed in the version scripts but had no
prototype in any installed header:
libnvme_mi_submit_entry() -- weak tracing hook in mi.c
libnvme_mi_submit_exit() -- weak tracing hook in mi.c
libnvmf_context_set_fabrics_config() -- setter in fabrics.c whose
getter libnvmf_context_get_fabrics_config() was already declared
Without a prototype in an installed header, callers have no declaration
to include and must either write their own or resort to dlsym().
Signed-off-by: Martin Belanger <Martin.Belanger@dell.com>
Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com>
igaw
reviewed
Apr 21, 2026
igaw
reviewed
Apr 21, 2026
igaw
reviewed
Apr 21, 2026
Add tools/check-public-headers.py, a companion to the existing
check-public-symbols.py, that verifies every symbol exported in a
version script has a prototype declared in one of the installed
headers.
The check reads all *.ld files, extracts their global: symbols, then
scans each installed header for a matching identifier followed by '('.
Conditional headers (MI, fabrics) are silently skipped when absent,
matching the same build conditionality as install_headers().
Register the script as a meson test alongside check-public-symbols so
it runs automatically under 'meson test'.
Signed-off-by: Martin Belanger <Martin.Belanger@dell.com>
Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com>
4ba27e8 to
a184fa5
Compare
Author
|
@igaw - I changed the script to take the list of headers and *.ld as input parameters as per your suggestion. If you don't mind, I would like to address the other review comments as separate PRs. In other words, would it be possible to merge this PR, and I will work on fixes and submit another PR for your other comments (although for the MI I would prefer if someone else could handle it). |
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.
A few public function prototypes were missing from the installed public headers.
A symbol that appears in a version script but has no prototype in any installed header is technically callable by external code, but callers have no declaration to include — they must write their own prototype or fall back to
dlsym().This series fixes three such symbols and adds a test to prevent regressions.
Patch 1 — add missing prototypes for exported symbols
Three
__publicsymbols were listed in version scripts (*.ld) but had no prototype in any installed header:libnvme_mi_submit_entry()— weak tracing hook inmi.clibnvme_mi_submit_exit()— weak tracing hook inmi.clibnvmf_context_set_fabrics_config()— setter infabrics.cwhosegetter
libnvmf_context_get_fabrics_config()was already declaredPrototypes added to
mi.handfabrics.hrespectively.Patch 2 — add check-public-headers test
Adds
tools/check-public-headers.py, a companion to the existingcheck-public-symbols.py. It reads all*.ldversion scripts, extracts theirglobal:symbols, then scans each installed header for a matching prototype. Conditional headers (MI, fabrics) are silently skipped when absent, matching the build's own conditionality.The script is registered as a meson test alongside
check-public-symbolsso it runs automatically undermeson test.