-
Notifications
You must be signed in to change notification settings - Fork 162
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
Whether a lifecycle container/manager can be provided to store the currently open protocol? #1137
Comments
That's convenient while get protocol from a object manager for users, may like this: static mut MYPROTOCOL_RUNNING_ID = 0;
fn efI_main() {
myprotocol = open_protocol_exclusive();
MYPROTOCOL_RUNNING_ID = store_opened_protocol_to_hashmap(myprotocol);
}
fn in_other_func() {
myprotocol = get_opened_protocol_by_hashmap(MYPROTOCOL_RUNNING_ID)
.execpt("The previously opened protocol has been closed");
} |
I may be misunderstanding you, but I think https://docs.rs/uefi/latest/uefi/table/boot/struct.BootServices.html#method.open_protocol_exclusive and https://docs.rs/uefi/latest/uefi/table/boot/struct.ScopedProtocol.html already handle this. If you call |
but the complex rust structure with static pass in stack is inconvenient. and it needs box wrapped, atomic, and no Copy trait. |
#893 will help with that to some extent, since we'll be able to drop the |
Whether a lifecycle container/manager can be provided to store the currently open protocol?
https://docs.rs/uefi/latest/uefi/table/boot/enum.OpenProtocolAttributes.html
Will you design a object manager which stores opened protocol by
Exclusive
, then user no need to use the unsafeGetProtocol
.#893
The text was updated successfully, but these errors were encountered: