Home
last modified time | relevance | path

Searched refs:len (Results 1 – 25 of 111) sorted by relevance

12345

/DragonOS-0.1.9/user/apps/dmesg/
Dmain.c9 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-0.1.9/kernel/src/libs/
Dvec_cursor.rs47 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 + buf.len() * size_of::<u16>() > self.data.len() * size_of::<u16>() { in read_u16_into()
119 for i in 0..buf.len() { in read_u16_into()
143 pos = self.data.len() as i64 + offset; in seek()
[all …]
Drbtree.rs343 len: usize, field
363 new.len = self.len; in clone()
409 kdebug!("This tree size = {:?}, begin:-------------", self.len()); in print_tree()
422 if self.len() != other.len() { in eq()
609 len: usize, field
624 if self.len == 0 { in next()
640 self.len -= 1; in next()
645 (self.len, Some(self.len)) in size_hint()
652 if self.len == 0 { in next_back()
664 self.len -= 1; in next_back()
[all …]
Dprintk.c68 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-0.1.9/kernel/src/syscall/
Duser_access.rs28 pub unsafe fn clear_user(dest: VirtAddr, len: usize) -> Result<usize, SystemError> { in clear_user()
29 verify_area(dest, len).map_err(|_| SystemError::EFAULT)?; in clear_user()
33 p.write_bytes(0, len); in clear_user()
34 return Ok(len); in clear_user()
38 verify_area(dest, src.len()).map_err(|_| SystemError::EFAULT)?; in copy_to_user()
42 p.copy_from_nonoverlapping(src.as_ptr(), src.len()); in copy_to_user()
43 return Ok(src.len()); in copy_to_user()
48 verify_area(src, dst.len()).map_err(|_| SystemError::EFAULT)?; in copy_from_user()
50 let src: &[u8] = core::slice::from_raw_parts(src.data() as *const u8, dst.len()); in copy_from_user()
54 return Ok(dst.len()); in copy_from_user()
[all …]
Dmisc.rs68 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()
86 Ok(len) in get_random()
Dmod.rs136 let len = args[2]; in handle() localVariable
139 UserBufferWriter::new(buf_vaddr as *mut u8, len, from_user)?; in handle()
147 let len = args[2]; in handle() localVariable
150 UserBufferReader::new(buf_vaddr as *const u8, len, from_user)?; in handle()
175 let len = args[2]; in handle() localVariable
179 UserBufferWriter::new(buf_vaddr as *mut u8, len, frame.from_user())?; in handle()
181 Self::pread(fd, buf, len, offset) in handle()
187 let len = args[2]; in handle() localVariable
191 UserBufferReader::new(buf_vaddr as *const u8, len, frame.from_user())?; in handle()
194 Self::pwrite(fd, buf, len, offset) in handle()
[all …]
/DragonOS-0.1.9/kernel/src/filesystem/procfs/
Dkmsg.rs70 let len = self.data.len().min(buf.len()); in read_all() localVariable
73 let src = &self.data[0..len]; in read_all()
74 buf[0..len].copy_from_slice(src); in read_all()
76 return Ok(len); in read_all()
89 let len = data_level.len().min(buf.len()); in read_level() localVariable
92 let src = &data_level[0..len]; in read_level()
93 buf[0..len].copy_from_slice(src); in read_level()
98 return Ok(data_level.len()); in read_level()
151 return self.data.len(); in tobytes()
Dmod.rs217 return Ok((pdata.len() * size_of::<u8>()) as i64); in open_status()
243 return Ok((data.len() * size_of::<u8>()) as i64); in open_meminfo()
250 len: usize, in proc_read()
254 let start = _pdata.data.len().min(offset); in proc_read()
255 let end = _pdata.data.len().min(offset + len); in proc_read()
258 if buf.len() < (end - start) { in proc_read()
264 buf[0..src.len()].copy_from_slice(src); in proc_read()
265 return Ok(src.len()); in proc_read()
452 len: usize, in read_at()
456 if buf.len() < len { in read_at()
[all …]
/DragonOS-0.1.9/kernel/src/exception/
Dsysfs.rs158 let len = core::cmp::min(name.len() + 1, buf.len()); in show() localVariable
160 buf[..len].copy_from_slice(name.as_bytes()); in show()
161 return Ok(len); in show()
301 let mut len = 0; in show() localVariable
304 if len != 0 { in show()
305 len += sysfs_emit_str(&mut buf[len..], &format!(",{}", action.inner().name())) in show()
308 len += in show()
309 sysfs_emit_str(&mut buf[len..], &format!("{}", action.inner().name())).unwrap(); in show()
312 if len >= buf.len() { in show()
317 if len != 0 && len < buf.len() { in show()
[all …]
/DragonOS-0.1.9/kernel/src/debug/
Dkallsyms.c69 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-0.1.9/kernel/src/init/
Dmod.rs80 let pos = pos.unwrap_or_else(|| self.boot_command_line.len() - 1) as isize; in boot_cmdline_append()
82 let avail = self.boot_command_line.len() as isize - pos - 1; in boot_cmdline_append()
87 let len = min(avail as usize, data.len()); in boot_cmdline_append() localVariable
89 self.boot_command_line[pos..pos + len].copy_from_slice(&data[0..len]); in boot_cmdline_append()
91 self.boot_command_line[pos + len] = 0; in boot_cmdline_append()
/DragonOS-0.1.9/kernel/src/mm/allocator/
Dslab.rs27 return self.free_block_list.len(); in used_blocks()
61 len: usize, field
77 return FreeBlockList { len: 0, head: None }; in new_empty()
80 fn len(&self) -> usize { in len() method
81 return self.len; in len()
89 self.len -= 1; in pop()
98 self.len += 1; in push()
/DragonOS-0.1.9/kernel/src/filesystem/vfs/
Dfile.rs171 pub fn read(&mut self, len: usize, buf: &mut [u8]) -> Result<usize, SystemError> { in read()
172 self.do_read(self.offset, len, buf, true) in read()
182 pub fn write(&mut self, len: usize, buf: &[u8]) -> Result<usize, SystemError> { in write()
183 self.do_write(self.offset, len, buf, true) in write()
198 len: usize, in pread()
201 self.do_read(offset, len, buf, false) in pread()
213 pub fn pwrite(&mut self, offset: usize, len: usize, buf: &[u8]) -> Result<usize, SystemError> { in pwrite()
214 self.do_write(offset, len, buf, false) in pwrite()
220 len: usize, in do_read()
226 if buf.len() < len { in do_read()
[all …]
Dsyscall.rs324 return file.lock_no_preempt().read(buf.len(), buf); in read()
344 return file.lock_no_preempt().write(buf.len(), buf); in write()
373 pub fn pread(fd: i32, buf: &mut [u8], len: usize, offset: usize) -> Result<usize, SystemError> { in pread()
385 return file.lock_no_preempt().pread(offset, len, buf); in pread()
395 pub fn pwrite(fd: i32, buf: &[u8], len: usize, offset: usize) -> Result<usize, SystemError> { in pwrite()
407 return file.lock_no_preempt().pwrite(offset, len, buf); in pwrite()
437 if path.len() > 0 { in chdir()
491 let cwd_len = cwd_bytes.len(); in getcwd()
492 if cwd_len + 1 > buf.len() { in getcwd()
579 if pathname.len() >= MAX_PATHLEN { in rmdir()
[all …]
/DragonOS-0.1.9/kernel/src/filesystem/devfs/
Dzero_dev.rs110 len: usize, in read_at()
114 if buf.len() < len { in read_at()
118 for i in 0..len { in read_at()
122 return Ok(len); in read_at()
129 len: usize, in write_at()
133 if buf.len() < len { in write_at()
137 Ok(len) in write_at()
/DragonOS-0.1.9/kernel/crates/unified-init/src/
Dmain.rs22 assert_eq!(TEST_0.len(), 0); in no_element()
34 assert_ne!(TEST_0_NE.len(), 0); in no_element_ne()
45 assert_eq!(TEST_1.len(), 1); in one_element()
61 assert_eq!(TEST_2.len(), 2); in two_elements()
/DragonOS-0.1.9/kernel/src/filesystem/ramfs/
Dmod.rs124 fn truncate(&self, len: usize) -> Result<(), SystemError> { in truncate()
133 if inode.data.len() > len { in truncate()
134 inode.data.resize(len, 0); in truncate()
154 len: usize, in read_at()
158 if buf.len() < len { in read_at()
169 let start = inode.data.len().min(offset); in read_at()
170 let end = inode.data.len().min(offset + len); in read_at()
173 if buf.len() < (end - start) { in read_at()
179 buf[0..src.len()].copy_from_slice(src); in read_at()
180 return Ok(src.len()); in read_at()
[all …]
/DragonOS-0.1.9/kernel/src/ipc/
Dpipe.rs151 len: usize, in read_at()
163 if buf.len() < len { in read_at()
205 if len < inode.valid_cnt as usize { in read_at()
206 end = (len + inode.read_pos as usize) % PIPE_BUFF_SIZE; in read_at()
207 num = len; in read_at()
269 metadata.size = inode.data.len() as i64; in metadata()
313 len: usize, in write_at()
325 if buf.len() < len || len > PIPE_BUFF_SIZE { in write_at()
337 while len + inode.valid_cnt as usize > PIPE_BUFF_SIZE { in write_at()
362 let end = (inode.write_pos as usize + len) % PIPE_BUFF_SIZE; in write_at()
[all …]
/DragonOS-0.1.9/kernel/src/filesystem/sysfs/
Dfile.rs64 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; in sysfs_emit_str() localVariable
416 if buf.len() > s.len() { in sysfs_emit_str()
417 len = s.len(); in sysfs_emit_str()
419 len = buf.len() - 1; in sysfs_emit_str()
[all …]
/DragonOS-0.1.9/kernel/src/driver/disk/ahci/
Dahci_inode.rs115 len: usize, in read_at()
119 if buf.len() < len { in read_at()
124 return self.0.lock().disk.read_at_bytes(offset, len, buf); in read_at()
134 len: usize, in write_at()
138 if buf.len() < len { in write_at()
143 return self.0.lock().disk.write_at_bytes(offset, len, buf); in write_at()
/DragonOS-0.1.9/kernel/src/mm/
Dc_adapter.rs81 assert!(space.len() == size); in do_kmalloc()
82 let (ptr, len, cap) = space.into_raw_parts(); in do_kmalloc()
85 let len = len as usize; in do_kmalloc() localVariable
91 drop(Vec::from_raw_parts(vaddr.data() as *mut u8, len, cap)); in do_kmalloc()
99 guard.insert(vaddr, (vaddr, len, cap)); in do_kmalloc()
117 let (vaddr, len, cap) = p.unwrap(); in kfree()
118 drop(Vec::from_raw_parts(vaddr.data() as *mut u8, len, cap)); in kfree()
Dsyscall.rs209 len: usize, in mmap()
241 len, in mmap()
346 pub fn munmap(start_vaddr: VirtAddr, len: usize) -> Result<usize, SystemError> { in munmap()
348 assert!(check_aligned(len, MMArch::PAGE_SIZE)); in munmap()
350 if unlikely(verify_area(start_vaddr, len).is_err()) { in munmap()
353 if unlikely(len == 0) { in munmap()
359 let page_count = PageFrameCount::new(len / MMArch::PAGE_SIZE); in munmap()
378 len: usize, in mprotect()
382 assert!(check_aligned(len, MMArch::PAGE_SIZE)); in mprotect()
384 if unlikely(verify_area(start_vaddr, len).is_err()) { in mprotect()
[all …]
/DragonOS-0.1.9/kernel/src/driver/base/block/
Dblock_device.rs153 pub fn len(&self) -> usize { in len() method
158 return self.len() == (1usize << self.blk_size_log2); in is_full()
162 return self.len() >= (1usize << self.blk_size_log2) in is_multi()
163 && (self.len() % (1usize << self.blk_size_log2) == 0); in is_multi()
242 fn write_at_bytes(&self, offset: usize, len: usize, buf: &[u8]) -> Result<usize, SystemError> { in write_at_bytes()
244 if len > buf.len() { in write_at_bytes()
248 let iter = BlockIter::new_multiblock(offset, offset + len, self.blk_size_log2()); in write_at_bytes()
274 return Ok(len); in write_at_bytes()
281 len: usize, in read_at_bytes()
284 if len > buf.len() { in read_at_bytes()
[all …]
/DragonOS-0.1.9/user/apps/test_uart/
Dmain.c26 int len = write(fd, str, strlen(str)); in main() local
27 printf("len: %d", len); in main()

12345