瀏覽代碼

bpf: perf_map: fix type error

Alessandro Decina 4 年之前
父節點
當前提交
4febbc3fae
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      bpf/aya-bpf/src/maps/perf_map.rs

+ 3 - 1
bpf/aya-bpf/src/maps/perf_map.rs

@@ -41,7 +41,9 @@ impl<T> PerfMap<T> {
         data: &T,
         flags: u32,
     ) {
-        let index = index.map(|i| (i as u64) << 32).unwrap_or(BPF_F_CURRENT_CPU);
+        let index = index
+            .map(|i| (i as u64) << 32)
+            .unwrap_or(BPF_F_CURRENT_CPU.into());
         let flags = index | flags as u64;
         unsafe {
             bpf_perf_event_output(