Lines Matching refs:offset
189 pub fn read_from_user<T>(&self, offset: usize) -> Result<&[T], SystemError> { in read_from_user()
190 return self.convert_with_offset(self.buffer, offset); in read_from_user()
197 pub fn read_one_from_user<T>(&self, offset: usize) -> Result<&T, SystemError> { in read_one_from_user()
198 return self.convert_one_with_offset(self.buffer, offset); in read_one_from_user()
209 offset: usize, in copy_from_user()
211 let data = self.convert_with_offset(self.buffer, offset)?; in copy_from_user()
224 offset: usize, in copy_one_from_user()
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()
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()
242 if offset >= src.len() { in convert_with_offset()
245 let byte_buffer: &[u8] = &src[offset..]; in convert_with_offset()
259 fn convert_one_with_offset<T>(&self, src: &[u8], offset: usize) -> Result<&T, SystemError> { in convert_one_with_offset()
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()
301 offset: usize, in copy_to_user()
303 let dst = Self::convert_with_offset(self.buffer, offset)?; in copy_to_user()
317 offset: usize, in copy_one_to_user()
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()
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()
329 if offset >= src.len() { in convert_with_offset()
332 let byte_buffer: &mut [u8] = &mut src[offset..]; 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()
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()