Lines Matching refs:SystemError
13 use super::SystemError;
29 pub unsafe fn clear_user(dest: VirtAddr, len: usize) -> Result<usize, SystemError> { in clear_user() argument
30 verify_area(dest, len).map_err(|_| SystemError::EFAULT)?; in clear_user()
38 pub unsafe fn copy_to_user(dest: VirtAddr, src: &[u8]) -> Result<usize, SystemError> { in copy_to_user() argument
39 verify_area(dest, src.len()).map_err(|_| SystemError::EFAULT)?; in copy_to_user()
48 pub unsafe fn copy_from_user(dst: &mut [u8], src: VirtAddr) -> Result<usize, SystemError> { in copy_from_user() argument
49 verify_area(src, dst.len()).map_err(|_| SystemError::EFAULT)?; in copy_from_user()
78 ) -> Result<CString, SystemError> { in check_and_clone_cstr() argument
80 return Err(SystemError::EFAULT); in check_and_clone_cstr()
98 buffer.push(NonZero::new(c[0]).ok_or(SystemError::EINVAL)?); in check_and_clone_cstr()
120 pub fn check_and_clone_cstr_array(user: *const *const u8) -> Result<Vec<CString>, SystemError> { in check_and_clone_cstr_array() argument
171 pub fn new<U>(addr: *const U, len: usize, from_user: bool) -> Result<Self, SystemError> { in new() argument
173 return Err(SystemError::EFAULT); in new()
189 pub fn read_from_user<T>(&self, offset: usize) -> Result<&[T], SystemError> { in read_from_user() argument
197 pub fn read_one_from_user<T>(&self, offset: usize) -> Result<&T, SystemError> { in read_one_from_user() argument
210 ) -> Result<usize, SystemError> { in copy_from_user() argument
225 ) -> Result<(), SystemError> { in copy_one_from_user() argument
236 pub fn buffer<T>(&self, offset: usize) -> Result<&[T], SystemError> { in buffer() argument
238 .map_err(|_| SystemError::EINVAL) in buffer()
241 fn convert_with_offset<T>(&self, src: &[u8], offset: usize) -> Result<&[T], SystemError> { in convert_with_offset() argument
243 return Err(SystemError::EINVAL); in convert_with_offset()
247 return Err(SystemError::EINVAL); in convert_with_offset()
259 fn convert_one_with_offset<T>(&self, src: &[u8], offset: usize) -> Result<&T, SystemError> { in convert_one_with_offset() argument
261 return Err(SystemError::EINVAL); in convert_one_with_offset()
279 pub fn new<U>(addr: *mut U, len: usize, from_user: bool) -> Result<Self, SystemError> { in new() argument
281 return Err(SystemError::EFAULT); in new()
302 ) -> Result<usize, SystemError> { in copy_to_user() argument
318 ) -> Result<(), SystemError> { in copy_one_to_user() argument
324 pub fn buffer<T>(&'a mut self, offset: usize) -> Result<&mut [T], SystemError> { in buffer() argument
325 Self::convert_with_offset::<T>(self.buffer, offset).map_err(|_| SystemError::EINVAL) in buffer()
328 fn convert_with_offset<T>(src: &mut [u8], offset: usize) -> Result<&mut [T], SystemError> { in convert_with_offset() argument
330 return Err(SystemError::EINVAL); in convert_with_offset()
334 return Err(SystemError::EINVAL); in convert_with_offset()
346 fn convert_one_with_offset<T>(src: &mut [u8], offset: usize) -> Result<&mut T, SystemError> { in convert_one_with_offset() argument
348 return Err(SystemError::EINVAL); in convert_one_with_offset()