From 73b0cec0219f1cf5dd4f98bb2a4895119f64c0c9 Mon Sep 17 00:00:00 2001 From: Felix Obenhuber Date: Thu, 27 May 2021 08:43:45 +0200 Subject: [PATCH] Make LOOP_PREFIX target_os specific 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. --- src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 9f8a9b7..c456edf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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)]