diff --git a/src/container.rs b/src/container.rs index 2188d12..151fa7b 100644 --- a/src/container.rs +++ b/src/container.rs @@ -694,7 +694,7 @@ impl Container { cstr!(filesystemtype), mountflags, data, - mnt, + mnt.as_mut_ptr(), ); if result >= 0 { @@ -714,7 +714,7 @@ impl Container { mountflags: u64, mnt: &mut crate::Mount, ) -> crate::Result<()> { - call!(self.umount(cstr!(target), mountflags, mnt) -> int) + call!(self.umount(cstr!(target), mountflags, mnt.as_mut_ptr()) -> int) } /** diff --git a/src/lib.rs b/src/lib.rs index 61283ca..1d2e059 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,17 +9,19 @@ mod container; mod flags; pub mod log; mod migrate; +#[cfg(feature = "v3_1")] +mod mount; mod snapshot; pub use self::container::Container; pub use self::flags::{AttchFlags, CloneFlags, CreateFlags}; pub use self::log::Log; +#[cfg(feature = "v3_1")] +pub use self::mount::Mount; pub use self::snapshot::Snapshot; pub use lxc_sys::lxc_conf as Conf; pub use lxc_sys::lxc_lock as Lock; -#[cfg(feature = "v3_1")] -pub use lxc_sys::lxc_mount as Mount; #[derive(Debug)] pub struct Error { diff --git a/src/mount.rs b/src/mount.rs new file mode 100644 index 0000000..dded034 --- /dev/null +++ b/src/mount.rs @@ -0,0 +1,30 @@ +pub struct Mount { + inner: *mut lxc_sys::lxc_mount, +} + +impl Mount { + pub fn version(&self) -> std::os::raw::c_int { + prop!(self.version) + } + + /** + * Returns a raw pointer to the snapshot. + */ + pub fn as_ptr(&self) -> *const lxc_sys::lxc_mount { + self.inner + } + + /** + * Returns a mutable raw pointer to the snapshot. + */ + pub fn as_mut_ptr(&mut self) -> *mut lxc_sys::lxc_mount { + self.inner + } +} + +#[doc(hidden)] +impl Into for &*mut lxc_sys::lxc_mount { + fn into(self) -> Mount { + Mount { inner: *self } + } +}