From: Colin Walters Date: Fri, 1 Dec 2023 19:35:41 +0000 (-0500) Subject: sysroot: Add a method to borrow sysroot fd X-Git-Tag: archive/raspbian/2023.8-1+rpi1^2~9^2^2~2^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d3190dbf568440c86d8c15f34f09c9797f17c59c;p=ostree.git sysroot: Add a method to borrow sysroot fd For the same reason we have this method on `Repo`. --- diff --git a/rust-bindings/src/sysroot.rs b/rust-bindings/src/sysroot.rs index ea8c3cb1..3d5082b5 100644 --- a/rust-bindings/src/sysroot.rs +++ b/rust-bindings/src/sysroot.rs @@ -1,5 +1,7 @@ use crate::gio; use crate::Sysroot; +#[cfg(any(feature = "v2017_10", feature = "dox"))] +use std::os::fd::BorrowedFd; use std::path::PathBuf; #[derive(Clone, Debug, Default)] @@ -62,6 +64,14 @@ impl SysrootBuilder { } } +impl Sysroot { + /// Borrow the directory file descriptor for this sysroot. + #[cfg(feature = "v2017_10")] + pub fn dfd_borrow(&self) -> BorrowedFd { + unsafe { BorrowedFd::borrow_raw(self.fd()) } + } +} + #[cfg(test)] mod tests { use super::*;