Skip to content
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

blockdev: preparatory patches for osmet #191

Merged
merged 3 commits into from
Mar 20, 2020
Merged

blockdev: preparatory patches for osmet #191

merged 3 commits into from
Mar 20, 2020

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Mar 19, 2020

Split out of #187. See individual commit messages.

jlebon added 3 commits March 19, 2020 16:21
Instead of a `mount_boot` function, have a more generic
`mount_partition_by_label` function which takes the label as a
parameter.

While we're here, make it even more generic by accepting mount flags so
that if a caller just wants to mount read-only, they can.
The `ioctl!` macros always declare their functions as pub, so let's put
it in a submodule to keep it contained. It also makes it really obvious
in the rest of the code when we're calling an ioctl by having to prefix
it with `ioctl::`.

Another minor bonus is that we can slap on
`allow(clippy::missing_safety_doc)` on the whole block instead of
individually. (Maybe that lint might need tweaking to ignore unsafe
functions derived from macros?).
Copy link
Contributor

@bgilbert bgilbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -30,28 +30,36 @@ use tempfile;

use crate::errors::*;

pub fn mount_boot(device: &str) -> Result<Mount> {
pub fn mount_partition_by_label(device: &str, label: &str, flags: mount::MsFlags) -> Result<Mount> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires the caller to know about nix::mount. That seems like a reasonable tradeoff, but worth noting.

@lucab lucab changed the title Prep patches for osmet blockdev: preparatory patches for osmet Mar 20, 2020
@lucab lucab merged commit b066a23 into coreos:master Mar 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants