diff --git a/Cargo.lock b/Cargo.lock index 1e17cc17..3dfdeb5d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -693,6 +693,7 @@ dependencies = [ "anyhow", "bitvec", "blake3", + "cfg-if", "criterion", "crossbeam", "crossbeam-channel", diff --git a/nomt/Cargo.toml b/nomt/Cargo.toml index 4dd7b2d8..f5eef40f 100644 --- a/nomt/Cargo.toml +++ b/nomt/Cargo.toml @@ -30,6 +30,7 @@ libc = "0.2.155" criterion = { version = "0.3", optional = true } thread_local = "1.1.8" fs2 = "0.4.3" +cfg-if = "1.0.0" [target.'cfg(target_os="linux")'.dependencies] io-uring = "0.6.4" diff --git a/nomt/src/lib.rs b/nomt/src/lib.rs index 1385f58b..b53d7ecc 100644 --- a/nomt/src/lib.rs +++ b/nomt/src/lib.rs @@ -46,6 +46,7 @@ mod rw_pass_cell; mod seek; mod seglog; mod store; +mod sys; mod io; diff --git a/nomt/src/sys/linux.rs b/nomt/src/sys/linux.rs new file mode 100644 index 00000000..8d4c2fcc --- /dev/null +++ b/nomt/src/sys/linux.rs @@ -0,0 +1 @@ +//! Linux-specific code. diff --git a/nomt/src/sys/macos.rs b/nomt/src/sys/macos.rs new file mode 100644 index 00000000..9bb9f211 --- /dev/null +++ b/nomt/src/sys/macos.rs @@ -0,0 +1 @@ +//! macOS-specific code. diff --git a/nomt/src/sys/mod.rs b/nomt/src/sys/mod.rs new file mode 100644 index 00000000..cd8461c2 --- /dev/null +++ b/nomt/src/sys/mod.rs @@ -0,0 +1,13 @@ +//! Platform-specific code. +//! +//! At the moment we only target Linux and macOS. + +cfg_if::cfg_if! { + if #[cfg(target_os = "linux")] { + pub mod linux; + pub mod unix; + } else if #[cfg(target_os = "macos")] { + pub mod macos; + pub mod unix; + } +} diff --git a/nomt/src/sys/unix.rs b/nomt/src/sys/unix.rs new file mode 100644 index 00000000..d85b218f --- /dev/null +++ b/nomt/src/sys/unix.rs @@ -0,0 +1,2 @@ +//! Common Unix definitions. +