Skip to content

Commit 43de9b3

Browse files
committed
fuse: remove dependency on unstable ptr_metadata
1 parent 2955276 commit 43de9b3

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

src/fs/fuse.rs

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -490,10 +490,7 @@ where
490490
}
491491

492492
impl<O: ops::Op> Cmd<O> {
493-
fn with_capacity(nodeid: u64, op_header: O::InStruct, len: usize) -> Box<UninitCmd<O>>
494-
where
495-
Cmd<O>: core::ptr::Pointee<Metadata = usize>,
496-
{
493+
fn with_capacity(nodeid: u64, op_header: O::InStruct, len: usize) -> Box<UninitCmd<O>> {
497494
let mut cmd = unsafe { Self::new_uninit(len) };
498495
cmd.in_header = MaybeUninit::new(fuse_abi::InHeader {
499496
len: core::mem::size_of_val(cmd.as_ref())
@@ -540,23 +537,20 @@ impl<O: ops::Op> AsSliceU8 for Cmd<O> {
540537
}
541538
}
542539

543-
impl<O: ops::Op> Cmd<O>
544-
where
545-
Self: core::ptr::Pointee<Metadata = usize>,
546-
{
540+
impl<O: ops::Op> Cmd<O> {
547541
// MaybeUninit does not accept DSTs as type parameter
548542
unsafe fn new_uninit(len: usize) -> Box<UninitCmd<O>> {
549543
unsafe {
550-
Box::from_raw(core::ptr::from_raw_parts_mut(
544+
Box::from_raw(core::ptr::slice_from_raw_parts_mut(
551545
alloc(
552546
Layout::new::<PayloadlessCmd<O>>()
553547
.extend(Layout::array::<u8>(len).expect("The length is too much."))
554548
.expect("The layout size overflowed.")
555549
.0 // We don't need the offset of `data_header` inside the type (the second element of the tuple)
556550
.pad_to_align(),
557-
) as *mut (),
558-
len,
559-
))
551+
),
552+
0,
553+
) as *mut UninitCmd<O>)
560554
}
561555
}
562556
}
@@ -582,20 +576,20 @@ impl<O: ops::Op> AsSliceU8 for Rsp<O> {}
582576

583577
impl<O: ops::Op> Rsp<O>
584578
where
585-
Self: core::ptr::Pointee<Metadata = usize>,
579+
O: ops::Op<OutPayload = [MaybeUninit<u8>]>,
586580
{
587581
unsafe fn new_uninit(len: usize) -> Box<Self> {
588582
unsafe {
589-
Box::from_raw(core::ptr::from_raw_parts_mut(
583+
Box::from_raw(core::ptr::slice_from_raw_parts_mut(
590584
alloc(
591585
Layout::new::<PayloadlessRsp<O>>()
592586
.extend(Layout::array::<u8>(len).expect("The length is too much."))
593587
.expect("The layout size overflowed.")
594588
.0 // We don't need the offset of `data_header` inside the type (the second element of the tuple)
595589
.pad_to_align(),
596-
) as *mut (),
597-
len,
598-
))
590+
),
591+
0,
592+
) as *mut Rsp<O>)
599593
}
600594
}
601595
}

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#![feature(new_uninit)]
2525
#![feature(noop_waker)]
2626
#![feature(pointer_is_aligned)]
27-
#![feature(ptr_metadata)]
2827
#![feature(slice_from_ptr_range)]
2928
#![cfg_attr(
3029
any(target_arch = "aarch64", target_arch = "riscv64"),

0 commit comments

Comments
 (0)