-
Notifications
You must be signed in to change notification settings - Fork 9
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
Cleanup keyutils types and api.rs #29
Conversation
Thanks for all the work this past week! Once this is rebased, I'll take a closer look at it now that the other PRs have been merged. |
Done, and let me know if you want to split this up. I've also revised the PR's description to be more accurate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just worried about kernel upgrades sliding in panics without changing the code when a new default keyring value is added. Looks great otherwise.
Thanks! |
This patchset makes many changes in preparation for fixing issue #24 (to no longer need
libkeyutils
). Doing everything in one PR would be very large, so this PR is just all of the internal cleanup that doesn't change the external API ofkeyutils
.Specifically:
libkeyutils-sys
is moved tokeyutils-raw
(and version is updated to matchkeyutils
)KEY_TYPE_KEYRING
andKEY_TYPE_BIG_KEY
(as they are in the kernel documentation).NonZeroI32
.Option<NonZeroI32>
, but this is FFI safe per Allow null-pointer-optimized enums in FFI if their underlying representation is FFI safe rust-lang/rust#60300keyutils
's minimal version.keyutils-raw
: changekey_serial_t
to just beKeyringSerial
, which is then just reexported bykeyutils
.keyutils-raw
: changekey_perm_t
to just beKeyPermissions
, which is then just reexported bykeyutils
.KEY_REQKEY_DEFL_*
constants. Instead,DefaultKeyring
inkeyutils-raw
just has enum values with these constants (it is also just reexported tokeyutils
).api.rs
to use the new types. I also simplified the internal*_impl
andcheck_
methods. This is the largest part of the PR, but is mostly just a find/replace.Again, note that we continue linking libkeyutils, and this only ends up with a very tiny change to the external API:
DefaultKeyring
:serial()
methodTryFrom<libc::c_long>
instead ofFrom<i32>