Lines Matching full:layout

5 use core::alloc::{GlobalAlloc, Layout};
18 unsafe fn krealloc_aligned(ptr: *mut u8, new_layout: Layout, flags: bindings::gfp_t) -> *mut u8 { in krealloc_aligned() argument
19 // Customized layouts from `Layout::from_size_align()` can have size < align, so pad first. in krealloc_aligned()
20 let layout = new_layout.pad_to_align(); in krealloc_aligned() localVariable
22 let mut size = layout.size(); in krealloc_aligned()
24 if layout.align() > bindings::BINDINGS_ARCH_SLAB_MINALIGN { in krealloc_aligned()
29 // Note that `layout.size()` (after padding) is guaranteed to be a multiple of in krealloc_aligned()
30 // `layout.align()`, so `next_power_of_two` gives enough alignment guarantee. in krealloc_aligned()
37 // - `size` is greater than 0 since it's either a `layout.size()` (which cannot be zero in krealloc_aligned()
43 unsafe fn alloc(&self, layout: Layout) -> *mut u8 { in alloc()
44 // SAFETY: `ptr::null_mut()` is null and `layout` has a non-zero size by the function safety in alloc()
46 unsafe { krealloc_aligned(ptr::null_mut(), layout, bindings::GFP_KERNEL) } in alloc()
49 unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) { in dealloc() argument
55 unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 { in realloc() argument
57 // - `new_size`, when rounded up to the nearest multiple of `layout.align()`, will not in realloc()
59 // - `layout.align()` is a proper alignment (i.e. not zero and must be a power of two). in realloc()
60 let layout = unsafe { Layout::from_size_align_unchecked(new_size, layout.align()) }; in realloc() localVariable
65 // - the size of `layout` is not zero because `new_size` is not zero by the function safety in realloc()
67 unsafe { krealloc_aligned(ptr, layout, bindings::GFP_KERNEL) } in realloc()
70 unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { in alloc_zeroed()
71 // SAFETY: `ptr::null_mut()` is null and `layout` has a non-zero size by the function safety in alloc_zeroed()
76 layout, in alloc_zeroed()