optee-teec: refactor plugin support#296
Open
ivila wants to merge 1 commit intoapache:mainfrom
Open
Conversation
0582454 to
903257d
Compare
* Introduce optee-teec-plugin-bindgen crate to generate plugin bindings for plugin developers, replacing optee-teec-macros. * Refactor optee-teec::PluginParameters and add additional methods. * Update optee-teec-sys::PluginMethod to latest version.
903257d to
4a48066
Compare
DemesneGH
reviewed
Apr 29, 2026
Comment on lines
+22
to
+23
| "init", | ||
| "invoke", |
Contributor
There was a problem hiding this comment.
I see why we're avoiding macros, but using strings for function names is a bit weird.
Since most users don't need custom names anyway, how about using defaults like plugin_init and plugin_invoke? Then the default constructor only requires the name and UUID. This would clean up the API and eliminate potential typos in build.rs.
We can also provide one more constructor that accepts the customized fn name if you'd like to.
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.
optee-teec-plugin-bindgencrate to generate plugin bindings for plugin developers, replacingoptee-teec-macros.optee-teec::PluginParametersand add additional methods.optee-teec-sys::PluginMethodto latest version.With these changes, plugin development now only requires adding
optee-teec-plugin-bindgenas a build dependency and including the generated artifact inlib.rs.Why not use a proc macro?
I have thought about implementing a
declare_supp_pluginmacro like thisdemo:Developers can use it like:
The main issue is that developers may provide the UUID through a variable. Due to the limitations of proc macros, we cannot resolve the value of that variable during macro expansion. As a result, the UUID would need to be parsed and converted at runtime.
However, this introduces another problem: what happens if UUID parsing fails? Triggering a panic in a shared library is not a good idea and should be avoided.