From 95f535a3c385f2596510cdf7edad033958aa57dd Mon Sep 17 00:00:00 2001 From: Littlefisher619 Date: Tue, 7 Mar 2023 23:59:00 +0800 Subject: [PATCH] [runtime] add license for rust example --- runtime/rust/src/func/attach.rs | 5 +++++ runtime/rust/src/func/close.rs | 5 +++++ runtime/rust/src/func/fd_by_name.rs | 5 +++++ runtime/rust/src/func/load.rs | 5 +++++ runtime/rust/src/func/map_operate.rs | 5 +++++ runtime/rust/src/func/mod.rs | 5 +++++ runtime/rust/src/func/poll.rs | 5 +++++ runtime/rust/src/func/wrapper_poll.rs | 5 +++++ runtime/rust/src/log_format.rs | 5 +++++ runtime/rust/src/main.rs | 5 +++++ runtime/rust/src/state.rs | 5 +++++ runtime/rust/src/utils.rs | 5 +++++ 12 files changed, 60 insertions(+) diff --git a/runtime/rust/src/func/attach.rs b/runtime/rust/src/func/attach.rs index 2549352..7aa8a4e 100644 --- a/runtime/rust/src/func/attach.rs +++ b/runtime/rust/src/func/attach.rs @@ -1,3 +1,8 @@ +//! SPDX-License-Identifier: MIT +//! +//! Copyright (c) 2023, eunomia-bpf +//! All rights reserved. +//! use std::os::fd::AsRawFd; use log::debug; diff --git a/runtime/rust/src/func/close.rs b/runtime/rust/src/func/close.rs index 1c86bb6..b22d689 100644 --- a/runtime/rust/src/func/close.rs +++ b/runtime/rust/src/func/close.rs @@ -1,3 +1,8 @@ +//! SPDX-License-Identifier: MIT +//! +//! Copyright (c) 2023, eunomia-bpf +//! All rights reserved. +//! use std::collections::hash_map::Entry; use log::debug; diff --git a/runtime/rust/src/func/fd_by_name.rs b/runtime/rust/src/func/fd_by_name.rs index e46ce21..38ade22 100644 --- a/runtime/rust/src/func/fd_by_name.rs +++ b/runtime/rust/src/func/fd_by_name.rs @@ -1,3 +1,8 @@ +//! SPDX-License-Identifier: MIT +//! +//! Copyright (c) 2023, eunomia-bpf +//! All rights reserved. +//! use log::debug; use crate::{ensure_c_str, ensure_program_mut_by_caller, state::CallerType}; diff --git a/runtime/rust/src/func/load.rs b/runtime/rust/src/func/load.rs index 9c54717..f35b5b4 100644 --- a/runtime/rust/src/func/load.rs +++ b/runtime/rust/src/func/load.rs @@ -1,3 +1,8 @@ +//! SPDX-License-Identifier: MIT +//! +//! Copyright (c) 2023, eunomia-bpf +//! All rights reserved. +//! use libbpf_rs::ObjectBuilder; use log::debug; diff --git a/runtime/rust/src/func/map_operate.rs b/runtime/rust/src/func/map_operate.rs index 05fa03c..5145ffe 100644 --- a/runtime/rust/src/func/map_operate.rs +++ b/runtime/rust/src/func/map_operate.rs @@ -1,3 +1,8 @@ +//! SPDX-License-Identifier: MIT +//! +//! Copyright (c) 2023, eunomia-bpf +//! All rights reserved. +//! use libbpf_rs::libbpf_sys::{ bpf_map_delete_elem_flags, bpf_map_get_next_key, bpf_map_lookup_elem_flags, bpf_map_update_elem, BPF_MAP_DELETE_ELEM, BPF_MAP_GET_NEXT_KEY, BPF_MAP_LOOKUP_ELEM, diff --git a/runtime/rust/src/func/mod.rs b/runtime/rust/src/func/mod.rs index a2e67ac..4ccedeb 100644 --- a/runtime/rust/src/func/mod.rs +++ b/runtime/rust/src/func/mod.rs @@ -1,3 +1,8 @@ +//! SPDX-License-Identifier: MIT +//! +//! Copyright (c) 2023, eunomia-bpf +//! All rights reserved. +//! pub const EINVAL: i32 = 22; pub const ENOENT: i32 = 2; diff --git a/runtime/rust/src/func/poll.rs b/runtime/rust/src/func/poll.rs index d1bea49..865efad 100644 --- a/runtime/rust/src/func/poll.rs +++ b/runtime/rust/src/func/poll.rs @@ -1,3 +1,8 @@ +//! SPDX-License-Identifier: MIT +//! +//! Copyright (c) 2023, eunomia-bpf +//! All rights reserved. +//! use std::{ ffi::c_void, ptr::{null, null_mut}, diff --git a/runtime/rust/src/func/wrapper_poll.rs b/runtime/rust/src/func/wrapper_poll.rs index 15cadb8..9350996 100644 --- a/runtime/rust/src/func/wrapper_poll.rs +++ b/runtime/rust/src/func/wrapper_poll.rs @@ -1,3 +1,8 @@ +//! SPDX-License-Identifier: MIT +//! +//! Copyright (c) 2023, eunomia-bpf +//! All rights reserved. +//! use log::error; use crate::{func::EINVAL, state::CallerType}; diff --git a/runtime/rust/src/log_format.rs b/runtime/rust/src/log_format.rs index 1471c32..73ec85a 100644 --- a/runtime/rust/src/log_format.rs +++ b/runtime/rust/src/log_format.rs @@ -1,3 +1,8 @@ +//! SPDX-License-Identifier: MIT +//! +//! Copyright (c) 2023, eunomia-bpf +//! All rights reserved. +//! use flexi_logger::{DeferredNow, Record, TS_DASHES_BLANK_COLONS_DOT_BLANK}; pub fn my_log_format( diff --git a/runtime/rust/src/main.rs b/runtime/rust/src/main.rs index 8ad630d..a42c71a 100644 --- a/runtime/rust/src/main.rs +++ b/runtime/rust/src/main.rs @@ -1,3 +1,8 @@ +//! SPDX-License-Identifier: MIT +//! +//! Copyright (c) 2023, eunomia-bpf +//! All rights reserved. +//! use anyhow::{anyhow, Context}; use clap::Parser; use flexi_logger::Logger; diff --git a/runtime/rust/src/state.rs b/runtime/rust/src/state.rs index c0a5325..160cdb5 100644 --- a/runtime/rust/src/state.rs +++ b/runtime/rust/src/state.rs @@ -1,3 +1,8 @@ +//! SPDX-License-Identifier: MIT +//! +//! Copyright (c) 2023, eunomia-bpf +//! All rights reserved. +//! use std::{collections::HashMap, fs::File, ptr::null}; use libbpf_rs::{ diff --git a/runtime/rust/src/utils.rs b/runtime/rust/src/utils.rs index b6d58df..e1cb352 100644 --- a/runtime/rust/src/utils.rs +++ b/runtime/rust/src/utils.rs @@ -1,3 +1,8 @@ +//! SPDX-License-Identifier: MIT +//! +//! Copyright (c) 2023, eunomia-bpf +//! All rights reserved. +//! use std::ffi::CStr; use crate::{state::CallerType, AppState};