Skip to content

Commit

Permalink
Make LOOP_PREFIX target_os specific
Browse files Browse the repository at this point in the history
Android system setup loop devices at `/dev/block/loop` instead of
`/dev/loop`. Add a `cfg` directive to that sets the `LOOP_PREFIX` for
`target_os = "android"` accordingly.
  • Loading branch information
Felix Obenhuber authored and mdaffin committed May 31, 2021
1 parent 506eb14 commit 4a81d10
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ const LOOP_SET_CAPACITY: u16 = 0x4C07;
const LOOP_CTL_GET_FREE: u16 = 0x4C82;

const LOOP_CONTROL: &str = "/dev/loop-control";
#[cfg(not(target_os = "android"))]
const LOOP_PREFIX: &str = "/dev/loop";
#[cfg(target_os = "android")]
const LOOP_PREFIX: &str = "/dev/block/loop";

/// Interface to the loop control device: `/dev/loop-control`.
#[derive(Debug)]
Expand Down

0 comments on commit 4a81d10

Please sign in to comment.