libnvme: merge attr accessor files into one shared set - #3796
Merged
Conversation
No functional change. Merge the four per-struct lazy-attribute
accessor file sets (ctrl-attrs.*, path-attrs.*, ns-attrs.*,
subsys-attrs.*) into one shared attr-accessors.* set, and the eight
hand-written OS-specific loader files down to two,
attr-accessors-custom-{linux,win}.c.
generate_attr_accessors.py now merges every ATTR_SPECS entry into one
shared output file per kind, mirroring the same pattern
generate_accessors.py already uses for multiple structs from one
annotated header.
Signed-off-by: Martin Belanger <martin.belanger@dell.com>
Collaborator
|
Very nice. This looks really good. Thanks! |
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.
No functional change. This is the follow-on to #3787 (todo #55, part 2): merges the four per-struct lazy-attribute accessor file sets (
ctrl-attrs.*,path-attrs.*,ns-attrs.*,subsys-attrs.*) into one sharedattr-accessors.*set, and consolidates the hand-written OS-specific loader files the same way.Generated files:
attr-accessors.{c,h,i}(one merged output per kind instead of four), plusattr-accessors-{linux,win}.cfor the one spec (PATH_ATTRS) with real per-OS getter divergence.attr-accessors.ldmerges the four oldLIBNVME_{CTRL,PATH,NS,SUBSYS}_ATTRS_3tags into oneLIBNVME_ATTR_ACCESSORS_3.Hand-written files: eight
*-attrs-custom-*.cloader files collapse to two,attr-accessors-custom-{linux,win}.c. Along the way, dropped the separate*-custom-fabrics.c/*-custom-no-fabrics.cpair entirely --CONFIG_FABRICSis never defined on Windows (want_fabricsin the top-levelmeson.buildis gated onhost_system == 'linux'), soattr-accessors-custom-win.cjust hand-writes the no-op loader body directly with no#ifdef, and Linux's real#ifdef CONFIG_FABRICS/#elsebranch is inlined inattr-accessors-custom-linux.cinstead of reaching for a file for one function.generate_attr_accessors.pynow merges everyATTR_SPECSentry's output into one shared file per kind (one preamble, not four) instead of one file set per spec -- mirrors the "concatenate parts under one shared preamble" patterngenerate_accessors.pyalready uses for multiple structs from one annotated header.attr_accessors_specs.pyspreads a_SHAREDdict of filenames into every spec so they can't drift apart by typo;main()also asserts they agree before generating anything.Verified the generated output is identical to before the merge (same function/symbol sets, diffed programmatically, not just inspected) before writing anything into the tree. Full build (default,
-Dwerror=true,-Dfabrics=disabled),meson test,-Dcheck-accessors=true, and live checks against real hardware (nvme list,list-subsys, Python bindings) all pass.