Browse Source

Merge pull request #825 from aya-rs/dependabot/cargo/async-io-2.0

dependabot[bot] 1 year ago
parent
commit
67fe16e723

+ 1 - 1
Cargo.toml

@@ -49,7 +49,7 @@ default-members = [
 [workspace.dependencies]
 anyhow = { version = "1", default-features = false }
 assert_matches = { version = "1.5.0", default-features = false }
-async-io = { version = "1.3", default-features = false }
+async-io = { version = "2.0", default-features = false }
 aya = { path = "aya", version = "0.11.0", default-features = false }
 aya-bpf = { path = "bpf/aya-bpf", default-features = false }
 aya-log = { path = "aya-log", default-features = false }

+ 1 - 1
aya/src/maps/perf/async_perf_event_array.rs

@@ -159,7 +159,7 @@ impl<T: BorrowMut<MapData>> AsyncPerfEventArrayBuffer<T> {
                 if !buf.get_ref().readable() {
                     buf.readable().await?;
                 }
-                buf.get_mut()
+                unsafe { buf.get_mut() }
             };
 
             let events = buf.read_events(buffers)?;

+ 7 - 1
aya/src/maps/perf/perf_event_array.rs

@@ -4,7 +4,7 @@
 use std::{
     borrow::{Borrow, BorrowMut},
     ops::Deref,
-    os::fd::{AsFd as _, AsRawFd, RawFd},
+    os::fd::{AsFd, AsRawFd, BorrowedFd, RawFd},
     sync::Arc,
 };
 
@@ -55,6 +55,12 @@ impl<T: BorrowMut<MapData>> PerfEventArrayBuffer<T> {
     }
 }
 
+impl<T: BorrowMut<MapData>> AsFd for PerfEventArrayBuffer<T> {
+    fn as_fd(&self) -> BorrowedFd<'_> {
+        self.buf.as_fd()
+    }
+}
+
 impl<T: BorrowMut<MapData>> AsRawFd for PerfEventArrayBuffer<T> {
     fn as_raw_fd(&self) -> RawFd {
         self.buf.as_raw_fd()

+ 2 - 0
xtask/public-api/aya.txt

@@ -510,6 +510,8 @@ pub struct aya::maps::perf::PerfEventArrayBuffer<T>
 impl<T: core::borrow::BorrowMut<aya::maps::MapData>> aya::maps::perf::PerfEventArrayBuffer<T>
 pub fn aya::maps::perf::PerfEventArrayBuffer<T>::read_events(&mut self, out_bufs: &mut [bytes::bytes_mut::BytesMut]) -> core::result::Result<aya::maps::perf::Events, aya::maps::perf::PerfBufferError>
 pub fn aya::maps::perf::PerfEventArrayBuffer<T>::readable(&self) -> bool
+impl<T: core::borrow::BorrowMut<aya::maps::MapData>> std::os::fd::owned::AsFd for aya::maps::perf::PerfEventArrayBuffer<T>
+pub fn aya::maps::perf::PerfEventArrayBuffer<T>::as_fd(&self) -> std::os::fd::owned::BorrowedFd<'_>
 impl<T: core::borrow::BorrowMut<aya::maps::MapData>> std::os::fd::raw::AsRawFd for aya::maps::perf::PerfEventArrayBuffer<T>
 pub fn aya::maps::perf::PerfEventArrayBuffer<T>::as_raw_fd(&self) -> std::os::fd::raw::RawFd
 impl<T> core::marker::Send for aya::maps::perf::PerfEventArrayBuffer<T> where T: core::marker::Send + core::marker::Sync