Skip to content

libnvme: commit pre-generated accessor files and simplify build#3176

Merged
igaw merged 1 commit intolinux-nvme:masterfrom
martin-belanger:gen-accessors-ahead-of-time
Mar 13, 2026
Merged

libnvme: commit pre-generated accessor files and simplify build#3176
igaw merged 1 commit intolinux-nvme:masterfrom
martin-belanger:gen-accessors-ahead-of-time

Conversation

@martin-belanger
Copy link
Copy Markdown

@martin-belanger martin-belanger commented Mar 12, 2026

The accessor functions (getters/setters for nvme_path, nvme_ns, nvme_ctrl, nvme_subsystem, nvme_host, nvme_fabric_options) were previously generated at build time by a custom_target in Meson. They are now committed to the source tree and treated as maintainer-generated source files, similar to how the Linux kernel and systemd handle infrequently-changing generated code.

Changes:

  • Commit accessors.h, accessors.c, accessors.ld to the source tree
  • Remove the custom_target that ran the generator on every build; generate-accessors is no longer compiled during a normal build
  • Add accessors.c to the sources list and accessors.h to install_headers() alongside their sibling files in libnvme/src/meson.build
  • Remove accessors_dep (was only needed to forward the custom_target outputs; plain files don't require this indirection)
  • Enhance generate-accessors.c to emit mechanical Doxygen stubs in accessors.h, covering all three member kinds: value types, dynamic char * (with NULL/copy semantics), and fixed char arrays
  • Add update-accessors.sh: atomically regenerates accessors.h and accessors.c when content changes, and reports symbol additions and removals against accessors.ld without overwriting it
  • Add a Meson run_target and Makefile target 'update-accessors' for on-demand regeneration: make update-accessors
  • Keep accessors.ld manually maintained; its version section labels (e.g. LIBNVME_ACCESSORS_3_0) must be assigned by the maintainer to preserve ABI compatibility
  • Add .github/workflows/check-accessors.yml to fail CI when the committed accessor files drift from the generator output
  • Update README.md with a developer guide covering regeneration, accessors.ld maintenance, and the ABI versioning convention
  • Fix three stale test reference files that were missing dhchap_ctrl_key from their expected JSON output following an earlier json.c update
  • Made several changes to generate-accessors.c to make sure generated code complies to checkpatch rules

@martin-belanger martin-belanger force-pushed the gen-accessors-ahead-of-time branch 6 times, most recently from 5ca8861 to bb46cbb Compare March 12, 2026 22:11
The accessor functions (getters/setters for nvme_path, nvme_ns,
nvme_ctrl, nvme_subsystem, nvme_host, nvme_fabric_options) were
previously generated at build time by a custom_target in Meson.
They are now committed to the source tree and treated as
maintainer-generated source files, similar to how the Linux kernel
and systemd handle infrequently-changing generated code.

Changes:
 - Commit accessors.h, accessors.c, accessors.ld to the source tree
 - Remove the custom_target that ran the generator on every build;
   generate-accessors is no longer compiled during a normal build
 - Add accessors.c to the sources list and accessors.h to
   install_headers() alongside their sibling files in
   libnvme/src/meson.build
 - Remove accessors_dep (was only needed to forward the custom_target
   outputs; plain files don't require this indirection)
 - Enhance generate-accessors.c to emit mechanical Doxygen stubs in
   accessors.h, covering all three member kinds: value types, dynamic
   char * (with NULL/copy semantics), and fixed char arrays
 - Add update-accessors.sh: atomically regenerates accessors.h and
   accessors.c when content changes, and reports symbol additions and
   removals against accessors.ld without overwriting it
 - Add a Meson run_target and Makefile target 'update-accessors' for
   on-demand regeneration: make update-accessors
 - Keep accessors.ld manually maintained; its version section labels
   (e.g. LIBNVME_ACCESSORS_3_0) must be assigned by the maintainer to
   preserve ABI compatibility
 - Add .github/workflows/check-accessors.yml to fail CI when the
   committed accessor files drift from the generator output
 - Update README.md with a developer guide covering regeneration,
   accessors.ld maintenance, and the ABI versioning convention
 - Fix three stale test reference files that were missing dhchap_ctrl_key
   from their expected JSON output following an earlier json.c update

Signed-off-by: Martin Belanger <[email protected]>
@martin-belanger martin-belanger force-pushed the gen-accessors-ahead-of-time branch from bb46cbb to 772bc6c Compare March 12, 2026 22:16
@igaw igaw merged commit a49c53c into linux-nvme:master Mar 13, 2026
26 of 27 checks passed
@igaw
Copy link
Copy Markdown
Collaborator

igaw commented Mar 13, 2026

Thanks a lot. I think this is a good middle ground. And getting rid of the hand written stuff is good :)

@martin-belanger martin-belanger deleted the gen-accessors-ahead-of-time branch March 13, 2026 10:38
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