@@ -274,7 +274,7 @@ impl ProcessNodeRefs {
274
274
}
275
275
276
276
pub ( crate ) struct Process {
277
- ctx : Arc < Context > ,
277
+ ctx : Ref < Context > ,
278
278
279
279
// TODO: For now this a mutex because we have allocations in BTreeMap and RangeAllocator while
280
280
// holding the lock. We may want to split up the process state at some point to use a spin lock
@@ -291,8 +291,8 @@ unsafe impl Send for Process {}
291
291
unsafe impl Sync for Process { }
292
292
293
293
impl Process {
294
- fn new ( ctx : Arc < Context > ) -> Result < Ref < Self > > {
295
- Ref :: try_new_and_init (
294
+ fn new ( ctx : Ref < Context > ) -> Result < Pin < Ref < Self > > > {
295
+ Ok ( Ref :: pinned ( Ref :: try_new_and_init (
296
296
Self {
297
297
ctx,
298
298
// SAFETY: `inner` is initialised in the call to `mutex_init` below.
@@ -308,7 +308,7 @@ impl Process {
308
308
let pinned = unsafe { process. as_mut ( ) . map_unchecked_mut ( |p| & mut p. node_refs ) } ;
309
309
kernel:: mutex_init!( pinned, "Process::node_refs" ) ;
310
310
} ,
311
- )
311
+ ) ? ) )
312
312
}
313
313
314
314
/// Attemps to fetch a work item from the process queue.
@@ -808,11 +808,9 @@ impl IoctlHandler for Process {
808
808
}
809
809
}
810
810
811
- impl FileOpener < Arc < Context > > for Process {
812
- fn open ( ctx : & Arc < Context > ) -> Result < Self :: Wrapper > {
813
- let process = Self :: new ( ctx. clone ( ) ) ?;
814
- // SAFETY: Pointer is pinned behind `Ref`.
815
- Ok ( unsafe { Pin :: new_unchecked ( process) } )
811
+ impl FileOpener < Ref < Context > > for Process {
812
+ fn open ( ctx : & Ref < Context > ) -> Result < Self :: Wrapper > {
813
+ Self :: new ( ctx. clone ( ) )
816
814
}
817
815
}
818
816
0 commit comments