Skip to content

Commit debe674

Browse files
src: adjust a couple of APIs
Rename a couple of things for consistency and clarity. Add a dirfd parameter to the read-from-directory code. Signed-off-by: Allison Karlitskaya <[email protected]>
1 parent f0c39e2 commit debe674

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/bin/cfsctl.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ async fn main() -> Result<()> {
257257
bootable,
258258
stat_root,
259259
} => {
260-
let mut fs = composefs::fs::read_from_path(path, Some(&repo), stat_root)?;
260+
let mut fs = composefs::fs::read_filesystem(CWD, path, Some(&repo), stat_root)?;
261261
if bootable {
262262
fs.transform_for_boot(&repo)?;
263263
}
@@ -270,7 +270,7 @@ async fn main() -> Result<()> {
270270
stat_root,
271271
ref image_name,
272272
} => {
273-
let mut fs = composefs::fs::read_from_path(path, Some(&repo), stat_root)?;
273+
let mut fs = composefs::fs::read_filesystem(CWD, path, Some(&repo), stat_root)?;
274274
if bootable {
275275
fs.transform_for_boot(&repo)?;
276276
}
@@ -282,7 +282,7 @@ async fn main() -> Result<()> {
282282
bootable,
283283
stat_root,
284284
} => {
285-
let mut fs = composefs::fs::read_from_path(path, Some(&repo), stat_root)?;
285+
let mut fs = composefs::fs::read_filesystem(CWD, path, Some(&repo), stat_root)?;
286286
if bootable {
287287
fs.transform_for_boot(&repo)?;
288288
}

src/fs.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ impl<ObjectID: FsVerityHashValue> FilesystemReader<'_, ObjectID> {
313313
}
314314
}
315315

316-
pub fn read_from_path<ObjectID: FsVerityHashValue>(
316+
pub fn read_filesystem<ObjectID: FsVerityHashValue>(
317+
dirfd: impl AsFd,
317318
path: &Path,
318319
repo: Option<&Repository<ObjectID>>,
319320
stat_root: bool,
@@ -323,7 +324,7 @@ pub fn read_from_path<ObjectID: FsVerityHashValue>(
323324
inodes: HashMap::new(),
324325
};
325326

326-
let root = reader.read_directory(CWD, path.as_os_str(), stat_root)?;
327+
let root = reader.read_directory(dirfd, path.as_os_str(), stat_root)?;
327328

328329
Ok(FileSystem {
329330
root,

src/oci/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,13 +318,13 @@ pub fn write_config<ObjectID: FsVerityHashValue>(
318318

319319
pub fn seal<ObjectID: FsVerityHashValue>(
320320
repo: &Arc<Repository<ObjectID>>,
321-
name: &str,
322-
verity: Option<&ObjectID>,
321+
config_name: &str,
322+
config_verity: Option<&ObjectID>,
323323
) -> Result<ContentAndVerity<ObjectID>> {
324-
let (mut config, refs) = open_config(repo, name, verity)?;
324+
let (mut config, refs) = open_config(repo, config_name, config_verity)?;
325325
let mut myconfig = config.config().clone().context("no config!")?;
326326
let labels = myconfig.labels_mut().get_or_insert_with(HashMap::new);
327-
let mut fs = crate::oci::image::create_filesystem(repo, name, verity)?;
327+
let mut fs = crate::oci::image::create_filesystem(repo, config_name, config_verity)?;
328328
let id = fs.compute_image_id();
329329
labels.insert("containers.composefs.fsverity".to_string(), id.to_hex());
330330
config.set_config(Some(myconfig));

0 commit comments

Comments
 (0)