diff --git a/crates/composefs/src/repository.rs b/crates/composefs/src/repository.rs index 224d2bed..4c0f557e 100644 --- a/crates/composefs/src/repository.rs +++ b/crates/composefs/src/repository.rs @@ -1028,6 +1028,7 @@ pub(crate) struct WritableRepo; pub struct Repository { repository: OwnedFd, objects: OnceCell, + images: OnceCell, write_semaphore: OnceCell>, /// Optional override for the number of concurrent object writes. /// Set via [`set_write_concurrency`](Self::set_write_concurrency) before the semaphore @@ -1366,6 +1367,12 @@ impl Repository { .get_or_try_init(|| ensure_dir_and_openat(&self.repository, "objects", OFlags::PATH)) } + /// Return the images directory. + pub fn images_dir(&self) -> ErrnoResult<&OwnedFd> { + self.images + .get_or_try_init(|| ensure_dir_and_openat(&self.repository, "images", OFlags::PATH)) + } + /// Override the maximum number of concurrent object writes. /// /// Must be called before the first use of [`write_semaphore`](Self::write_semaphore); @@ -1523,6 +1530,7 @@ impl Repository { Ok(Self { repository, objects: OnceCell::new(), + images: OnceCell::new(), write_semaphore: OnceCell::new(), write_concurrency: None, insecure: !has_verity,