@@ -36,7 +36,7 @@ pub(crate) struct Storage {
3636 pub physical_root : Dir ,
3737
3838 /// The OSTree storage
39- pub sysroot : SysrootLock ,
39+ ostree : SysrootLock ,
4040 /// The composefs storage
4141 pub composefs : OnceCell < Arc < ComposefsRepository > > ,
4242 /// The containers-image storage used foR LBIs
@@ -56,7 +56,7 @@ impl Deref for Storage {
5656 type Target = SysrootLock ;
5757
5858 fn deref ( & self ) -> & Self :: Target {
59- & self . sysroot
59+ & self . ostree
6060 }
6161}
6262
@@ -82,21 +82,32 @@ impl Storage {
8282
8383 Ok ( Self {
8484 physical_root,
85- sysroot,
85+ ostree : sysroot,
8686 run,
8787 composefs : Default :: default ( ) ,
8888 imgstore : Default :: default ( ) ,
8989 } )
9090 }
9191
92+ /// Access the underlying ostree repository
93+ pub ( crate ) fn get_ostree ( & self ) -> Result < & SysrootLock > {
94+ Ok ( & self . ostree )
95+ }
96+
97+ /// Access the underlying ostree repository
98+ pub ( crate ) fn get_ostree_cloned ( & self ) -> Result < ostree:: Sysroot > {
99+ let r = self . get_ostree ( ) ?;
100+ Ok ( ( * r) . clone ( ) )
101+ }
102+
92103 /// Access the image storage; will automatically initialize it if necessary.
93104 pub ( crate ) fn get_ensure_imgstore ( & self ) -> Result < & crate :: imgstorage:: Storage > {
94105 if let Some ( imgstore) = self . imgstore . get ( ) {
95106 return Ok ( imgstore) ;
96107 }
97- let sysroot_dir = crate :: utils:: sysroot_dir ( & self . sysroot ) ?;
108+ let sysroot_dir = crate :: utils:: sysroot_dir ( & self . ostree ) ?;
98109
99- let sepolicy = if self . sysroot . booted_deployment ( ) . is_none ( ) {
110+ let sepolicy = if self . ostree . booted_deployment ( ) . is_none ( ) {
100111 // fallback to policy from container root
101112 // this should only happen during cleanup of a broken install
102113 tracing:: trace!( "falling back to container root's selinux policy" ) ;
@@ -106,8 +117,8 @@ impl Storage {
106117 // load the sepolicy from the booted ostree deployment so the imgstorage can be
107118 // properly labeled with /var/lib/container/storage labels
108119 tracing:: trace!( "loading sepolicy from booted ostree deployment" ) ;
109- let dep = self . sysroot . booted_deployment ( ) . unwrap ( ) ;
110- let dep_fs = deployment_fd ( & self . sysroot , & dep) ?;
120+ let dep = self . ostree . booted_deployment ( ) . unwrap ( ) ;
121+ let dep_fs = deployment_fd ( & self . ostree , & dep) ?;
111122 lsm:: new_sepolicy_at ( & dep_fs) ?
112123 } ;
113124
@@ -132,7 +143,7 @@ impl Storage {
132143
133144 // Bootstrap verity off of the ostree state. In practice this means disabled by
134145 // default right now.
135- let ostree_repo = & self . sysroot . repo ( ) ;
146+ let ostree_repo = & self . ostree . repo ( ) ;
136147 let ostree_verity = ostree_ext:: fsverity:: is_verity_enabled ( ostree_repo) ?;
137148 if !ostree_verity. enabled {
138149 tracing:: debug!( "Setting insecure mode for composefs repo" ) ;
@@ -147,7 +158,7 @@ impl Storage {
147158 #[ context( "Updating storage root mtime" ) ]
148159 pub ( crate ) fn update_mtime ( & self ) -> Result < ( ) > {
149160 let sysroot_dir =
150- crate :: utils:: sysroot_dir ( & self . sysroot ) . context ( "Reopen sysroot directory" ) ?;
161+ crate :: utils:: sysroot_dir ( & self . ostree ) . context ( "Reopen sysroot directory" ) ?;
151162
152163 sysroot_dir
153164 . update_timestamps ( std:: path:: Path :: new ( BOOTC_ROOT ) )
0 commit comments