@@ -274,7 +274,7 @@ impl ProcessNodeRefs {
274274}
275275
276276pub ( crate ) struct Process {
277- ctx : Arc < Context > ,
277+ ctx : Ref < Context > ,
278278
279279 // TODO: For now this a mutex because we have allocations in BTreeMap and RangeAllocator while
280280 // 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 {}
291291unsafe impl Sync for Process { }
292292
293293impl 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 (
296296 Self {
297297 ctx,
298298 // SAFETY: `inner` is initialised in the call to `mutex_init` below.
@@ -308,7 +308,7 @@ impl Process {
308308 let pinned = unsafe { process. as_mut ( ) . map_unchecked_mut ( |p| & mut p. node_refs ) } ;
309309 kernel:: mutex_init!( pinned, "Process::node_refs" ) ;
310310 } ,
311- )
311+ ) ? ) )
312312 }
313313
314314 /// Attemps to fetch a work item from the process queue.
@@ -808,11 +808,9 @@ impl IoctlHandler for Process {
808808 }
809809}
810810
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 ( ) )
816814 }
817815}
818816
0 commit comments