| /linux/rust/kernel/ |
| H A D | sizes.rs | 7 //! The top-level `SZ_*` constants are [`usize`]-typed, for use in kernel page 11 //! on [`u32`], [`u64`], and [`usize`], for use in device address spaces where 13 //! these constants as [`u64`] (or [`u32`]) rather than [`usize`], because 93 pub const $name: usize = bindings::$name as usize; 98 /// Implemented for [`u32`], [`u64`], and [`usize`] so drivers can 134 define_sizes!(u32, u64, usize);
|
| H A D | io.rs | 42 pub struct MmioRaw<const SIZE: usize = 0> { 43 addr: usize, 44 maxsize: usize, 47 impl<const SIZE: usize> MmioRaw<SIZE> { 49 pub fn new(addr: usize, maxsize: usize) -> Result<Self> { in new() argument 59 pub fn addr(&self) -> usize { in addr() argument 65 pub fn maxsize(&self) -> usize { in maxsize() argument 142 pub struct Mmio<const SIZE: usize = 0>(MmioRaw<SIZE>); 147 const fn offset_valid<U>(offset: usize, size: usize) -> bool { in offset_valid() argument 170 unsafe fn io_read(&self, address: usize) -> T; in io_read() [all …]
|
| H A D | bitmap.rs | 35 pub unsafe fn from_raw<'a>(ptr: *const usize, nbits: usize) -> &'a Bitmap { in from_raw() argument 60 pub unsafe fn from_raw_mut<'a>(ptr: *mut usize, nbits: usize) -> &'a mut Bitmap { in from_raw_mut() argument 76 pub fn as_ptr(&self) -> *const usize { in as_ptr() argument 77 core::ptr::from_ref::<Bitmap>(self).cast::<usize>() in as_ptr() 81 pub fn as_mut_ptr(&mut self) -> *mut usize { in as_mut_ptr() argument 82 core::ptr::from_mut::<Bitmap>(self).cast::<usize>() in as_mut_ptr() 87 pub fn len(&self) -> usize { in len() argument 95 bitmap: usize, 96 ptr: NonNull<usize>, 158 nbits: usize, [all …]
|
| H A D | device_id.rs | 48 const DRIVER_DATA_OFFSET: usize; 52 fn index(&self) -> usize; in index() argument 57 pub struct RawIdArray<T: RawDeviceId, const N: usize> { 62 impl<T: RawDeviceId, const N: usize> RawIdArray<T, N> { 64 pub const fn size(&self) -> usize { in size() argument 71 pub struct IdArray<T: RawDeviceId, U, const N: usize> { 76 impl<T: RawDeviceId, U, const N: usize> IdArray<T, U, N> { 88 const unsafe fn build(ids: [(T, U); N], data_offset: Option<usize>) -> Self { in build() 104 .cast::<usize>() 147 impl<T: RawDeviceId + RawDeviceIdIndex, U, const N: usize> IdArray<T, U, N> { [all …]
|
| H A D | ptr.rs | 31 pub struct Alignment(NonZero<usize>); 48 pub const fn new<const ALIGN: usize>() -> Self { in new() 75 pub const fn new_checked(align: usize) -> Option<Self> { in new_checked() 108 pub const fn as_usize(self) -> usize { in as_usize() argument 124 pub const fn as_nonzero(self) -> NonZero<usize> { in as_nonzero() argument 162 pub const fn mask(self) -> usize { in mask() argument 232 impl_alignable_uint!(u8, u16, u32, u64, usize); 239 fn size(p: *const Self) -> usize; in size() argument 244 fn size(_: *const Self) -> usize { in size() argument 251 fn size(p: *const Self) -> usize { in size() argument [all …]
|
| H A D | uaccess.rs | 30 pub fn from_addr(addr: usize) -> Self { in from_addr() 61 pub fn wrapping_byte_add(self, add: usize) -> UserPtr { in wrapping_byte_add() 151 length: usize, 167 pub fn new(ptr: UserPtr, length: usize) -> Self { in new() 216 length: usize, 223 pub fn skip(&mut self, num_skip: usize) -> Result { in skip() 246 pub fn len(&self) -> usize { in len() argument 299 pub fn read_slice_partial(&mut self, out: &mut [u8], offset: usize) -> Result<usize> { in read_slice_partial() argument 318 pub fn read_slice_file(&mut self, out: &mut [u8], offset: &mut file::Offset) -> Result<usize> { in read_slice_file() argument 448 length: usize, [all …]
|
| H A D | maple_tree.rs | 56 fn to_maple_range(range: impl RangeBounds<usize>) -> Option<(usize, usize)> { in to_maple_range() argument 66 Bound::Unbounded => usize::MAX, in to_maple_range() 121 pub fn insert(&self, index: usize, value: T, gfp: Flags) -> Result<(), InsertError<T>> { in insert() argument 171 R: RangeBounds<usize>, in insert_range() argument 227 pub fn erase(&self, index: usize) -> Option<T> { in erase() 263 let mut ma_state = unsafe { MaState::new_raw(self.into_ref().get_ref(), 0, usize::MAX) }; in free_all_entries() 276 ma_state.mas_find_raw(usize::MAX) in free_all_entries() 323 pub fn ma_state(&mut self, first: usize, end: usize) -> MaState<'_, T> { in ma_state() argument 376 pub fn load(&mut self, index: usize) -> Option<T::BorrowedMut<'_>> { in load() 442 size: usize, in alloc_range() argument [all …]
|
| H A D | id_pool.rs | 74 num_ids: usize, 114 pub fn with_capacity(num_ids: usize, flags: Flags) -> Result<Self, AllocError> { in with_capacity() argument 115 let num_ids = usize::max(num_ids, BitmapVec::MAX_INLINE_LEN); in with_capacity() 122 pub fn capacity(&self) -> usize { in capacity() argument 170 let num_ids = usize::max(BitmapVec::MAX_INLINE_LEN, cap / 2); in shrink_request() 230 pub fn find_unused_id(&mut self, offset: usize) -> Option<UnusedId<'_>> { in find_unused_id() 240 pub fn release_id(&mut self, id: usize) { in release_id() argument 251 id: usize, 264 pub fn as_usize(&self) -> usize { in as_usize() argument 284 pub fn acquire(self) -> usize { in acquire() argument
|
| /linux/lib/crypto/mpi/ |
| H A D | mpi-add.c | 21 mpi_size_t usize, vsize, wsize; in mpi_add() local 26 usize = v->nlimbs; in mpi_add() 30 wsize = usize + 1; in mpi_add() 38 usize = u->nlimbs; in mpi_add() 42 wsize = usize + 1; in mpi_add() 54 MPN_COPY(wp, up, usize); in mpi_add() 55 wsize = usize; in mpi_add() 59 if (usize != vsize) { in mpi_add() 60 mpihelp_sub(wp, up, usize, vp, vsize); in mpi_add() 61 wsize = usize; in mpi_add() [all …]
|
| H A D | mpi-cmp.c | 52 mpi_size_t usize, vsize; in mpi_cmp() local 57 usize = u->nlimbs; in mpi_cmp() 63 if (usize != vsize && !u->sign && !v->sign) in mpi_cmp() 64 return usize - vsize; in mpi_cmp() 65 if (usize != vsize && u->sign && v->sign) in mpi_cmp() 66 return vsize - usize; in mpi_cmp() 67 if (!usize) in mpi_cmp() 69 cmp = mpihelp_cmp(u->d, v->d, usize); in mpi_cmp()
|
| H A D | mpih-mul.c | 322 mpi_ptr_t up, mpi_size_t usize, in mpihelp_mul_karatsuba_case() argument 341 usize -= vsize; in mpihelp_mul_karatsuba_case() 342 if (usize >= vsize) { in mpihelp_mul_karatsuba_case() 363 usize -= vsize; in mpihelp_mul_karatsuba_case() 364 } while (usize >= vsize); in mpihelp_mul_karatsuba_case() 367 if (usize) { in mpihelp_mul_karatsuba_case() 368 if (usize < KARATSUBA_THRESHOLD) { in mpihelp_mul_karatsuba_case() 370 if (mpihelp_mul(ctx->tspace, vp, vsize, up, usize, &tmp) in mpihelp_mul_karatsuba_case() 381 up, usize, in mpihelp_mul_karatsuba_case() 387 mpihelp_add_1(prodp + vsize, ctx->tspace + vsize, usize, cy); in mpihelp_mul_karatsuba_case() [all …]
|
| H A D | mpi-mul.c | 20 mpi_size_t usize, vsize, wsize; in mpi_mul() local 30 usize = v->nlimbs; in mpi_mul() 37 usize = u->nlimbs; in mpi_mul() 48 wsize = usize + vsize; in mpi_mul() 64 up = tmp_limb = mpi_alloc_limb_space(usize); in mpi_mul() 71 MPN_COPY(up, wp, usize); in mpi_mul() 85 err = mpihelp_mul(wp, up, usize, vp, vsize, &cy); in mpi_mul()
|
| /linux/rust/kernel/pci/ |
| H A D | io.rs | 30 #[repr(usize)] 43 pub const fn into_raw(self) -> usize { in into_raw() argument 46 self as usize in into_raw() 62 const SIZE: usize; 66 const SIZE: usize = 256; 70 const SIZE: usize = 4096; 90 unsafe fn io_read(&self, address: usize) -> $ty { 104 unsafe fn io_write(&self, value: $ty, address: usize) { 125 fn addr(&self) -> usize { in addr() argument 131 fn maxsize(&self) -> usize { in maxsize() argument [all …]
|
| /linux/drivers/android/binder/range_alloc/ |
| H A D | mod.rs | 19 fn new(is_oneway: bool, debug_id: usize, pid: Pid) -> Self { in new() argument 44 debug_id: usize, 68 fn debug_id(&self) -> usize { in debug_id() argument 79 const TREE_THRESHOLD: usize = 8; 84 pub(crate) start_page_idx: usize, 85 pub(crate) end_page_idx: usize, 89 fn interior_pages(offset: usize, size: usize) -> FreedRange { in interior_pages() argument 100 offset: usize, 101 size: usize, 106 fn endpoint(&self) -> usize { in endpoint() argument [all …]
|
| H A D | array.rs | 26 size: usize, 27 free_oneway_space: usize, 34 insert_at_idx: usize, 36 insert_at_offset: usize, 40 pub(crate) fn new(size: usize, alloc: EmptyArrayAlloc<T>) -> Self { in new() argument 48 pub(crate) fn free_oneway_space(&self) -> usize { in free_oneway_space() argument 52 pub(crate) fn count_buffers(&self) -> usize { in count_buffers() argument 56 pub(crate) fn total_size(&self) -> usize { in total_size() argument 90 fn find_empty_range(&self, size: usize) -> Option<FindEmptyRes> { in find_empty_range() 117 debug_id: usize, in reserve_new() argument [all …]
|
| H A D | tree.rs | 25 tree: RBTree<usize, Descriptor<T>>, 29 size: usize, 30 free_oneway_space: usize, 35 size: usize, in from_array() argument 99 pub(crate) fn total_size(&self) -> usize { in total_size() argument 103 pub(crate) fn free_oneway_space(&self) -> usize { in free_oneway_space() argument 107 pub(crate) fn count_buffers(&self) -> usize { in count_buffers() argument 142 fn find_best_match(&mut self, size: usize) -> Option<&mut Descriptor<T>> { in find_best_match() 151 debug_id: usize, in reserve_new() argument 152 size: usize, in reserve_new() argument [all …]
|
| /linux/drivers/android/binder/ |
| H A D | allocation.rs | 29 pub(crate) offsets: Option<Range<usize>>, 53 pub(crate) offset: usize, 54 size: usize, 55 pub(crate) ptr: usize, 60 pub(crate) debug_id: usize, 66 debug_id: usize, in new() argument 67 offset: usize, in new() argument 68 size: usize, in new() argument 69 ptr: usize, in new() argument 82 fn size_check(&self, offset: usize, size: usize) -> Result { in size_check() argument [all …]
|
| H A D | page_range.rs | 178 size: usize, 180 vma_addr: usize, 298 pub(crate) fn register_with_vma(&self, vma: &virt::VmaNew) -> Result<usize> { in register_with_vma() argument 299 let num_bytes = usize::min(vma.end() - vma.start(), bindings::SZ_4M as usize); in register_with_vma() 355 pub(crate) fn use_range(&self, start: usize, end: usize) -> Result<()> { in use_range() argument 401 unsafe fn use_page_slow(&self, i: usize) -> Result<()> { in use_page_slow() 479 pub(crate) fn stop_using_range(&self, start: usize, end: usize) { in stop_using_range() argument 503 unsafe fn iterate<T>(&self, mut offset: usize, mut size: usize, mut cb: T) -> Result in iterate() argument 505 T: FnMut(&Page, usize, usize) -> Result, in iterate() 525 let available = usize::min(size, PAGE_SIZE - offset); in iterate() [all …]
|
| H A D | trace.rs | 21 unsafe fn binder_transaction_fd_send(t_debug_id: c_int, fd: c_int, offset: usize); 22 unsafe fn binder_transaction_fd_recv(t_debug_id: c_int, fd: c_int, offset: usize); 41 pub(crate) fn trace_ioctl(cmd: u32, arg: usize) { in trace_ioctl() argument 86 pub(crate) fn trace_transaction_fd_send(t_debug_id: usize, fd: u32, offset: usize) { in trace_transaction_fd_send() argument 91 pub(crate) fn trace_transaction_fd_recv(t_debug_id: usize, fd: u32, offset: usize) { in trace_transaction_fd_recv() argument
|
| /linux/rust/kernel/debugfs/ |
| H A D | traits.rs | 76 ) -> Result<usize>; in write_to_slice() 85 ) -> Result<usize> { 96 ) -> Result<usize> { 113 ) -> Result<usize> { 128 ) -> Result<usize> { 142 ) -> Result<usize> { in write_to_slice() 157 ) -> Result<usize> { 230 ) -> Result<usize>; in read_from_slice_mut() 239 ) -> Result<usize> { 250 ) -> Result<usize> { in read_from_slice_mut() 55 write_to_slice( &self, writer: &mut UserSliceWriter, offset: &mut file::Offset, ) -> Result<usize> write_to_slice() argument 64 write_to_slice( &self, writer: &mut UserSliceWriter, offset: &mut file::Offset, ) -> Result<usize> write_to_slice() argument 75 write_to_slice( &self, writer: &mut UserSliceWriter, offset: &mut file::Offset, ) -> Result<usize> write_to_slice() argument 92 write_to_slice( &self, writer: &mut UserSliceWriter, offset: &mut file::Offset, ) -> Result<usize> write_to_slice() argument 107 write_to_slice( &self, writer: &mut UserSliceWriter, offset: &mut file::Offset, ) -> Result<usize> write_to_slice() argument 121 write_to_slice( &self, writer: &mut UserSliceWriter, offset: &mut file::Offset, ) -> Result<usize> write_to_slice() argument 136 write_to_slice( &self, writer: &mut UserSliceWriter, offset: &mut file::Offset, ) -> Result<usize> write_to_slice() argument 209 read_from_slice_mut( &mut self, reader: &mut UserSliceReader, offset: &mut file::Offset, ) -> Result<usize> read_from_slice_mut() argument 218 read_from_slice_mut( &mut self, reader: &mut UserSliceReader, offset: &mut file::Offset, ) -> Result<usize> read_from_slice_mut() argument 229 read_from_slice_mut( &mut self, reader: &mut UserSliceReader, offset: &mut file::Offset, ) -> Result<usize> read_from_slice_mut() argument 244 read_from_slice_mut( &mut self, reader: &mut UserSliceReader, offset: &mut file::Offset, ) -> Result<usize> read_from_slice_mut() argument 272 read_from_slice( &self, reader: &mut UserSliceReader, offset: &mut file::Offset, ) -> Result<usize> read_from_slice() argument 281 read_from_slice( &self, reader: &mut UserSliceReader, offset: &mut file::Offset, ) -> Result<usize> read_from_slice() argument 294 read_from_slice( &self, reader: &mut UserSliceReader, offset: &mut file::Offset, ) -> Result<usize> read_from_slice() argument 305 read_from_slice( &self, reader: &mut UserSliceReader, offset: &mut file::Offset, ) -> Result<usize> read_from_slice() argument 316 read_from_slice( &self, reader: &mut UserSliceReader, offset: &mut file::Offset, ) -> Result<usize> read_from_slice() argument [all...] |
| /linux/rust/kernel/io/ |
| H A D | mem.rs | 90 pub fn iomap_sized<const SIZE: usize>(self) -> impl PinInit<Devres<IoMem<SIZE>>, Error> + 'a { 100 pub fn iomap_exclusive_sized<const SIZE: usize>( 170 pub struct ExclusiveIoMem<const SIZE: usize> { 181 impl<const SIZE: usize> ExclusiveIoMem<SIZE> { in ioremap() 216 impl<const SIZE: usize> Deref for ExclusiveIoMem<SIZE> { 233 pub struct IoMem<const SIZE: usize = 0> { in ioremap() 237 impl<const SIZE: usize> IoMem<SIZE> { in ioremap() 269 let io = MmioRaw::new(addr as usize, size)?; in new() 284 impl<const SIZE: usize> Drop for IoMem<SIZE> { in deref() 291 impl<const SIZE: usize> Dere [all...] |
| /linux/drivers/acpi/apei/ |
| H A D | erst-dbg.c | 82 size_t usize, loff_t *off) in erst_dbg_read() argument 139 if (len > usize) in erst_dbg_read() 152 size_t usize, loff_t *off) in erst_dbg_write() argument 160 if (usize > ERST_DBG_RECORD_LEN_MAX) { in erst_dbg_write() 167 if (usize > erst_dbg_buf_len) { in erst_dbg_write() 170 p = kmalloc(usize, GFP_KERNEL); in erst_dbg_write() 175 erst_dbg_buf_len = usize; in erst_dbg_write() 177 if (copy_from_user(erst_dbg_buf, ubuf, usize)) { in erst_dbg_write() 183 if (rcd->record_length != usize) in erst_dbg_write() 190 return rc < 0 ? rc : usize; in erst_dbg_write()
|
| /linux/rust/kernel/sync/atomic/ |
| H A D | predefine.rs | 79 // as `isize` and `usize`, and `isize` and `usize` are always bi-directional transmutable to 102 static_assert!(size_of::<usize>() == size_of::<isize_atomic_repr>()); implementation 103 static_assert!(align_of::<usize>() == align_of::<isize_atomic_repr>()); 111 // SAFETY: The wrapping add result of two `isize_atomic_repr`s is a valid `usize`. 144 // SAFETY: `usize` has the same size and alignment with `isize_atomic_repr`, and is round-trip in atomic_xchg_tests() 146 unsafe impl super::AtomicType for usize { in atomic_xchg_tests() 150 // SAFETY: The wrapping add result of two `isize_atomic_repr`s is a valid `usize`. in atomic_xchg_tests() 151 unsafe impl super::AtomicAdd<usize> for usize { 107 unsafe impl super::AtomicAdd<usize> for usize { global() implementation [all...] |
| /linux/drivers/gpu/nova-core/ |
| H A D | gsp.rs | 40 pub(crate) const GSP_PAGE_SHIFT: usize = 12; 41 pub(crate) const GSP_PAGE_SIZE: usize = 1 << GSP_PAGE_SHIFT; 44 const RM_LOG_BUFFER_NUM_PAGES: usize = 0x10; 45 const LOG_BUFFER_SIZE: usize = RM_LOG_BUFFER_NUM_PAGES * GSP_PAGE_SIZE; 49 struct PteArray<const NUM_ENTRIES: usize>([u64; NUM_ENTRIES]); 52 unsafe impl<const NUM_ENTRIES: usize> FromBytes for PteArray<NUM_ENTRIES> {} 55 unsafe impl<const NUM_ENTRIES: usize> AsBytes for PteArray<NUM_ENTRIES> {} 57 impl<const NUM_PAGES: usize> PteArray<NUM_PAGES> { 60 fn entry(start: DmaAddress, index: usize) -> Result<u64> { in entry()
|
| /linux/rust/kernel/alloc/ |
| H A D | kvec.rs | 114 len: usize, 184 pub const fn capacity(&self) -> usize { in capacity() argument 186 usize::MAX in capacity() 194 pub const fn len(&self) -> usize { in len() argument 205 pub const unsafe fn inc_len(&mut self, additional: usize) { in inc_len() argument 221 unsafe fn dec_len(&mut self, count: usize) -> &mut [T] { in dec_len() 400 index: usize, in insert_within_capacity() argument 468 pub fn remove(&mut self, i: usize) -> Result<T, RemoveError> { in remove() 504 pub fn with_capacity(capacity: usize, flags: Flags) -> Result<Self, AllocError> { in with_capacity() argument 553 pub unsafe fn from_raw_parts(ptr: *mut T, length: usize, capacity: usize) -> Self { in from_raw_parts() argument [all …]
|