Home
last modified time | relevance | path

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

123

/DragonOS-0.1.8/kernel/src/libs/
Dvec_cursor.rs46 if self.pos >= self.data.len() { in read_u8()
55 if self.pos + 2 > self.data.len() { in read_u16()
69 if self.pos + 4 > self.data.len() { in read_u32()
83 if self.pos + 8 > self.data.len() { in read_u64()
102 if self.pos + buf.len() > self.data.len() { in read_exact()
105 buf.copy_from_slice(&self.data[self.pos..self.pos + buf.len()]); in read_exact()
106 self.pos += buf.len(); in read_exact()
114 if self.pos + buf.len() * size_of::<u16>() > self.data.len() * size_of::<u16>() { in read_u16_into()
118 for i in 0..buf.len() { in read_u16_into()
142 pos = self.data.len() as i64 + offset; in seek()
[all …]
Dcrc8.c33 uint8_t crc8(uint8_t crc, uint8_t const *buffer, size_t len) in crc8() argument
35 while (len--) in crc8()
Dcrc7.c31 uint8_t crc7(uint8_t crc, const uint8_t *buffer, size_t len) in crc7() argument
33 while (len--) in crc7()
Dcrc16.c34 uint16_t crc16(uint16_t crc, uint8_t const *buffer, size_t len) in crc16() argument
36 while (len--) in crc16()
Dcrc32.c49 uint32_t crc32(uint32_t crc, uint8_t const *buffer, size_t len) in crc32() argument
51 while (len--) in crc32()
Dcrc64.c50 uint64_t crc64(uint64_t crc, uint8_t const *buffer, size_t len) in crc64() argument
52 while (len--) in crc64()
Drbtree.rs343 len: usize, field
360 new.len = self.len; in clone()
406 kdebug!("This tree size = {:?}, begin:-------------", self.len()); in print_tree()
419 if self.len() != other.len() { in eq()
606 len: usize, field
621 if self.len == 0 { in next()
637 self.len -= 1; in next()
642 (self.len, Some(self.len)) in size_hint()
649 if self.len == 0 { in next_back()
661 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.8/kernel/src/ipc/
Dpipe.rs78 len: usize, in read_at()
82 if buf.len() < len { in read_at()
110 if len < inode.valid_cnt as usize { in read_at()
111 end = (len + inode.read_pos as usize) % PIPE_BUFF_SIZE; in read_at()
112 num = len; in read_at()
145 metadata.size = inode.data.len() as i64; in metadata()
157 len: usize, in write_at()
161 if buf.len() < len || len > PIPE_BUFF_SIZE { in write_at()
170 while len + inode.valid_cnt as usize > PIPE_BUFF_SIZE { in write_at()
186 let end = (inode.write_pos as usize + len) % PIPE_BUFF_SIZE; in write_at()
[all …]
/DragonOS-0.1.8/kernel/src/syscall/
Duser_access.rs24 pub unsafe fn clear_user(dest: VirtAddr, len: usize) -> Result<usize, SystemError> { in clear_user()
25 verify_area(dest, len).map_err(|_| SystemError::EFAULT)?; in clear_user()
29 p.write_bytes(0, len); in clear_user()
30 return Ok(len); in clear_user()
34 verify_area(dest, src.len()).map_err(|_| SystemError::EFAULT)?; in copy_to_user()
38 p.copy_from_nonoverlapping(src.as_ptr(), src.len()); in copy_to_user()
39 return Ok(src.len()); in copy_to_user()
44 verify_area(src, dst.len()).map_err(|_| SystemError::EFAULT)?; in copy_from_user()
46 let src: &[u8] = core::slice::from_raw_parts(src.data() as *const u8, dst.len()); in copy_from_user()
50 return Ok(dst.len()); in copy_from_user()
Dmod.rs435 let len = args[2]; in handle() localVariable
438 let res = if from_user && verify_area(virt_addr, len as usize).is_err() { in handle()
443 core::slice::from_raw_parts_mut::<'static, u8>(buf_vaddr as *mut u8, len) in handle()
454 let len = args[2]; in handle() localVariable
457 let res = if from_user && verify_area(virt_addr, len as usize).is_err() { in handle()
462 core::slice::from_raw_parts::<'static, u8>(buf_vaddr as *const u8, len) in handle()
525 if dest_path.len() == 0 { in handle()
527 } else if dest_path.len() > PAGE_4K_SIZE as usize { in handle()
545 let len = args[2]; in handle() localVariable
548 let res = if from_user && verify_area(virt_addr, len as usize).is_err() { in handle()
[all …]
/DragonOS-0.1.8/user/apps/test_relibc/
Dmain.c76 int len = recv(conn, buffer, sizeof(buffer), 0); in tcp_server() local
77 if (len <= 0) in tcp_server()
79 printf("Receive data failed! len=%d\n", len); in tcp_server()
88 send(conn, buffer, len, 0); in tcp_server()
119 …int len = recvfrom(server_sockfd, buffer, sizeof(buffer), 0, (struct sockaddr *)&client_addr, &cli… in udp_server() local
120 if (len <= 0) in udp_server()
122 printf("Receive data failed! len=%d", len); in udp_server()
131 sendto(server_sockfd, buffer, len, 0, (struct sockaddr *)&client_addr, client_length); in udp_server()
195 int sockfd, len = 0; in udp_client() local
222 len = read(STDIN_FILENO, buffer, sizeof(buffer)); in udp_client()
[all …]
/DragonOS-0.1.8/kernel/src/mm/
Dsyscall.rs120 len: usize, in mmap()
152 len, in mmap()
170 pub fn munmap(start_vaddr: VirtAddr, len: usize) -> Result<usize, SystemError> { in munmap()
172 assert!(check_aligned(len, MMArch::PAGE_SIZE)); in munmap()
174 if unlikely(verify_area(start_vaddr, len).is_err()) { in munmap()
177 if unlikely(len == 0) { in munmap()
183 let page_count = PageFrameCount::new(len / MMArch::PAGE_SIZE); in munmap()
201 len: usize, in mprotect()
205 assert!(check_aligned(len, MMArch::PAGE_SIZE)); in mprotect()
207 if unlikely(verify_area(start_vaddr, len).is_err()) { in mprotect()
[all …]
Dc_adapter.rs90 assert!(space.len() == size); in do_kmalloc()
91 let (ptr, len, cap) = space.into_raw_parts(); in do_kmalloc()
94 let len = len as usize; in do_kmalloc() localVariable
100 drop(Vec::from_raw_parts(vaddr.data() as *mut u8, len, cap)); in do_kmalloc()
108 guard.insert(vaddr, (vaddr, len, cap)); in do_kmalloc()
126 let (vaddr, len, cap) = p.unwrap(); in kfree()
127 drop(Vec::from_raw_parts(vaddr.data() as *mut u8, len, cap)); in kfree()
/DragonOS-0.1.8/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.8/kernel/src/filesystem/devfs/
Dzero_dev.rs112 len: usize, in read_at()
116 if buf.len() < len { in read_at()
120 for i in 0..len { in read_at()
124 return Ok(len); in read_at()
131 len: usize, in write_at()
135 if buf.len() < len { in write_at()
139 Ok(len) in write_at()
/DragonOS-0.1.8/kernel/src/filesystem/vfs/
Dfile.rs128 pub fn read(&mut self, len: usize, buf: &mut [u8]) -> Result<usize, SystemError> { in read()
132 if buf.len() < len { in read()
141 let len = self in read() localVariable
143 .read_at(self.offset, len, buf, &mut self.private_data)?; in read()
144 self.offset += len; in read()
145 return Ok(len); in read()
155 pub fn write(&mut self, len: usize, buf: &[u8]) -> Result<usize, SystemError> { in write()
158 if buf.len() < len { in write()
167 let len = self in write() localVariable
169 .write_at(self.offset, len, buf, &mut self.private_data)?; in write()
[all …]
/DragonOS-0.1.8/kernel/src/io/
Ddevice.rs35 fn read_at(&self, offset: usize, len: usize, buf: &mut [u8]) -> Result<usize, SystemError>; in read_at()
42 fn write_at(&self, offset: usize, len: usize, buf: &[u8]) -> Result<usize, SystemError>; in write_at()
109 fn read_at(&self, offset: usize, len: usize, buf: &mut [u8]) -> Result<usize, SystemError> { in read_at()
110 if len > buf.len() { in read_at()
114 let iter = BlockIter::new_multiblock(offset, offset + len, self.blk_size_log2()); in read_at()
141 return Ok(len); in read_at()
145 fn write_at(&self, offset: usize, len: usize, buf: &[u8]) -> Result<usize, SystemError> { in write_at()
147 if len > buf.len() { in write_at()
151 let iter = BlockIter::new_multiblock(offset, offset + len, self.blk_size_log2()); in write_at()
177 return Ok(len); in write_at()
[all …]
/DragonOS-0.1.8/kernel/src/filesystem/ramfs/
Dmod.rs120 len: usize, in read_at()
124 if buf.len() < len { in read_at()
135 let start = inode.data.len().min(offset); in read_at()
136 let end = inode.data.len().min(offset + len); in read_at()
139 if buf.len() < (end - start) { in read_at()
145 buf[0..src.len()].copy_from_slice(src); in read_at()
146 return Ok(src.len()); in read_at()
152 len: usize, in write_at()
156 if buf.len() < len { in write_at()
171 if offset + len > data.len() { in write_at()
[all …]
/DragonOS-0.1.8/kernel/src/driver/tty/
Dtty_device.rs78 pub fn check_rw_param(&self, len: usize, buf: &[u8]) -> Result<(), SystemError> { in check_rw_param()
79 if len > buf.len() { in check_rw_param()
145 len: usize, in read_at()
156 self.check_rw_param(len, buf)?; in read_at()
159 let r: Result<usize, TtyError> = self.core.read_stdin(&mut buf[0..len], true); in read_at()
179 len: usize, in write_at()
191 self.check_rw_param(len, buf)?; in write_at()
195 self.core.stdout(&buf[0..len], true) in write_at()
197 self.core.stderr(&buf[0..len], true) in write_at()
243 let len; in sync() localVariable
[all …]
/DragonOS-0.1.8/kernel/src/driver/disk/ahci/
Dahci_inode.rs118 len: usize, in read_at()
122 if buf.len() < len { in read_at()
127 return self.0.lock().disk.read_at(offset, len, buf); in read_at()
137 len: usize, in write_at()
141 if buf.len() < len { in write_at()
146 return self.0.lock().disk.write_at(offset, len, buf); in write_at()
/DragonOS-0.1.8/user/libs/libc/src/
Dstdio.c18 int len = strlen(buf); in fprintf() local
19 if (len > bufsize - 1) in fprintf()
21 len = bufsize - 1; in fprintf()
24 write(stream->fd, buf, len); in fprintf()
Ddirent.c72 int len = getdents(dir->fd, (struct dirent *)dir->buf, DIR_BUF_SIZE); in readdir() local
74 if (len > 0) in readdir()
/DragonOS-0.1.8/kernel/src/filesystem/procfs/
Dmod.rs193 return Ok((pdata.len() * size_of::<u8>()) as i64); in open_status()
200 len: usize, in read_status()
204 let start = _pdata.data.len().min(offset); in read_status()
205 let end = _pdata.data.len().min(offset + len); in read_status()
208 if buf.len() < (end - start) { in read_status()
214 buf[0..src.len()].copy_from_slice(src); in read_status()
215 return Ok(src.len()); in read_status()
368 len: usize, in read_at()
372 if buf.len() < len { in read_at()
393 ProcFileType::ProcStatus => return inode.read_status(offset, len, buf, private_data), in read_at()
[all …]
/DragonOS-0.1.8/kernel/src/common/
Dstring.h64 static inline int memcmp(const void *s1, const void *s2, size_t len) in memcmp() argument
71 : "c"(len) in memcmp()

123