File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 11use camino:: Utf8Path ;
22use std:: path:: Path ;
3+ use std:: sync:: OnceLock ;
34
45use anyhow:: { bail, Context , Result } ;
56use bootc_blockdev:: PartitionTable ;
67use fn_error_context:: context;
78
9+ static PARENT_DEVICES : OnceLock < Vec < String > > = OnceLock :: new ( ) ;
10+
11+ // Initialize once
12+ pub fn init_parent_devices ( strings : Vec < String > ) {
13+ PARENT_DEVICES . set ( strings) . expect ( "Already initialized" ) ;
14+ }
15+
16+ // Read many times (lock-free)
17+ pub fn get_parent_devices ( ) -> & ' static [ String ] {
18+ PARENT_DEVICES . get ( ) . expect ( "Not initialized" )
19+ }
20+
821#[ context( "get parent devices from mount point boot" ) ]
922pub fn get_devices < P : AsRef < Path > > ( target_root : P ) -> Result < Vec < String > > {
1023 let target_root = target_root. as_ref ( ) ;
You can’t perform that action at this time.
0 commit comments