Skip to content

Commit 0e303b5

Browse files
committed
TEMP: rust: Adjustment of allocation API changes
Signed-off-by: Boqun Feng <[email protected]>
1 parent 1a0829c commit 0e303b5

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

rust/kernel/file.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
//! [`include/linux/file.h`](srctree/include/linux/file.h)
77
88
use crate::{
9+
alloc::AllocError,
910
bindings,
1011
cred::Credential,
1112
error::{code::*, Error, Result},
13+
prelude::*,
1214
types::{ARef, AlwaysRefCounted, NotThreadSafe, Opaque},
1315
};
1416
use alloc::boxed::Box;
15-
use core::{alloc::AllocError, mem, ptr};
17+
use core::{mem, ptr};
1618

1719
/// Flags associated with a [`File`].
1820
pub mod flags {
@@ -348,10 +350,13 @@ impl DeferredFdCloser {
348350
pub fn new() -> Result<Self, AllocError> {
349351
Ok(Self {
350352
// INVARIANT: The `file` pointer is null, so the type invariant does not apply.
351-
inner: Box::try_new(DeferredFdCloserInner {
352-
twork: mem::MaybeUninit::uninit(),
353-
file: core::ptr::null_mut(),
354-
})?,
353+
inner: <Box<_> as BoxExt<_>>::new(
354+
DeferredFdCloserInner {
355+
twork: mem::MaybeUninit::uninit(),
356+
file: core::ptr::null_mut(),
357+
},
358+
GFP_KERNEL,
359+
)?,
355360
})
356361
}
357362

0 commit comments

Comments
 (0)