-
Notifications
You must be signed in to change notification settings - Fork 697
libnvme: add accessor code generation #3014
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
libnvme: add accessor code generation #3014
Conversation
|
Looks good. I think we need also solve the integration into libnvme before merging. I've experimented a bit around: https://github.com/igaw/nvme-cli/tree/accessor-generator This needs cleanup and the last problem sovled, how to use the header file. (btw, we should rename libnvme.map to libnvme.ld and fixup meson accordingly.) |
67d50bf to
b89a341
Compare
|
@igaw - I’ve got it working now. It took a bit of time, mostly due to a lot of testing and re-testing. There were two main areas that needed work: -Figuring out how to tell Meson where files are located, especially when building libnvme standalone and installing it in a non-standard location. Telling meson where files are located: This led to the less pleasant part: a fairly broad refactoring of the Linker map files: That said, this does raise a longer-term concern. As the generated accessors evolve, we’ll likely need multiple versioned sections in the map file (one per release). Right now, everything ends up under Feel free to play around with the latest changes and see if they meet your expectations. Let me know if there’s anything else you’d like me to look into. |
This adds a code generator that parses struct definitions and generates accessor functions (setters/getters). Signed-off-by: Martin Belanger <martin.belanger@dell.com>
b89a341 to
249dd06
Compare
|
@igaw — I fixed the compilation issue from my last commit. When building libnvme separately from nvme-cli, there are several cases to handle—for example, whether libnvme is installed in a standard location ( For non-standard install locations, the compiler must be explicitly told where to find This took some experimentation to get right, but I learned a few new things about Meson along the way. Figuring this out was a lot of fun... 😜 |
This adds a code generator that parses struct definitions and generates accessor functions (setters/getters).
Note that the generated code is added to
libnvme.so, but it is not currently being called by anything. Also, the generated code is not added to thelibnvme.mapfile. So, basically it is dead code...The next step will be to actually invoke the generated functions and add them to the
libnvme.mapfile. I need to check if we are allowed to have more than one*.mapfiles. It would be easier to generate the map file for the accessor functions separately from thelibnvme.map.