| /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 | 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, 248 new(nbits: usize, flags: Flags) -> Result<Self, AllocError> new() argument 272 len(&self) -> usize len() argument 306 set_bit(&mut self, index: usize) set_bit() argument 332 set_bit_atomic(&self, index: usize) set_bit_atomic() argument 357 clear_bit(&mut self, index: usize) clear_bit() argument 383 clear_bit_atomic(&self, index: usize) clear_bit_atomic() argument 450 last_bit(&self) -> Option<usize> last_bit() argument 464 next_bit(&self, start: usize) -> Option<usize> next_bit() argument 484 next_zero_bit(&self, start: usize) -> Option<usize> next_zero_bit() argument [all...] |
| H A D | device_id.rs | 45 /// This field must be correctly sized to hold a `usize`. 51 const DRIVER_DATA_OFFSET: usize; 91 pub struct IdArray<T: RawDeviceId, U: 'static, const N: usize> { 101 unsafe impl<T: RawDeviceId, U: Sync + 'static, const N: usize> Send for IdArray<T, U, N> {} 105 unsafe impl<T: RawDeviceId, U: Sync + 'static, const N: usize> Sync for IdArray<T, U, N> {} 107 impl<T: RawDeviceId + RawDeviceIdIndex, U: 'static, const N: usize> IdArray<T, U, N> { 114 let mut i = 0usize; 142 impl<T: RawDeviceId, const N: usize> IdArray<T, (), N> { in raw_ids() 171 impl<T: RawDeviceId, U, const N: usize> IdTable<T, U> for IdArray<T, U, N> { 52 index(&self) -> usize index() argument 64 size(&self) -> usize size() argument
|
| 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() 96 /// Returns this alignment as a [`usize`]. 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 const MIN_SIZE: usize; in size() argument 245 fn size(p: *const Self) -> usize; in size() 244 size(_: *const Self) -> usize size() argument 251 size(p: *const Self) -> usize size() argument 278 const_align_up(value: usize, align: Alignment) -> Option<usize> const_align_up() 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 | io.rs | 55 pub struct Region<const SIZE: usize = 0> { 59 impl<const SIZE: usize> Region<SIZE> { 68 pub fn ptr_from_raw_parts_mut(base: *mut u8, size: usize) -> *mut Self { in ptr_from_raw_parts_mut() 77 pub fn ptr_try_from_raw_parts_mut(base: *mut u8, size: usize) -> Result<*mut Self> { in ptr_try_from_raw_parts_mut() 86 impl<const SIZE: usize> KnownSize for Region<SIZE> { 87 const MIN_SIZE: usize = SIZE; 92 fn size(p: *const Self) -> usize { in size() argument 104 unsafe impl<const SIZE: usize> IntoBytes for Region<SIZE> { 143 pub fn new(addr: usize) -> Self { in new() 150 impl<const SIZE: usize> MmioRaw<Region<SIZE>> { [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 | 32 #[repr(usize)] 45 pub const fn into_raw(self) -> usize { in into_raw() 47 // within `usize` without truncation or sign change. in into_raw() 48 self as usize 170 pub struct Bar<'a, const SIZE: usize = 0> { in new() 176 impl<const SIZE: usize> ForLt for Bar<'static, SIZE> { in new() 182 unsafe impl<const SIZE: usize> CovariantForLt for Bar<'static, SIZE> {} in new() 187 pub type DevresBar<const SIZE: usize = 0> = DevresLt<Bar<'static, SIZE>>; in new() 189 impl<'a, const SIZE: usize> Bar<'a, SIZE> { in new() 216 let ioptr: usize in do_release() 43 into_raw(self) -> usize into_raw() argument 125 addr(&self) -> usize addr() argument 131 maxsize(&self) -> usize maxsize() argument 209 do_release(pdev: &Device, ioptr: usize, num: i32) do_release() 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/gpu/drm/ |
| H A D | drm_panic_qr.rs | 33 struct Version(usize); 119 const MAX_EC_SIZE: usize = 30; 120 const MAX_BLK_SIZE: usize = 123; 221 fn max_data(&self) -> usize { in max_data() argument 225 fn ec_size(&self) -> usize { in ec_size() argument 229 fn g1_blocks(&self) -> usize { in g1_blocks() argument 230 VPARAM[self.0 - 1].1 as usize in g1_blocks() 233 fn g2_blocks(&self) -> usize { in g2_blocks() argument 234 VPARAM[self.0 - 1].2 as usize in g2_blocks() 237 fn g1_blk_size(&self) -> usize { in g1_blk_size() argument [all …]
|
| /linux/rust/zerocopy/src/util/ |
| H A D | mod.rs | 71 pub(crate) fn miri_promise_symbolic_alignment(ptr: *const (), align: usize); in miri_promise_symbolic_alignment() argument 75 fn addr(self) -> usize; in addr() argument 80 fn addr(self) -> usize { in addr() argument 88 fn addr(self) -> usize { in addr() argument 96 fn addr(self) -> usize { in addr() argument 103 fn addr(self) -> usize { in addr() argument 113 return self.cast::<()>() as usize; in addr() 119 fn addr(self) -> usize { in addr() argument 155 pub(crate) const fn padding_needed_for(len: usize, align: NonZeroUsize) -> usize { in padding_needed_for() argument 237 n: usize, in round_down_to_next_multiple_of_alignment() argument [all …]
|
| /linux/rust/kernel/debugfs/ |
| H A D | traits.rs | 74 ) -> Result<usize>; in write_to_slice() 83 ) -> Result<usize> { 94 ) -> Result<usize> { in write_to_slice() 111 ) -> Result<usize> { 126 ) -> Result<usize> { 140 ) -> Result<usize> { in write_to_slice() 155 ) -> Result<usize> { 221 ) -> Result<usize>; 230 ) -> Result<usize> { in read_from_slice_mut() 241 ) -> 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 | 92 pub fn iomap_sized<const SIZE: usize>(self) -> Result<IoMem<'a, SIZE>> { 102 pub fn iomap_exclusive_sized<const SIZE: usize>(self) -> Result<ExclusiveIoMem<'a, SIZE>> { 168 pub struct ExclusiveIoMem<'a, const SIZE: usize> { 179 impl<const SIZE: usize> ForLt for ExclusiveIoMem<'static, SIZE> { in ioremap() 185 unsafe impl<const SIZE: usize> CovariantForLt for ExclusiveIoMem<'static, SIZE> {} in ioremap() 190 pub type DevresExclusiveIoMem<const SIZE: usize> = DevresLt<ExclusiveIoMem<'static, SIZE>>; in ioremap() 192 impl<'a, const SIZE: usize> ExclusiveIoMem<'a, SIZE> { in ioremap() 228 impl<'a, const SIZE: usize> IoBase<'a> for &'a ExclusiveIoMem<'_, SIZE> { in ioremap() 247 pub struct IoMem<'a, const SIZE: usize = 0> { in ioremap() 252 impl<const SIZE: usize> ForL in ioremap() [all...] |
| /linux/drivers/android/binder/ |
| H A D | stats.rs | 11 const BC_COUNT: usize = _IOC_NR(BC_FREEZE_NOTIFICATION_DONE) as usize + 1; 12 const BR_COUNT: usize = _IOC_NR(BR_CLEAR_FREEZE_NOTIFICATION_DONE) as usize + 1; 33 let idx = _IOC_NR(bc) as usize; in inc_bc() 40 let idx = _IOC_NR(br) as usize; in inc_br() 71 pub(super) fn command_string(i: usize) -> &'static str { in command_string() 80 pub(super) fn return_string(i: usize) -> &'static str { in return_string()
|
| /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 | 77 // as `isize` and `usize`, and `isize` and `usize` are always bi-directional transmutable to 100 static_assert!(size_of::<usize>() == size_of::<isize_atomic_repr>()); 101 static_assert!(align_of::<usize>() == align_of::<isize_atomic_repr>()); 109 // SAFETY: The wrapping add result of two `isize_atomic_repr`s is a valid `usize`. in rhs_into_delta() 142 // SAFETY: `usize` has the same size and alignment with `isize_atomic_repr`, and is round-trip in atomic_xchg_tests() 144 unsafe impl super::AtomicType for usize { in atomic_xchg_tests() 148 // SAFETY: The wrapping add result of two `isize_atomic_repr`s is a valid `usize`. in atomic_xchg_tests() 149 unsafe impl super::AtomicAdd<usize> for usize { in atomic_xchg_tests() 102 unsafe impl super::AtomicType for usize { global() implementation 107 unsafe impl super::AtomicAdd<usize> for usize { global() implementation [all...] |
| /linux/rust/zerocopy/src/pointer/ |
| H A D | inner.rs | 279 T: ?Sized + KnownLayout<PointerMetadata = usize>, 393 pub unsafe fn slice_unchecked(self, range: Range<usize>) -> Self { in slice_unchecked() 505 impl<'a, T, const N: usize> PtrInner<'a, [T; N]> { 650 fn test_split_at<const OFFSET: usize, const BUFFER_SIZE: usize>() { in test_split_at() argument 653 struct SliceDst<const OFFSET: usize> { in test_split_at() 658 let n: usize = BUFFER_SIZE - OFFSET; in test_split_at() 671 let l_sum: usize = l in test_split_at() 676 |ptr| unsafe { core::ptr::read_unaligned(ptr.as_ptr()) } as usize, in test_split_at() 682 let r_sum: usize = r in test_split_at() 686 |ptr| unsafe { core::ptr::read_unaligned(ptr.as_ptr()) } as usize, in test_split_at() [all …]
|
| /linux/rust/kernel/alloc/ |
| H A D | kvec.rs | 140 len: usize, 210 pub const fn capacity(&self) -> usize { in inc_len() 212 usize::MAX 220 pub const fn len(&self) -> usize { 231 pub const unsafe fn inc_len(&mut self, additional: usize) { 247 unsafe fn dec_len(&mut self, count: usize) -> &mut [T] { 426 index: usize, 494 pub fn remove(&mut self, i: usize) -> Result<T, RemoveError> { 530 pub fn with_capacity(capacity: usize, flags: Flags) -> Result<Self, AllocError> { 548 pub fn zeroed(n: usize, flag 184 capacity(&self) -> usize capacity() argument 194 len(&self) -> usize len() argument 205 inc_len(&mut self, additional: usize) inc_len() argument 400 insert_within_capacity( &mut self, index: usize, element: T, ) -> Result<(), InsertError<T>> insert_within_capacity() argument 504 with_capacity(capacity: usize, flags: Flags) -> Result<Self, AllocError> with_capacity() argument 553 from_raw_parts(ptr: *mut T, length: usize, capacity: usize) -> Self from_raw_parts() argument 579 into_raw_parts(self) -> (*mut T, usize, usize) into_raw_parts() argument 625 reserve(&mut self, additional: usize, flags: Flags) -> Result<(), AllocError> reserve() argument 681 truncate(&mut self, len: usize) truncate() argument 766 shrink_to(&mut self, min_capacity: usize, flags: Flags) -> Result<(), AllocError> shrink_to() argument 852 extend_with(&mut self, n: usize, value: T, flags: Flags) -> Result<(), AllocError> extend_with() argument 907 from_elem(value: T, n: usize, flags: Flags) -> Result<Self, AllocError> from_elem() argument 932 resize(&mut self, new_len: usize, value: T, flags: Flags) -> Result<(), AllocError> resize() argument 1208 into_raw_parts(self) -> (*mut T, NonNull<T>, usize, usize) into_raw_parts() argument 1360 size_hint(&self) -> (usize, Option<usize>) size_hint() argument 1450 size_hint(&self) -> (usize, Option<usize>) size_hint() argument [all...] |