]> git.proxmox.com Git - proxmox-fuse.git/commitdiff
impl AsFd for FuseFd
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 19 Oct 2022 12:38:40 +0000 (14:38 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 19 Oct 2022 12:38:40 +0000 (14:38 +0200)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/fuse_fd.rs

index 51213bc03983735df325aae785fcb2956636a725..53f00b881cf813448dc5c085578cc6262fc6fba9 100644 (file)
@@ -1,7 +1,7 @@
 //! This binds the fuse file descriptor to the tokio reactor.
 
 use std::io;
-use std::os::unix::io::{AsRawFd, RawFd};
+use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd};
 use std::sync::atomic::{AtomicU32, Ordering};
 use std::sync::{Arc, Mutex};
 use std::task::{Context, Poll, Waker};
@@ -107,6 +107,12 @@ impl FuseFd {
     }
 }
 
+impl AsFd for FuseFd {
+    fn as_fd(&self) -> BorrowedFd<'_> {
+        unsafe { BorrowedFd::borrow_raw(self.fd) }
+    }
+}
+
 impl AsRawFd for FuseFd {
     #[inline]
     fn as_raw_fd(&self) -> RawFd {