summaryrefslogtreecommitdiff
path: root/src/sys/statfs.rs
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2022-10-18 08:38:16 -0600
committerAlan Somers <asomers@gmail.com>2022-10-23 22:41:07 -0600
commit3f66d1f4ce06403f646876864260c59ca3627ee4 (patch)
tree22764a3f53b830dfb55db2f979de4805e3981d9d /src/sys/statfs.rs
parentd6fdd5952deb826a0428ba54f08f8048291030c0 (diff)
downloadnix-3f66d1f4ce06403f646876864260c59ca3627ee4.zip
Define `MntFlags` and `unmount` on all of the BSDs.
Diffstat (limited to 'src/sys/statfs.rs')
-rw-r--r--src/sys/statfs.rs111
1 files changed, 25 insertions, 86 deletions
diff --git a/src/sys/statfs.rs b/src/sys/statfs.rs
index a302b4e8..acbc75cd 100644
--- a/src/sys/statfs.rs
+++ b/src/sys/statfs.rs
@@ -422,7 +422,9 @@ impl Statfs {
target_os = "macos",
target_os = "android",
target_os = "freebsd",
+ target_os = "fuchsia",
target_os = "openbsd",
+ target_os = "linux",
))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub fn blocks(&self) -> u64 {
@@ -437,24 +439,9 @@ impl Statfs {
}
/// Total data blocks in filesystem
- #[cfg(all(target_os = "linux", any(target_env = "musl", target_arch = "riscv32", all(target_arch = "x86_64", target_pointer_width = "32"))))]
+ #[cfg(target_os = "emscripten")]
#[cfg_attr(docsrs, doc(cfg(all())))]
- pub fn blocks(&self) -> u64 {
- self.0.f_blocks
- }
-
- /// Total data blocks in filesystem
- #[cfg(not(any(
- target_os = "ios",
- target_os = "macos",
- target_os = "android",
- target_os = "freebsd",
- target_os = "openbsd",
- target_os = "dragonfly",
- all(target_os = "linux", any(target_env = "musl", target_arch = "riscv32", all(target_arch = "x86_64", target_pointer_width = "32")))
- )))]
- #[cfg_attr(docsrs, doc(cfg(all())))]
- pub fn blocks(&self) -> libc::c_ulong {
+ pub fn blocks(&self) -> u32 {
self.0.f_blocks
}
@@ -464,7 +451,9 @@ impl Statfs {
target_os = "macos",
target_os = "android",
target_os = "freebsd",
+ target_os = "fuchsia",
target_os = "openbsd",
+ target_os = "linux",
))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub fn blocks_free(&self) -> u64 {
@@ -479,29 +468,20 @@ impl Statfs {
}
/// Free blocks in filesystem
- #[cfg(all(target_os = "linux", any(target_env = "musl", target_arch = "riscv32", all(target_arch = "x86_64", target_pointer_width = "32"))))]
+ #[cfg(target_os = "emscripten")]
#[cfg_attr(docsrs, doc(cfg(all())))]
- pub fn blocks_free(&self) -> u64 {
+ pub fn blocks_free(&self) -> u32 {
self.0.f_bfree
}
- /// Free blocks in filesystem
- #[cfg(not(any(
+ /// Free blocks available to unprivileged user
+ #[cfg(any(
target_os = "ios",
target_os = "macos",
target_os = "android",
- target_os = "freebsd",
- target_os = "openbsd",
- target_os = "dragonfly",
- all(target_os = "linux", any(target_env = "musl", target_arch = "riscv32", all(target_arch = "x86_64", target_pointer_width = "32")))
- )))]
- #[cfg_attr(docsrs, doc(cfg(all())))]
- pub fn blocks_free(&self) -> libc::c_ulong {
- self.0.f_bfree
- }
-
- /// Free blocks available to unprivileged user
- #[cfg(any(target_os = "ios", target_os = "macos", target_os = "android"))]
+ target_os = "fuchsia",
+ target_os = "linux",
+ ))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub fn blocks_available(&self) -> u64 {
self.0.f_bavail
@@ -522,24 +502,9 @@ impl Statfs {
}
/// Free blocks available to unprivileged user
- #[cfg(all(target_os = "linux", any(target_env = "musl", target_arch = "riscv32", all(target_arch = "x86_64", target_pointer_width = "32"))))]
+ #[cfg(target_os = "emscripten")]
#[cfg_attr(docsrs, doc(cfg(all())))]
- pub fn blocks_available(&self) -> u64 {
- self.0.f_bavail
- }
-
- /// Free blocks available to unprivileged user
- #[cfg(not(any(
- target_os = "ios",
- target_os = "macos",
- target_os = "android",
- target_os = "freebsd",
- target_os = "openbsd",
- target_os = "dragonfly",
- all(target_os = "linux", any(target_env = "musl", target_arch = "riscv32", all(target_arch = "x86_64", target_pointer_width = "32")))
- )))]
- #[cfg_attr(docsrs, doc(cfg(all())))]
- pub fn blocks_available(&self) -> libc::c_ulong {
+ pub fn blocks_available(&self) -> u32 {
self.0.f_bavail
}
@@ -549,7 +514,9 @@ impl Statfs {
target_os = "macos",
target_os = "android",
target_os = "freebsd",
+ target_os = "fuchsia",
target_os = "openbsd",
+ target_os = "linux",
))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub fn files(&self) -> u64 {
@@ -564,33 +531,20 @@ impl Statfs {
}
/// Total file nodes in filesystem
- #[cfg(all(target_os = "linux", any(target_env = "musl", target_arch = "riscv32", all(target_arch = "x86_64", target_pointer_width = "32"))))]
+ #[cfg(target_os = "emscripten")]
#[cfg_attr(docsrs, doc(cfg(all())))]
- pub fn files(&self) -> libc::fsfilcnt_t {
+ pub fn files(&self) -> u32 {
self.0.f_files
}
- /// Total file nodes in filesystem
- #[cfg(not(any(
+ /// Free file nodes in filesystem
+ #[cfg(any(
target_os = "ios",
target_os = "macos",
target_os = "android",
- target_os = "freebsd",
+ target_os = "fuchsia",
target_os = "openbsd",
- target_os = "dragonfly",
- all(target_os = "linux", any(target_env = "musl", target_arch = "riscv32", all(target_arch = "x86_64", target_pointer_width = "32")))
- )))]
- #[cfg_attr(docsrs, doc(cfg(all())))]
- pub fn files(&self) -> libc::c_ulong {
- self.0.f_files
- }
-
- /// Free file nodes in filesystem
- #[cfg(any(
- target_os = "android",
- target_os = "ios",
- target_os = "macos",
- target_os = "openbsd"
+ target_os = "linux",
))]
#[cfg_attr(docsrs, doc(cfg(all())))]
pub fn files_free(&self) -> u64 {
@@ -612,24 +566,9 @@ impl Statfs {
}
/// Free file nodes in filesystem
- #[cfg(all(target_os = "linux", any(target_env = "musl", target_arch = "riscv32", all(target_arch = "x86_64", target_pointer_width = "32"))))]
- #[cfg_attr(docsrs, doc(cfg(all())))]
- pub fn files_free(&self) -> libc::fsfilcnt_t {
- self.0.f_ffree
- }
-
- /// Free file nodes in filesystem
- #[cfg(not(any(
- target_os = "ios",
- target_os = "macos",
- target_os = "android",
- target_os = "freebsd",
- target_os = "openbsd",
- target_os = "dragonfly",
- all(target_os = "linux", any(target_env = "musl", target_arch = "riscv32", all(target_arch = "x86_64", target_pointer_width = "32")))
- )))]
+ #[cfg(target_os = "emscripten")]
#[cfg_attr(docsrs, doc(cfg(all())))]
- pub fn files_free(&self) -> libc::c_ulong {
+ pub fn files_free(&self) -> u32 {
self.0.f_ffree
}