Lines Matching refs:T
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
206 pub fn copy_from_user<T: core::marker::Copy>( in copy_from_user()
208 dst: &mut [T], in copy_from_user() argument
221 pub fn copy_one_from_user<T: core::marker::Copy>( in copy_one_from_user()
223 dst: &mut T, in copy_one_from_user() argument
226 let data = self.convert_one_with_offset::<T>(self.buffer, offset)?; in copy_one_from_user()
236 pub fn buffer<T>(&self, offset: usize) -> Result<&[T], SystemError> { in buffer() argument
237 self.convert_with_offset::<T>(self.buffer, offset) in buffer()
241 fn convert_with_offset<T>(&self, src: &[u8], offset: usize) -> Result<&[T], SystemError> { in convert_with_offset() argument
246 if byte_buffer.len() % core::mem::size_of::<T>() != 0 || byte_buffer.is_empty() { in convert_with_offset()
252 byte_buffer.as_ptr() as *const T, in convert_with_offset() constant
253 byte_buffer.len() / core::mem::size_of::<T>(), 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
260 if offset + core::mem::size_of::<T>() > src.len() { in convert_one_with_offset()
263 let byte_buffer: &[u8] = &src[offset..offset + core::mem::size_of::<T>()]; in convert_one_with_offset()
265 let chunks = unsafe { from_raw_parts(byte_buffer.as_ptr() as *const T, 1) }; in convert_one_with_offset() constant
298 pub fn copy_to_user<T: core::marker::Copy>( in copy_to_user()
300 src: &[T], in copy_to_user() argument
314 pub fn copy_one_to_user<T: core::marker::Copy>( in copy_one_to_user()
316 src: &T, in copy_one_to_user() argument
319 let dst = Self::convert_one_with_offset::<T>(self.buffer, offset)?; in copy_one_to_user()
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
333 if byte_buffer.len() % core::mem::size_of::<T>() != 0 || byte_buffer.is_empty() { in convert_with_offset()
339 byte_buffer.as_mut_ptr() as *mut T, in convert_with_offset()
340 byte_buffer.len() / core::mem::size_of::<T>(), 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
347 if offset + core::mem::size_of::<T>() > src.len() { in convert_one_with_offset()
350 let byte_buffer: &mut [u8] = &mut src[offset..offset + core::mem::size_of::<T>()]; in convert_one_with_offset()
352 let chunks = unsafe { from_raw_parts_mut(byte_buffer.as_mut_ptr() as *mut T, 1) }; in convert_one_with_offset()