/linux/rust/kernel/ |
H A D | sizes.rs | 8 pub const SZ_1K: usize = bindings::SZ_1K as usize; 10 pub const SZ_2K: usize = bindings::SZ_2K as usize; 12 pub const SZ_4K: usize = bindings::SZ_4K as usize; 14 pub const SZ_8K: usize = bindings::SZ_8K as usize; 16 pub const SZ_16K: usize = bindings::SZ_16K as usize; [all...] |
H A D | io.rs | 23 pub struct IoRaw<const SIZE: usize = 0> { 24 addr: usize, 25 maxsize: usize, 28 impl<const SIZE: usize> IoRaw<SIZE> { 30 pub fn new(addr: usize, maxsize: usize) -> Result<Self> { in new() argument 40 pub fn addr(&self) -> usize { in addr() argument 46 pub fn maxsize(&self) -> usize { in maxsize() argument 68 /// struct IoMem<const SIZE: usize>(IoRaw<SIZE>); 70 /// impl<const SIZE: usize> IoMe 188 addr(&self) -> usize addr() argument 194 maxsize(&self) -> usize maxsize() argument 199 offset_valid<U>(offset: usize, size: usize) -> bool offset_valid() argument 209 io_addr<U>(&self, offset: usize) -> Result<usize> io_addr() argument 220 io_addr_assert<U>(&self, offset: usize) -> usize io_addr_assert() argument [all...] |
H A D | page.rs | 15 pub const PAGE_SHIFT: usize = bindings::PAGE_SHIFT as usize; 18 pub const PAGE_SIZE: usize = bindings::PAGE_SIZE; 21 pub const PAGE_MASK: usize = !(PAGE_SIZE - 1); 26 /// [`usize`]. 27 pub const fn page_align(addr: usize) -> usize { in page_align() argument 147 off: usize, in with_pointer_into_page() argument 148 len: usize, in with_pointer_into_page() argument 174 pub unsafe fn read_raw(&self, dst: *mut u8, offset: usize, le argument 196 write_raw(&self, src: *const u8, offset: usize, len: usize) -> Result write_raw() argument 216 fill_zero_raw(&self, offset: usize, len: usize) -> Result fill_zero_raw() argument 242 copy_from_user_slice_raw( &self, reader: &mut UserSliceReader, offset: usize, len: usize, ) -> Result copy_from_user_slice_raw() argument 243 copy_from_user_slice_raw( &self, reader: &mut UserSliceReader, offset: usize, len: usize, ) -> Result copy_from_user_slice_raw() argument [all...] |
H A D | device_id.rs | 42 /// This field must be correctly sized to hold a `usize`. 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> { 87 /// - The field at `data_offset` must be correctly sized to hold a `usize`. 88 const unsafe fn build(ids: [(T, U); N], data_offset: Option<usize>) [all...] |
H A D | str.rs | 18 pub const fn len(&self) -> usize { in len() argument 214 pub const fn len(&self) -> usize { in len() argument 220 pub const fn len_with_nul(&self) -> usize { in len_with_nul() argument 536 impl Index<ops::RangeFrom<usize>> for CStr { 540 fn index(&self, index: ops::RangeFrom<usize>) -> &Self::Output { in index() 564 impl CStrIndex for usize {} implementation 565 impl CStrIndex for ops::Range<usize> {} 566 impl CStrIndex for ops::RangeInclusive<usize> {} 567 impl CStrIndex for ops::RangeToInclusive<usize> {} 675 bytes[i as usize] in test_cstr_display_all_bytes() 793 bytes_written(&self) -> usize bytes_written() argument [all...] |
H A D | dma.rs | 263 /// - `size_of::<T> * count` fits into a `usize`. 279 count: usize, 300 count: usize, in alloc_attrs() argument 331 // - The allocated `size` fits into a `usize`. in alloc_attrs() 345 count: usize, in alloc_coherent() argument 355 pub fn count(&self) -> usize { in count() argument 360 pub fn size(&self) -> usize { in size() argument 362 // a `usize`. in size() 387 pub fn dma_handle_with_offset(&self, offset: usize) -> Result<bindings::dma_addr_t> { in dma_handle_with_offset() 392 // into a `usize`, an in dma_handle_with_offset() 399 validate_range(&self, offset: usize, count: usize) -> Result validate_range() argument 419 as_slice(&self, offset: usize, count: usize) -> Result<&[T]> as_slice() argument 439 as_slice_mut(&mut self, offset: usize, count: usize) -> Result<&mut [T]> as_slice_mut() argument [all...] |
H A D | uaccess.rs | 27 pub fn from_addr(addr: usize) -> Self { in from_addr() 58 pub fn wrapping_byte_add(self, add: usize) -> UserPtr { in wrapping_byte_add() 94 /// fn bytes_add_one(uptr: UserPtr, len: usize) -> Result { 116 /// fn is_valid(uptr: UserPtr, len: usize) -> Result<bool> { 126 /// fn get_bytes_if_valid(uptr: UserPtr, len: usize) -> Result<KVec<u8>> { 148 length: usize, 164 pub fn new(ptr: UserPtr, length: usize) -> Self { in new() 213 length: usize, 220 pub fn skip(&mut self, num_skip: usize) -> Result { in skip() 243 pub fn len(&self) -> usize { in len() argument 410 len(&self) -> usize len() argument 485 raw_strncpy_from_user(dst: &mut [MaybeUninit<u8>], src: UserPtr) -> Result<usize> raw_strncpy_from_user() argument [all...] |
H A D | transmute.rs | 26 u8, u16, u32, u64, usize, 32 {<T: FromBytes, const N: usize>} [T; N], 61 u8, u16, u32, u64, usize, 70 {<T: AsBytes, const N: usize>} [T; N],
|
H A D | pci.rs | 170 const DRIVER_DATA_OFFSET: usize = core::mem::offset_of!(bindings::pci_device_id, driver_data); 172 fn index(&self) -> usize { in index() argument 284 pub struct Bar<const SIZE: usize = 0> { 290 impl<const SIZE: usize> Bar<SIZE> { 313 let ioptr: usize = unsafe { bindings::pci_iomap(pdev.as_raw(), num, 0) } as usize; in new() 322 let io = match IoRaw::new(ioptr, len as usize) { in new() 344 unsafe fn do_release(pdev: &Device, ioptr: usize, num: i32) { in do_release() argument 368 impl<const SIZE: usize> Drop for Bar<SIZE> { 374 impl<const SIZE: usize> Dere [all...] |
/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, c in mpihelp_mul_karatsuba_case() 427 mpihelp_mul(mpi_ptr_t prodp,mpi_ptr_t up,mpi_size_t usize,mpi_ptr_t vp,mpi_size_t vsize,mpi_limb_t * _result) mpihelp_mul() argument [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/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 311 get_header(&self) -> (u16, usize) get_header() argument 319 length_bits_count(&self, version: Version) -> usize length_bits_count() argument 335 character_count(&self) -> usize character_count() argument 346 get_length_field(&self, version: Version) -> (u16, usize) get_length_field() argument 353 total_size_bits(&self, version: Version) -> usize total_size_bits() argument 385 push(&mut self, data: u64, len: usize) push() argument 398 pop3(&mut self) -> Option<(u16, usize)> pop3() argument 493 push(&mut self, offset: &mut usize, bits: (u16, usize)) push() argument 541 error_code_for_blocks(&mut self, offset: usize, size: usize, ec_offset: usize) error_code_for_blocks() argument 924 drm_panic_qr_generate( url: *const kernel::ffi::c_char, data: *mut u8, data_len: usize, data_size: usize, tmp: *mut u8, tmp_size: usize, ) -> u8 drm_panic_qr_generate() argument 925 drm_panic_qr_generate( url: *const kernel::ffi::c_char, data: *mut u8, data_len: usize, data_size: usize, tmp: *mut u8, tmp_size: usize, ) -> u8 drm_panic_qr_generate() argument 927 drm_panic_qr_generate( url: *const kernel::ffi::c_char, data: *mut u8, data_len: usize, data_size: usize, tmp: *mut u8, tmp_size: usize, ) -> u8 drm_panic_qr_generate() argument 977 drm_panic_qr_max_data_size(version: u8, url_len: usize) -> usize drm_panic_qr_max_data_size() argument [all...] |
/linux/drivers/gpu/nova-core/ |
H A D | vbios.rs | 15 const ROM_OFFSET: usize = 0x300000; 17 const BIOS_MAX_SCAN_LEN: usize = 0x100000; 19 const BIOS_READ_AHEAD_SIZE: usize = 1024; 43 current_offset: usize, 60 fn read_more(&mut self, len: usize) -> Result { in read_more() 90 fn read_more_at_offset(&mut self, offset: usize, len: usize) -> Result { in read_more_at_offset() argument 110 offset: usize, in read_bios_image_at_offset() argument 111 len: usize, in read_bios_image_at_offset() argument 337 fn image_size_bytes(&self) -> usize { in image_size_bytes() argument 581 image_size_bytes(&self) -> usize image_size_bytes() argument 658 image_size_bytes(&self) -> usize image_size_bytes() argument 826 find_byte_pattern(haystack: &[u8], needle: &[u8]) -> Result<usize> find_byte_pattern() argument 834 find_bit_header(data: &[u8]) -> Result<(BitHeader, usize)> find_bit_header() argument [all...] |
/linux/rust/kernel/alloc/ |
H A D | kvec.rs | 108 len: usize, 178 pub fn capacity(&self) -> usize { in capacity() argument 180 usize::MAX in capacity() 188 pub fn len(&self) -> usize { in len() argument 199 pub unsafe fn inc_len(&mut self, additional: usize) { in inc_len() argument 215 unsafe fn dec_len(&mut self, count: usize) -> &mut [T] { in dec_len() 384 index: usize, in insert_within_capacity() argument 452 pub fn remove(&mut self, i: usize) -> Result<T, RemoveError> { in remove() 488 pub fn with_capacity(capacity: usize, flags: Flags) -> Result<Self, AllocError> { in with_capacity() argument 537 pub unsafe fn from_raw_parts(ptr: *mut T, length: usize, capacit argument 563 into_raw_parts(self) -> (*mut T, usize, usize) into_raw_parts() argument 609 reserve(&mut self, additional: usize, flags: Flags) -> Result<(), AllocError> reserve() argument 664 truncate(&mut self, len: usize) truncate() argument 726 extend_with(&mut self, n: usize, value: T, flags: Flags) -> Result<(), AllocError> extend_with() argument 781 from_elem(value: T, n: usize, flags: Flags) -> Result<Self, AllocError> from_elem() argument 806 resize(&mut self, new_len: usize, value: T, flags: Flags) -> Result<(), AllocError> resize() argument 1045 into_raw_parts(self) -> (*mut T, NonNull<T>, usize, usize) into_raw_parts() argument 1191 size_hint(&self) -> (usize, Option<usize>) size_hint() argument 1281 size_hint(&self) -> (usize, Option<usize>) size_hint() argument [all...] |
H A D | layout.rs | 18 len: usize, 29 const ISIZE_MAX: usize = isize::MAX as usize; 55 /// let layout = ArrayLayout::<i32>::new(isize::MAX as usize); 60 /// let layout = ArrayLayout::<i32>::new(isize::MAX as usize / 2); 65 pub const fn new(len: usize) -> Result<Self, LayoutError> { in new() 83 pub unsafe fn new_unchecked(len: usize) -> Self { in new_unchecked() 93 pub const fn len(&self) -> usize { in len() argument
|
/linux/rust/kernel/io/ |
H A D | mem.rs | 77 pub fn iomap_sized<const SIZE: usize>(self) -> impl PinInit<Devres<IoMem<SIZE>>, Error> + 'a { in iomap_sized() 87 pub fn iomap_exclusive_sized<const SIZE: usize>( in iomap_exclusive_sized() 151 pub struct ExclusiveIoMem<const SIZE: usize> { 162 impl<const SIZE: usize> ExclusiveIoMem<SIZE> { 197 impl<const SIZE: usize> Deref for ExclusiveIoMem<SIZE> { 214 pub struct IoMem<const SIZE: usize = 0> { 218 impl<const SIZE: usize> IoMem<SIZE> { 250 let io = IoRaw::new(addr as usize, size)?; in ioremap() 265 impl<const SIZE: usize> Drop for IoMem<SIZE> { 272 impl<const SIZE: usize> Dere [all...] |
/linux/drivers/gpu/nova-core/regs/ |
H A D | macros.rs | 147 pub(crate) const OFFSET: usize = $offset; 323 pub(crate) fn read<const SIZE: usize, T>(io: &T) -> Self where 330 pub(crate) fn write<const SIZE: usize, T>(self, io: &T) where 337 pub(crate) fn alter<const SIZE: usize, T, F>( 355 pub(crate) fn read<const SIZE: usize, T>( 357 base: usize, 365 pub(crate) fn write<const SIZE: usize, T>( 368 base: usize, 376 pub(crate) fn alter<const SIZE: usize, T, F>( 378 base: usize, [all...] |
/linux/lib/tests/ |
H A D | usercopy_kunit.c | 113 size_t ksize, usize; in usercopy_test_copy_struct_from_user() local 126 /* Check basic case -- (usize == ksize). */ in usercopy_test_copy_struct_from_user() 128 usize = size; in usercopy_test_copy_struct_from_user() 133 KUNIT_EXPECT_EQ_MSG(test, copy_struct_from_user(kmem, ksize, umem, usize), 0, in usercopy_test_copy_struct_from_user() 134 "copy_struct_from_user(usize == ksize) failed"); in usercopy_test_copy_struct_from_user() 136 "copy_struct_from_user(usize == ksize) gives unexpected copy"); in usercopy_test_copy_struct_from_user() 138 /* Old userspace case -- (usize < ksize). */ in usercopy_test_copy_struct_from_user() 140 usize = size / 2; in usercopy_test_copy_struct_from_user() 142 memcpy(expected, umem_src, usize); in usercopy_test_copy_struct_from_user() 143 memset(expected + usize, in usercopy_test_copy_struct_from_user() [all...] |
/linux/drivers/gpu/nova-core/firmware/ |
H A D | fwsec.rs | 122 const BCRT30_RSA3K_SIG_SIZE: usize = 384; 158 offset: usize, in transmute() argument 163 if (fw.start_ptr() as usize + offset) % align_of::<T>() != 0 { in transmute() 181 offset: usize, in transmute_mut() argument 186 if (fw.start_ptr_mut() as usize + offset) % align_of::<T>() != 0 { in transmute_mut() 260 let hdr_offset = (desc.imem_load_size + desc.interface_offset) as usize; in new_fwsec() 269 for i in 0..hdr.entry_count as usize { in new_fwsec() 275 hdr_offset + hdr.header_size as usize + i * hdr.entry_size as usize in new_fwsec() 287 (desc.imem_load_size + app.dmem_base) as usize, in new_fwsec() [all...] |
/linux/tools/testing/selftests/bpf/progs/ |
H A D | test_get_stack_rawtp.c | 33 * usize = bpf_get_stack(ctx, raw_data, max_len, BPF_F_USER_STACK); 34 * if (usize < 0) 36 * ksize = bpf_get_stack(ctx, raw_data + usize, max_len - usize, 0); 39 * verifier will complain that access "raw_data + usize" 40 * with size "max_len - usize" may be out of bound. 41 * The maximum "raw_data + usize" is "raw_data + max_len" 42 * and the maximum "max_len - usize" is "max_len", verifier 62 long usize, ksize; in bpf_prog1() local 87 usize in bpf_prog1() [all...] |
/linux/arch/x86/kernel/cpu/mce/ |
H A D | dev-mcelog.c | 162 static int __mce_read_apei(char __user **ubuf, size_t usize) in __mce_read_apei() argument 168 if (usize < sizeof(struct mce)) in __mce_read_apei() 203 size_t usize, loff_t *off) in mce_chrdev_read() argument 212 err = __mce_read_apei(&buf, usize); in mce_chrdev_read() 219 if (*off != 0 || usize < mcelog->len * sizeof(struct mce)) in mce_chrdev_read() 287 size_t usize, loff_t *off) in mce_chrdev_write() argument 300 if ((unsigned long)usize > sizeof(struct mce)) in mce_chrdev_write() 301 usize = sizeof(struct mce); in mce_chrdev_write() 302 if (copy_from_user(&m, ubuf, usize)) in mce_chrdev_write() 316 return usize; in mce_chrdev_write() [all...] |
/linux/samples/rust/ |
H A D | rust_driver_pci.rs | 12 const TEST: usize = 0x0; 13 const OFFSET: usize = 0x4; 14 const DATA: usize = 0x8; 15 const COUNT: usize = 0xC; 16 const END: usize = 0x10; 51 let offset = u32::from_le(bar.read32(Regs::OFFSET)) as usize; in testdev()
|
/linux/rust/kernel/device/ |
H A D | property.rs | 113 pub fn property_match_string(&self, name: &CStr, match_str: &CStr) -> Result<usize> { in property_match_string() argument 125 Ok(ret as usize) in property_match_string() 132 len: usize, in property_read_array_vec() argument 157 pub fn property_count_elem<T: PropertyInt>(&self, name: &CStr) -> Result<usize> { in property_count_elem() argument 340 unsafe { core::slice::from_raw_parts(self.0.args.as_ptr(), self.0.nargs as usize) } in as_slice() 344 pub fn len(&self) -> usize { in len() argument 345 self.0.nargs as usize in len() 483 fn read_array_len_from_fwnode_property(fwnode: &FwNode, name: &CStr) -> Result<usize>; in read_array_len_from_fwnode_property() argument 493 impl<const N: usize> Sealed for [$int; N] {} 524 fn read_array_len_from_fwnode_property(fwnode: &FwNode, name: &CStr) -> Result<usize> { [all...] |