Skip to content

Commit

Permalink
merge #118 into openSUSE/libpathrs:main
Browse files Browse the repository at this point in the history
Aleksa Sarai (3):
  rust 2021: TryFrom is now in the prelude
  rust 2018: migrate to 2018-style modules
  rust 2018: drop extern crate

LGTMs: cyphar
  • Loading branch information
cyphar committed Nov 30, 2024
2 parents 5b3b682 + b8fbbaf commit 0cabef3
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 127 deletions.
File renamed without changes.
5 changes: 1 addition & 4 deletions src/capi/procfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ use crate::{
procfs::{ProcfsBase, GLOBAL_PROCFS_HANDLE},
};

use std::{
convert::TryFrom,
os::unix::io::{OwnedFd, RawFd},
};
use std::os::unix::io::{OwnedFd, RawFd};

use libc::{c_char, c_int, size_t};
use open_enum::open_enum;
Expand Down
2 changes: 2 additions & 0 deletions src/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
use crate::syscalls;

use bitflags::bitflags;

bitflags! {
/// Wrapper for the underlying `libc`'s `O_*` flags.
///
Expand Down
4 changes: 0 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,6 @@
// <https://github.com/rust-lang/rust/issues/84605>
#![cfg_attr(coverage, feature(coverage_attribute))]

#[macro_use]
extern crate bitflags;
extern crate libc;

// `Handle` implementation.
mod handle;
#[doc(inline)]
Expand Down
10 changes: 9 additions & 1 deletion src/resolvers/mod.rs → src/resolvers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,17 @@ use std::{
use once_cell::sync::Lazy;

/// `O_PATH`-based userspace resolver.
pub(crate) mod opath;
pub(crate) mod opath {
mod r#impl;
pub(crate) use r#impl::*;

mod symlink_stack;
pub(crate) use symlink_stack::{SymlinkStack, SymlinkStackError};
}

/// `openat2(2)`-based in-kernel resolver.
pub(crate) mod openat2;

/// A limited resolver only used for `/proc` lookups in `ProcfsHandle`.
pub(crate) mod procfs;

Expand Down
24 changes: 0 additions & 24 deletions src/resolvers/opath/mod.rs

This file was deleted.

1 change: 1 addition & 0 deletions src/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use std::{
path::{Path, PathBuf},
};

use bitflags::bitflags;
use once_cell::sync::Lazy;
use rustix::{
fs::{
Expand Down
43 changes: 40 additions & 3 deletions src/tests/mod.rs → src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,48 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

pub(crate) mod common;
pub(crate) mod common {
mod root;
pub(crate) use root::*;

mod mntns;
pub(in crate::tests) use mntns::*;

mod handle;
pub(in crate::tests) use handle::*;
}

#[cfg(feature = "capi")]
pub(in crate::tests) mod capi;
pub(in crate::tests) mod traits;
#[allow(unsafe_code)]
pub(in crate::tests) mod capi {
mod utils;

mod root;
pub(in crate::tests) use root::*;

mod handle;
pub(in crate::tests) use handle::*;

mod procfs;
pub(in crate::tests) use procfs::*;
}

pub(in crate::tests) mod traits {
// TODO: Unless we can figure out a way to get Deref working, we might want
// to have these traits be included in the actual library...

mod root;
pub(in crate::tests) use root::*;

mod handle;
pub(in crate::tests) use handle::*;

mod procfs;
pub(in crate::tests) use procfs::*;

mod error;
pub(in crate::tests) use error::*;
}

mod test_procfs;
mod test_resolve;
Expand Down
31 changes: 0 additions & 31 deletions src/tests/capi/mod.rs

This file was deleted.

27 changes: 0 additions & 27 deletions src/tests/common/mod.rs

This file was deleted.

33 changes: 0 additions & 33 deletions src/tests/traits/mod.rs

This file was deleted.

File renamed without changes.

0 comments on commit 0cabef3

Please sign in to comment.