/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; 18 pub const SZ_32K: usize = bindings::SZ_32K as usize; 20 pub const SZ_64K: usize = bindings::SZ_64K as usize; 22 pub const SZ_128K: usize = bindings::SZ_128K as usize; 24 pub const SZ_256K: usize = bindings::SZ_256K as usize; 26 pub const SZ_512K: usize = bindings::SZ_512K 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 113 pub struct Io<const SIZE: usize = 0>(IoRaw<SIZE>); 123 pub fn $name(&self, offset: usize) -> $type_name { 135 pub fn $try_name(&self, offset: usize) -> Result<$type_name> { [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); 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, len: usize) -> Result { in read_raw() argument 196 pub unsafe fn write_raw(&self, src: *const u8, offset: usize, len: usize) -> Result { in write_raw() argument 216 pub unsafe fn fill_zero_raw(&self, offset: usize, len: usize) -> Result { in fill_zero_raw() argument 242 offset: usize, in copy_from_user_slice_raw() argument [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 | 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] = i.wrapping_add(1); in test_cstr_display_all_bytes() [all …]
|
H A D | dma.rs | 279 count: usize, 300 count: usize, in alloc_attrs() argument 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 387 pub fn dma_handle_with_offset(&self, offset: usize) -> Result<bindings::dma_addr_t> { in dma_handle_with_offset() 399 fn validate_range(&self, offset: usize, count: usize) -> Result { in validate_range() argument 419 pub unsafe fn as_slice(&self, offset: usize, count: usize) -> Result<&[T]> { in as_slice() argument 439 pub unsafe fn as_slice_mut(&mut self, offset: usize, count: usize) -> Result<&mut [T]> { in as_slice_mut() argument 471 pub unsafe fn write(&mut self, src: &[T], offset: usize) -> Result { in write() [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() 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 403 length: usize, 410 pub fn len(&self) -> usize { in len() argument 485 fn raw_strncpy_from_user(dst: &mut [MaybeUninit<u8>], src: UserPtr) -> Result<usize> { in raw_strncpy_from_user() argument [all …]
|
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> Deref for Bar<SIZE> { 418 pub fn iomap_region_sized<'a, const SIZE: usize>( in iomap_region_sized()
|
H A D | xarray.rs | 110 bindings::xa_find(self.xa.get(), &mut index, usize::MAX, bindings::XA_PRESENT) in iter() 115 bindings::xa_find_after(self.xa.get(), &mut index, usize::MAX, bindings::XA_PRESENT) in iter() 181 fn load<F, U>(&self, index: usize, f: F) -> Option<U> in load() argument 192 pub fn get(&self, index: usize) -> Option<T::Borrowed<'_>> { in get() 200 pub fn get_mut(&mut self, index: usize) -> Option<T::BorrowedMut<'_>> { in get_mut() 208 pub fn remove(&mut self, index: usize) -> Option<T> { in remove() 229 index: usize, in store() 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/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/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 338 self.image_len as usize * 512 in image_size_bytes() [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, capacity: usize) -> Self { in from_raw_parts() argument [all …]
|
/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> Deref for IoMem<SIZE> {
|
/linux/drivers/acpi/apei/ |
H A D | erst-dbg.c | 83 size_t usize, loff_t *off) in erst_dbg_read() argument 140 if (len > usize) in erst_dbg_read() 153 size_t usize, loff_t *off) in erst_dbg_write() argument 161 if (usize > ERST_DBG_RECORD_LEN_MAX) { in erst_dbg_write() 168 if (usize > erst_dbg_buf_len) { in erst_dbg_write() 171 p = kmalloc(usize, GFP_KERNEL); in erst_dbg_write() 176 erst_dbg_buf_len = usize; in erst_dbg_write() 178 rc = copy_from_user(erst_dbg_buf, ubuf, usize); in erst_dbg_write() 185 if (rcd->record_length != usize) in erst_dbg_write() 192 return rc < 0 ? rc : usize; in erst_dbg_write()
|
/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/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() 295 (desc.imem_load_size + dmem_mapper.cmd_in_buffer_offset) as usize, in new_fwsec() [all …]
|
/linux/tools/testing/selftests/bpf/progs/ |
H A D | test_get_stack_rawtp.c | 62 long usize, ksize; in bpf_prog1() local 87 usize = bpf_get_stack(ctx, raw_data, max_len, BPF_F_USER_STACK); in bpf_prog1() 88 if (usize < 0) in bpf_prog1() 91 ksize = bpf_get_stack(ctx, raw_data + usize, max_len - usize, 0); in bpf_prog1() 95 total_size = usize + ksize; in bpf_prog1()
|
/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()
|
/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 …]
|
/linux/include/linux/ |
H A D | uaccess.h | 385 size_t usize) in copy_struct_from_user() argument 387 size_t size = min(ksize, usize); in copy_struct_from_user() 388 size_t rest = max(ksize, usize) - size; in copy_struct_from_user() 395 if (usize < ksize) { in copy_struct_from_user() 397 } else if (usize > ksize) { in copy_struct_from_user() 481 copy_struct_to_user(void __user *dst, size_t usize, const void *src, in copy_struct_to_user() argument 484 size_t size = min(ksize, usize); in copy_struct_to_user() 485 size_t rest = max(ksize, usize) - size; in copy_struct_to_user() 492 if (usize > ksize) { in copy_struct_to_user() 497 *ignored_trailing = ksize < usize && in copy_struct_to_user()
|