/DragonOS/user/apps/dmesg/ |
H A D | main.c | 9 unsigned int len = 1; in main() local 15 len = klogctl(10, buf, len); in main() 17 if (len < 16 * 1024) in main() 18 len = 16 * 1024; in main() 19 if (len > 16 * 1024 * 1024) in main() 20 len = 16 * 1024 * 1024; in main() 22 buf = malloc(len); in main() 32 len = klogctl(2, buf, len); in main() 55 len = klogctl(opt, buf, len); in main() 77 len = klogctl(2, buf, len); in main() [all …]
|
/DragonOS/kernel/src/net/socket/ |
H A D | unix.rs | 66 let len = core::cmp::min(buf.len(), buffer.len()); in read() localVariable 67 buf[..len].copy_from_slice(&buffer[..len]); in read() 69 let _ = buffer.split_off(len); in read() 71 (Ok(len), Endpoint::Inode(self.peer_inode.clone())) in read() 80 let len = peer_inode.inner().write_buffer(buf)?; in write() localVariable 81 Ok(len) in write() 100 let len = buf.len(); in write_buffer() localVariable 101 if buffer.capacity() - buffer.len() < len { in write_buffer() 106 Ok(len) in write_buffer() 177 let len = core::cmp::min(buf.len(), buffer.len()); in read() localVariable [all …]
|
/DragonOS/kernel/src/libs/ |
H A D | vec_cursor.rs | 47 if self.pos >= self.data.len() { in read_u8() 56 if self.pos + 2 > self.data.len() { in read_u16() 70 if self.pos + 4 > self.data.len() { in read_u32() 84 if self.pos + 8 > self.data.len() { in read_u64() 103 if self.pos + buf.len() > self.data.len() { in read_exact() 106 buf.copy_from_slice(&self.data[self.pos..self.pos + buf.len()]); in read_exact() 107 self.pos += buf.len(); in read_exact() 115 if self.pos + size_of_val(buf) > self.data.len() * size_of::<u16>() { in read_u16_into() 137 SeekFrom::SeekEnd(offset) => self.data.len() as i64 + offset, in seek() 143 if pos < 0 || pos > self.data.len() as i64 { in seek() [all …]
|
H A D | rbtree.rs | 342 len: usize, field 362 new.len = self.len; in clone() 409 debug!("This tree size = {:?}, begin:-------------", self.len()); in print_tree() 422 if self.len() != other.len() { in eq() 601 len: usize, field 616 if self.len == 0 { in next() 632 self.len -= 1; in next() 637 (self.len, Some(self.len)) in size_hint() 644 if self.len == 0 { in next_back() 656 self.len -= 1; in next_back() [all …]
|
H A D | printk.c | 68 int len; in __do_vsprintf() local 215 len = strlen(s); in __do_vsprintf() 219 precision = len; in __do_vsprintf() 222 else if (len > precision) in __do_vsprintf() 224 len = precision; in __do_vsprintf() 229 while (len < field_width--) in __do_vsprintf() 235 for (int i = 0; i < len; i++) in __do_vsprintf() 242 while (len < field_width--) in __do_vsprintf() 603 int len = vsprintf(buf, fmt, args); in printk_color() local 609 for (i = 0; i < len; ++i) in printk_color()
|
/DragonOS/kernel/src/syscall/ |
H A D | user_access.rs | 29 pub unsafe fn clear_user(dest: VirtAddr, len: usize) -> Result<usize, SystemError> { in clear_user() 30 verify_area(dest, len).map_err(|_| SystemError::EFAULT)?; in clear_user() 34 p.write_bytes(0, len); in clear_user() 35 return Ok(len); in clear_user() 39 verify_area(dest, src.len()).map_err(|_| SystemError::EFAULT)?; in copy_to_user() 43 p.copy_from_nonoverlapping(src.as_ptr(), src.len()); in copy_to_user() 44 return Ok(src.len()); in copy_to_user() 49 verify_area(src, dst.len()).map_err(|_| SystemError::EFAULT)?; in copy_from_user() 51 let src: &[u8] = core::slice::from_raw_parts(src.data() as *const u8, dst.len()); in copy_from_user() 55 return Ok(dst.len()); in copy_from_user() [all …]
|
H A D | misc.rs | 68 pub fn get_random(buf: *mut u8, len: usize, flags: GRandFlags) -> Result<usize, SystemError> { in get_random() 73 let mut writer = UserBufferWriter::new(buf, len, true)?; in get_random() 77 while count < len { in get_random() 79 let remain_len = len - count; in get_random() 89 Ok(len) in get_random()
|
/DragonOS/kernel/src/filesystem/procfs/ |
H A D | kmsg.rs | 71 let len = self.data.len().min(buf.len()); in read_all() localVariable 74 let src = &self.data[0..len]; in read_all() 75 buf[0..len].copy_from_slice(src); in read_all() 77 return Ok(len); in read_all() 90 let len = data_level.len().min(buf.len()); in read_level() localVariable 93 let src = &data_level[0..len]; in read_level() 94 buf[0..len].copy_from_slice(src); in read_level() 99 return Ok(data_level.len()); in read_level() 152 return self.data.len(); in tobytes()
|
H A D | mod.rs | 240 return Ok((pdata.len() * size_of::<u8>()) as i64); in open_status() 266 return Ok((data.len() * size_of::<u8>()) as i64); in open_meminfo() 273 len: usize, in proc_read() 277 let start = pdata.data.len().min(offset); in proc_read() 278 let end = pdata.data.len().min(offset + len); in proc_read() 281 if buf.len() < (end - start) { in proc_read() 287 buf[0..src.len()].copy_from_slice(src); in proc_read() 288 return Ok(src.len()); in proc_read() 495 len: usize, in read_at() 499 if buf.len() < len { in read_at() [all …]
|
/DragonOS/kernel/src/exception/ |
H A D | sysfs.rs | 159 let len = core::cmp::min(name.len() + 1, buf.len()); in show() localVariable 161 buf[..len].copy_from_slice(name.as_bytes()); in show() 162 return Ok(len); in show() 302 let mut len = 0; in show() localVariable 305 if len != 0 { in show() 306 len += sysfs_emit_str(&mut buf[len..], &format!(",{}", action.inner().name())) in show() 309 len += sysfs_emit_str(&mut buf[len..], &action.inner().name().to_string()).unwrap(); in show() 312 if len >= buf.len() { in show() 317 if len != 0 && len < buf.len() { in show() 318 len += sysfs_emit_str(&mut buf[len..], "\n").unwrap(); in show() [all …]
|
/DragonOS/user/apps/user-manage/src/parser/ |
H A D | parser.rs | 18 let args = &args[1..args.len() - 1]; in parse() 23 if idx >= args.len() { in parse() 30 if idx + 1 < args.len() { in parse() 40 if idx + 1 >= args.len() || idx + 2 >= args.len() || args[idx + 1] != "-G" { in parse() 51 if idx + 1 >= args.len() { in parse() 83 if args.len() > 1 { in parse() 103 let args = &args[1..args.len() - 1]; in parse() 108 if idx >= args.len() { in parse() 115 if idx + 1 >= args.len() { in parse()
|
/DragonOS/kernel/src/debug/ |
H A D | kallsyms.c | 69 size_t len = strlen(symbol_name); in read_symbol() local 70 if (len >= 1 && symbol_name[len - 1] == '\n') in read_symbol() 72 symbol_name[len - 1] = '\0'; in read_symbol() 73 len--; in read_symbol() 76 for (int i = 0; i < len; i++) in read_symbol() 80 char temp[len - i]; in read_symbol() 81 memcpy(temp, symbol_name + i, len - i); in read_symbol() 83 memcpy(symbol_name + i + 1, temp, len - i); in read_symbol() 88 entry->symbol_length = len + 1; // +1的原因是.asciz指令会在字符串末尾自动添加结束符\0 in read_symbol()
|
/DragonOS/kernel/src/filesystem/devfs/ |
H A D | zero_dev.rs | 115 len: usize, in read_at() 119 if buf.len() < len { in read_at() 123 for itr in buf.iter_mut().take(len) { in read_at() 127 return Ok(len); in read_at() 134 len: usize, in write_at() 138 if buf.len() < len { in write_at() 142 Ok(len) in write_at()
|
/DragonOS/kernel/src/init/ |
H A D | boot.rs | 61 .unwrap_or(self.boot_command_line.len()) in boot_cmdline_len() 85 let pos = pos.unwrap_or(self.boot_command_line.len() - 1) as isize; in boot_cmdline_append() 87 let avail = self.boot_command_line.len() as isize - pos - 1; in boot_cmdline_append() 92 let len = min(avail as usize, data.len()); in boot_cmdline_append() localVariable 94 self.boot_command_line[pos..pos + len].copy_from_slice(&data[0..len]); in boot_cmdline_append() 96 self.boot_command_line[pos + len] = 0; in boot_cmdline_append()
|
H A D | cmdline.rs | 275 let len = value.len().min(KernelCmdlineEarlyKV::VALUE_MAX_LEN); in early_init() localVariable 276 p.value[..len].copy_from_slice(&value[..len]); in early_init() 277 p.index = len; in early_init() 293 let len = v.default.len().min(KernelCmdlineEarlyKV::VALUE_MAX_LEN); in early_init() localVariable 294 v.value[..len].copy_from_slice(v.default.as_bytes()); in early_init() 295 v.index = len; in early_init() 425 name.len() == (node.len() + option.len() + 1) in find_param() 427 && name[node.len() + 1..].starts_with(option) in find_param()
|
/DragonOS/kernel/src/mm/ |
H A D | syscall.rs | 301 len: usize, in mmap() 330 len, in mmap() 340 len, in mmap() 450 pub fn munmap(start_vaddr: VirtAddr, len: usize) -> Result<usize, SystemError> { in munmap() 452 assert!(check_aligned(len, MMArch::PAGE_SIZE)); in munmap() 454 if unlikely(verify_area(start_vaddr, len).is_err()) { in munmap() 457 if unlikely(len == 0) { in munmap() 463 let page_count = PageFrameCount::new(len / MMArch::PAGE_SIZE); in munmap() 482 len: usize, in mprotect() 486 assert!(check_aligned(len, MMArch::PAGE_SIZE)); in mprotect() [all …]
|
H A D | c_adapter.rs | 35 assert!(space.len() == size); in do_kmalloc() 36 let (ptr, len, cap) = space.into_raw_parts(); in do_kmalloc() 43 drop(Vec::from_raw_parts(vaddr.data() as *mut u8, len, cap)); in do_kmalloc() 51 guard.insert(vaddr, (vaddr, len, cap)); in do_kmalloc() 69 let (vaddr, len, cap) = p.unwrap(); in kfree() 70 drop(Vec::from_raw_parts(vaddr.data() as *mut u8, len, cap)); in kfree()
|
/DragonOS/kernel/crates/unified-init/src/ |
H A D | main.rs | 29 assert_eq!(TEST_0.len(), 0); in no_element() 41 assert_ne!(TEST_0_NE.len(), 0); in no_element_ne() 52 assert_eq!(TEST_1.len(), 1); in one_element() 68 assert_eq!(TEST_2.len(), 2); in two_elements()
|
/DragonOS/kernel/src/filesystem/vfs/ |
H A D | file.rs | 248 pub fn read(&self, len: usize, buf: &mut [u8]) -> Result<usize, SystemError> { in read() 251 len, in read() 264 pub fn write(&self, len: usize, buf: &[u8]) -> Result<usize, SystemError> { in write() 267 len, in write() 282 pub fn pread(&self, offset: usize, len: usize, buf: &mut [u8]) -> Result<usize, SystemError> { in pread() 283 self.do_read(offset, len, buf, false) in pread() 295 pub fn pwrite(&self, offset: usize, len: usize, buf: &[u8]) -> Result<usize, SystemError> { in pwrite() 296 self.do_write(offset, len, buf, false) in pwrite() 302 len: usize, in do_read() 308 if buf.len() < len { in do_read() [all …]
|
/DragonOS/kernel/src/ipc/ |
H A D | pipe.rs | 187 len: usize, in read_at() 201 if buf.len() < len { in read_at() 240 if len < inode.valid_cnt as usize { in read_at() 241 end = (len + inode.read_pos as usize) % PIPE_BUFF_SIZE; in read_at() 242 num = len; in read_at() 302 metadata.size = inode.data.len() as i64; in metadata() 344 len: usize, in write_at() 356 if buf.len() < len || len > PIPE_BUFF_SIZE { in write_at() 369 while len + inode.valid_cnt as usize > PIPE_BUFF_SIZE { in write_at() 391 let end = (inode.write_pos as usize + len) % PIPE_BUFF_SIZE; in write_at() [all …]
|
/DragonOS/kernel/src/filesystem/ramfs/ |
H A D | mod.rs | 173 fn truncate(&self, len: usize) -> Result<(), SystemError> { in truncate() 182 if inode.data.len() > len { in truncate() 183 inode.data.resize(len, 0); in truncate() 203 len: usize, in read_at() 207 if buf.len() < len { in read_at() 218 let start = inode.data.len().min(offset); in read_at() 219 let end = inode.data.len().min(offset + len); in read_at() 222 if buf.len() < (end - start) { in read_at() 228 buf[0..src.len()].copy_from_slice(src); in read_at() 229 return Ok(src.len()); in read_at() [all …]
|
/DragonOS/kernel/src/filesystem/sysfs/ |
H A D | file.rs | 64 let len = attribute.show(kobj, buf)?; in callback_read() localVariable 66 if len <= offset { in callback_read() 69 let len = len - offset; in callback_read() localVariable 70 buf.copy_within(offset..offset + len, 0); in callback_read() 71 buf[len] = 0; in callback_read() 73 return Ok(len); in callback_read() 415 let len = if buf.len() > s.len() { in sysfs_emit_str() localVariable 416 s.len() in sysfs_emit_str() 418 buf.len() - 1 in sysfs_emit_str() 420 buf[..len].copy_from_slice(&s.as_bytes()[..len]); in sysfs_emit_str() [all …]
|
/DragonOS/kernel/src/perf/ |
H A D | bpf.rs | 55 pub fn new_init(start: usize, len: usize, phys_addr: PhysAddr) -> Self { in new_init() 56 Self::init(start as _, len, phys_addr) in new_init() 100 let sample_size = PerfSample::calculate_size(data.len()); in write_event() 160 let data_len = data.len(); in write_any() 180 size: size_of::<SampleHeader>() as u16 + data.len() as u16, in write_sample() 182 size: data.len() as u32, in write_sample() 233 pub fn do_mmap(&self, _start: usize, len: usize, offset: usize) -> Result<()> { in do_mmap() 237 unsafe { LockedFrameAllocator.allocate(PageFrameCount::new(len / PAGE_SIZE)) } in do_mmap() 250 let mmap_page = RingPage::new_init(virt_addr.data(), len, phy_addr); in do_mmap() 268 let len = data.mmap_page.size; in drop() localVariable [all …]
|
/DragonOS/kernel/src/driver/base/block/ |
H A D | gendisk.rs | 56 if (buf.len() & (LBA_SIZE - 1)) > 0 { in read_at() 60 let blocks = buf.len() / (1 << self.block_size_log2 as usize); in read_at() 79 .read_at_bytes(bytes_offset, buf.len(), buf); in read_at_bytes() 101 .write_at_bytes(bytes_offset, buf.len(), buf); in write_at_bytes() 113 if (buf.len() & (LBA_SIZE - 1)) > 0 { in write_at() 117 let blocks = buf.len() / (1 << self.block_size_log2 as usize); in write_at()
|
/DragonOS/kernel/crates/rbpf/src/ |
H A D | lib.rs | 396 let mem_ptr = match mem.len() { in execute_program_jit() 406 mbuff.len(), in execute_program_jit() 408 mem.len(), in execute_program_jit() 507 let mem_ptr = match mem.len() { in execute_program_cranelift() 517 Ok(prog.execute(mem_ptr, mem.len(), mbuff.as_ptr() as *mut u8, mbuff.len())) in execute_program_cranelift() 799 let l = self.mbuff.buffer.len(); in execute_program() 811 mem.as_ptr() as u64 + mem.len() as u64, in execute_program() 906 let mem_ptr = match mem.len() { in execute_program_jit() 914 self.mbuff.buffer.len(), in execute_program_jit() 916 mem.len(), in execute_program_jit() [all …]
|