Skip to content

Commit

Permalink
{Handle,Root}: do not pub(crate) inner File
Browse files Browse the repository at this point in the history
With .into_file() this is no longer necessary and it's probably
preferable to use the publicly-available helpers anyway.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
  • Loading branch information
cyphar committed Jul 23, 2024
1 parent 15e1e95 commit 9f5f304
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use libc::c_int;
/// [`libc::openat`]: https://docs.rs/libc/latest/libc/fn.openat.html
#[derive(Debug)]
pub struct Handle {
pub(crate) inner: File,
inner: File,
}

/// Wrapper for the underlying `libc`'s `O_*` flags.
Expand Down
14 changes: 7 additions & 7 deletions src/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl RenameFlags {
#[derive(Debug)]
pub struct Root {
/// The underlying `O_PATH` `File` for this root handle.
pub(crate) inner: File,
inner: File,

/// The underlying [`Resolver`] to use for all operations underneath this
/// root. This affects not just [`Root::resolve`] but also all other methods
Expand Down Expand Up @@ -314,7 +314,7 @@ impl Root {
let dir = self
.resolve(parent)
.wrap("resolve target parent directory for inode creation")?
.inner;
.into_file();
let dirfd = dir.as_raw_fd();

match inode_type {
Expand All @@ -338,7 +338,7 @@ impl Root {
let olddir = self
.resolve(oldparent)
.wrap("resolve hardlink source parent for hardlink")?
.inner;
.into_file();
let olddirfd = olddir.as_raw_fd();
syscalls::linkat(olddirfd, oldname, dirfd, name, 0)
}
Expand Down Expand Up @@ -401,7 +401,7 @@ impl Root {
let dir = self
.resolve(parent)
.wrap("resolve target parent directory for inode creation")?
.inner;
.into_file();
let dirfd = dir.as_raw_fd();

// XXX: openat2(2) supports doing O_CREAT on trailing symlinks without
Expand Down Expand Up @@ -440,7 +440,7 @@ impl Root {
let dir = self
.resolve(parent)
.wrap("resolve target parent directory for inode creation")?
.inner;
.into_file();
let dirfd = dir.as_raw_fd();

// There is no kernel API to "just remove this inode please". You need
Expand Down Expand Up @@ -507,12 +507,12 @@ impl Root {
let src_dir = self
.resolve(src_parent)
.wrap("resolve source path for rename")?
.inner;
.into_file();
let src_dirfd = src_dir.as_raw_fd();
let dst_dir = self
.resolve(dst_parent)
.wrap("resolve target path for rename")?
.inner;
.into_file();
let dst_dirfd = dst_dir.as_raw_fd();

syscalls::renameat2(src_dirfd, src_name, dst_dirfd, dst_name, flags.0).context(
Expand Down

0 comments on commit 9f5f304

Please sign in to comment.