/DragonOS/kernel/src/bpf/map/ |
H A D | lru.rs | 40 fn lookup_elem(&mut self, key: &[u8]) -> Result<Option<&[u8]>> { in lookup_elem() 41 let value = self.data.get(key).map(|v| v.as_slice()); in lookup_elem() 44 fn update_elem(&mut self, key: &[u8], value: &[u8], _flags: u64) -> Result<()> { in update_elem() 45 self.data.put(key.to_vec(), value.to_vec()); in update_elem() 48 fn delete_elem(&mut self, key: &[u8]) -> Result<()> { in delete_elem() 49 self.data.pop(key); in delete_elem() 57 for (key, value) in self.data.iter() { in for_each_elem() 58 let res = cb(key, value, ctx); in for_each_elem() 67 fn lookup_and_delete_elem(&mut self, key: &[u8], value: &mut [u8]) -> Result<()> { in lookup_and_delete_elem() 70 .get(key) in lookup_and_delete_elem() [all …]
|
H A D | hash_map.rs | 41 fn lookup_elem(&mut self, key: &[u8]) -> Result<Option<&[u8]>> { in lookup_elem() 42 let value = self.data.get(key).map(|v| v.as_slice()); in lookup_elem() 45 fn update_elem(&mut self, key: &[u8], value: &[u8], flags: u64) -> Result<()> { in update_elem() 47 self.data.insert(key.to_vec(), value.to_vec()); in update_elem() 50 fn delete_elem(&mut self, key: &[u8]) -> Result<()> { in delete_elem() 51 self.data.remove(key); in delete_elem() 59 for (key, value) in self.data.iter() { in for_each_elem() 60 let res = cb(key, value, ctx); in for_each_elem() 69 fn lookup_and_delete_elem(&mut self, key: &[u8], value: &mut [u8]) -> Result<()> { in lookup_and_delete_elem() 72 .get(key) in lookup_and_delete_elem() [all …]
|
H A D | array_map.rs | 83 fn lookup_elem(&mut self, key: &[u8]) -> Result<Option<&[u8]>> { in lookup_elem() 84 if key.len() != 4 { in lookup_elem() 87 let index = u32::from_ne_bytes(key.try_into().map_err(|_| SystemError::EINVAL)?); in lookup_elem() 94 fn update_elem(&mut self, key: &[u8], value: &[u8], _flags: u64) -> Result<()> { in update_elem() 95 if key.len() != 4 { in update_elem() 98 let index = u32::from_ne_bytes(key.try_into().map_err(|_| SystemError::EINVAL)?); in update_elem() 119 let key = i.to_ne_bytes(); in for_each_elem() localVariable 122 let res = cb(&key, value, ctx); in for_each_elem() 135 fn get_next_key(&self, key: Option<&[u8]>, next_key: &mut [u8]) -> Result<()> { in get_next_key() 136 if let Some(key) = key { in get_next_key() [all …]
|
H A D | util.rs | 44 pub key: u64, field 55 key: u.key, in from() 65 pub key: Option<u64>, field 75 key: if u.key != 0 { Some(u.key) } else { None }, in from()
|
H A D | mod.rs | 35 pub type BpfCallBackFn = fn(key: &[u8], value: &[u8], ctx: *const u8) -> i32; 262 let key_buf = UserBufferReader::new(arg.key as *const u8, key_size, true)?; in bpf_map_update_elem() 265 let key = key_buf.read_from_user(0)?; in bpf_map_update_elem() localVariable 267 map.inner_map.lock().update_elem(key, value, arg.flags)?; in bpf_map_update_elem() 292 let key_buf = UserBufferReader::new(arg.key as *const u8, key_size, true)?; in bpf_lookup_elem() 295 let key = key_buf.read_from_user(0)?; in bpf_lookup_elem() localVariable 298 let r_value = inner.lookup_elem(key)?; in bpf_lookup_elem() 320 let key = if let Some(key_ptr) = arg.key { in bpf_map_get_next_key() localVariable 322 let key = key_buf.read_from_user(0)?.to_vec(); in bpf_map_get_next_key() localVariable 323 Some(key) in bpf_map_get_next_key() [all …]
|
/DragonOS/tools/debugging/logmonitor/src/backend/monitor/ |
H A D | logset.rs | 39 pub fn insert(&mut self, key: K, value: V) { in insert() 43 let prev = self.inner.insert(key, value); in insert() 68 pub fn get(&self, key: &K) -> Option<&V> { in get() 69 self.inner.get(key) in get() 72 pub fn get_mut(&mut self, key: &K) -> Option<&mut V> { in get_mut() 73 self.inner.get_mut(key) in get_mut() 76 pub fn remove(&mut self, key: &K) -> Option<V> { in remove() 77 self.inner.remove(key) in remove() 88 pub fn contains_key(&self, key: &K) -> bool { in contains_key() 89 self.inner.contains_key(key) in contains_key()
|
/DragonOS/kernel/src/bpf/helper/ |
H A D | mod.rs | 22 unsafe fn raw_map_lookup_elem(map: *mut c_void, key: *const c_void) -> *const c_void { in raw_map_lookup_elem() 25 let key = core::slice::from_raw_parts(key as *const u8, key_size); in raw_map_lookup_elem() localVariable 26 let value = map_lookup_elem(&map, key); in raw_map_lookup_elem() 36 pub fn map_lookup_elem(map: &Arc<BpfMap>, key: &[u8]) -> Result<Option<*const u8>> { in map_lookup_elem() 38 let value = binding.lookup_elem(key); in map_lookup_elem() 76 let key = if index == BPF_F_CURRENT_CPU as u32 { in perf_event_output() localVariable 82 .lookup_elem(&key.to_ne_bytes())? in perf_event_output() 120 key: *const c_void, in raw_map_update_elem() 128 let key = core::slice::from_raw_parts(key as *const u8, key_size); in raw_map_update_elem() localVariable 130 let res = map_update_elem(&map, key, value, flags); in raw_map_update_elem() [all …]
|
/DragonOS/kernel/src/ipc/ |
H A D | shm.rs | 148 key: ShmKey, in add() 179 key, in add() 191 self.key2id.insert(key, shm_id); in add() 196 pub fn contains_key(&self, key: &ShmKey) -> Option<&ShmId> { in contains_key() 197 self.key2id.get(key) in contains_key() 204 pub fn free_key(&mut self, key: &ShmKey) { in free_key() 205 self.key2id.remove(key); in free_key() 255 let key = kernel_shm.kern_ipc_perm.key.data().to_i32().unwrap(); in shm_stat() localVariable 258 let shm_perm = PosixIpcPerm::new(key, 0, 0, 0, 0, mode); in shm_stat() 319 let key = kernel_shm.kern_ipc_perm.key; in ipc_rmid() localVariable [all …]
|
H A D | syscall.rs | 261 pub fn shmget(key: ShmKey, size: usize, shmflg: ShmFlags) -> Result<usize, SystemError> { in shmget() 269 match key { in shmget() 271 IPC_PRIVATE => shm_manager_guard.add(key, size, shmflg), in shmget() 274 let id = shm_manager_guard.contains_key(&key); in shmget() 290 return shm_manager_guard.add(key, size, shmflg); in shmget()
|
/DragonOS/kernel/src/libs/futex/ |
H A D | futex.rs | 43 pub fn try_remove(key: &FutexKey) -> Option<FutexHashBucket> { in try_remove() 46 if let Some(futex) = guard.get(key) { in try_remove() 48 return guard.remove(key); in try_remove() 69 .filter(|x| futex_q.pcb.ptr_eq(&x.pcb) && x.key == futex_q.key) in contains() 93 key: FutexKey, in wake_up() 100 if futex_q.key == key { in wake_up() 144 key: FutexKey, field 167 key: InnerFutexKey, field 232 let key = Self::get_futex_key( in futex_wait() localVariable 239 let bucket = futex_map_guard.get_mut(&key); in futex_wait() [all …]
|
/DragonOS/user/apps/test_shm/ |
H A D | receiver.c | 16 key_t key = 6666; in main() local 19 shmid = shmget(key, SHM_SIZE, 0666 | IPC_CREAT); in main()
|
H A D | sender.c | 16 key_t key = 6666; in main() local 19 shmid = shmget(key, SHM_SIZE, 0666 | IPC_CREAT); in main()
|
H A D | test_info.c | 41 key_t key = 6666; in main() local 44 shmid = shmget(key, SHM_SIZE, 0666 | IPC_CREAT); in main()
|
/DragonOS/kernel/src/namespaces/ |
H A D | ucount.rs | 71 let key = UKey { in alloc_ucounts() localVariable 75 let uc = if let Some(uc) = counts.get(&key) { in alloc_ucounts() 92 counts.insert(key, uc.clone()); in alloc_ucounts() 123 let key = UKey { user_ns, uid }; in find_ucounts() localVariable 124 counts.get(&key).cloned() in find_ucounts() 151 let key = UKey { in put_ucounts() localVariable 155 counts.remove(&key); in put_ucounts()
|
/DragonOS/kernel/src/libs/ |
H A D | keyboard_parser.rs | 291 let mut key = KeyFlag::OtherKey; // 可视字符 in handle_type3() localVariable 296 key = KeyFlag::NoneFlag; in handle_type3() 300 key = KeyFlag::NoneFlag; in handle_type3() 304 key = KeyFlag::NoneFlag; in handle_type3() 308 key = KeyFlag::NoneFlag; in handle_type3() 318 key = KeyFlag::NoneFlag; in handle_type3() 323 key = KeyFlag::NoneFlag; in handle_type3() 343 if key != KeyFlag::NoneFlag { in handle_type3()
|
H A D | rbtree.rs | 39 key: K, field 46 (self.key, self.value) in pair() 56 write!(f, "k:{:?} v:{:?} c:{:?}", self.key, self.value, self.color) in fmt() 74 unsafe { (*self.0).key.cmp(&(*other.0).key) } in cmp() 99 key: k, in new() 274 let mut node = NodePtr::new((*self.0).key.clone(), (*self.0).value.clone()); in deep_clone() 427 .all(|(key, value)| other.get(key).map_or(false, |v| *value == *v)) in eq() 627 core::ptr::read(&(*self.head.0).key), in next() 707 let (k, v) = unsafe { (&(*self.head.0).key, &(*self.head.0).value) }; in next() 726 let (k, v) = unsafe { (&(*self.tail.0).key, &(*self.tail.0).value) }; in next_back() [all …]
|
/DragonOS/kernel/crates/rbpf/src/ |
H A D | lib.rs | 257 pub fn register_helper(&mut self, key: u32, function: Helper) -> Result<(), Error> { in register_helper() 258 self.helpers.insert(key, function); in register_helper() 762 key: u32, in register_helper() 765 self.parent.register_helper(key, function) in register_helper() 1196 key: u32, in register_helper() 1199 self.parent.register_helper(key, function) in register_helper() 1210 for (key, function) in helpers { in register_helper_set() 1211 self.parent.register_helper(*key, *function)?; in register_helper_set() 1552 key: u32, in register_helper() 1555 self.parent.register_helper(key, function) in register_helper() [all …]
|
/DragonOS/build-scripts/kernel_build/src/utils/ |
H A D | cargo_handler.rs | 25 pub fn readenv(key: &str) -> Option<String> { in readenv() 26 if let Ok(value) = env::var(key) { in readenv()
|
/DragonOS/user/apps/test_ebpf/src/ |
H A D | main.rs | 45 if let Ok((key, value)) = item { in main() 46 println!("syscall: {:?}, count: {:?}", key, value); in main()
|
/DragonOS/user/dadk/config/ |
H A D | dog_0_1_0.dadk | 27 "key": "CC",
|
/DragonOS/tools/ |
H A D | list_contributors.py | 44 authors = sorted(authors.values(), key=lambda x: x['count'], reverse=True)
|
/DragonOS/docs/kernel/trace/ |
H A D | eBPF.md | 198 /// Look up an element with the given key in the map referred to by the file descriptor fd, 203 /// perform a lookup in percpu map for an entry associated to key on cpu. 207 /// Get the next key in the map. If key is None, get the first key.
|
/DragonOS/docs/community/code_contribution/ |
H A D | conventional-commit.md | 20 BREAKING CHANGE: `extends` key in config file is now used for extending other config files
|
/DragonOS/kernel/src/filesystem/devfs/ |
H A D | mod.rs | 468 let mut key: Vec<String> = inode in get_entry_name() localVariable 480 match key.len() { in get_entry_name() 482 1=>{return Ok(key.remove(0));} in get_entry_name() 483 …={key_len}>1, current inode_id={inode_id:?}, to find={to_find:?}", key_len=key.len(), inode_id = i… in get_entry_name()
|
/DragonOS/kernel/src/filesystem/ramfs/ |
H A D | mod.rs | 521 let mut key: Vec<String> = inode in get_entry_name() localVariable 533 match key.len() { in get_entry_name() 535 1=>{return Ok(key.remove(0));} in get_entry_name() 536 …={key_len}>1, current inode_id={inode_id:?}, to find={to_find:?}", key_len=key.len(), inode_id = i… in get_entry_name()
|