Skip to content

Commit b069a27

Browse files
committed
fixup! rust: xarray: add insert and reserve
1 parent 694adba commit b069a27

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

rust/kernel/xarray.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ impl<'a, T: ForeignOwnable> Guard<'a, T> {
378378
gfp: alloc::Flags,
379379
) -> Result<(), StoreError<T>> {
380380
build_assert!(
381-
mem::align_of::<T::PointedTo>() >= 4,
381+
T::FOREIGN_ALIGN >= 4,
382382
"pointers stored in XArray must be 4-byte aligned"
383383
);
384384
let ptr = value.into_foreign();
@@ -411,7 +411,7 @@ impl<'a, T: ForeignOwnable> Guard<'a, T> {
411411
unsafe fn alloc(
412412
&mut self,
413413
limit: impl ops::RangeBounds<u32>,
414-
ptr: *mut T::PointedTo,
414+
ptr: *mut c_void,
415415
gfp: alloc::Flags,
416416
) -> Result<usize> {
417417
// NB: `xa_limit::{max,min}` are inclusive.
@@ -461,7 +461,7 @@ impl<'a, T: ForeignOwnable> Guard<'a, T> {
461461
gfp: alloc::Flags,
462462
) -> Result<usize, StoreError<T>> {
463463
build_assert!(
464-
mem::align_of::<T::PointedTo>() >= 4,
464+
T::FOREIGN_ALIGN >= 4,
465465
"pointers stored in XArray must be 4-byte aligned"
466466
);
467467
let ptr = value.into_foreign();
@@ -532,7 +532,7 @@ impl<T: ForeignOwnable> Reservation<'_, T> {
532532
/// # Safety
533533
///
534534
/// `ptr` must be `NULL` or have come from a previous call to `T::into_foreign`.
535-
unsafe fn replace(guard: &mut Guard<'_, T>, index: usize, ptr: *mut T::PointedTo) -> Result {
535+
unsafe fn replace(guard: &mut Guard<'_, T>, index: usize, ptr: *mut c_void) -> Result {
536536
// SAFETY: `xa_zero_entry` wraps `XA_ZERO_ENTRY` which is always safe to use.
537537
let old = unsafe { bindings::xa_zero_entry() };
538538

0 commit comments

Comments
 (0)