summaryrefslogtreecommitdiff
path: root/src/sys/statfs.rs
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2019-12-22 18:36:18 -0700
committerAlan Somers <asomers@gmail.com>2019-12-22 20:00:05 -0700
commit7a1e86131361b5fae03517513d46c188399fa07b (patch)
tree9acfda7081ba7725dc7b988160c317983bb699aa /src/sys/statfs.rs
parenta78ddbce5a795ade09ed175b4ed60ace65a0e734 (diff)
downloadnix-7a1e86131361b5fae03517513d46c188399fa07b.zip
Fix the build on OpenBSD.
We were assuming the wrong types for f_iosize and f_ffree in struct statfs on OpenBSD. Fixes #1125
Diffstat (limited to 'src/sys/statfs.rs')
-rw-r--r--src/sys/statfs.rs35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/sys/statfs.rs b/src/sys/statfs.rs
index c71b5767..f463400e 100644
--- a/src/sys/statfs.rs
+++ b/src/sys/statfs.rs
@@ -106,19 +106,28 @@ impl Statfs {
}
/// Optimal transfer block size
- #[cfg(any(target_os = "ios", target_os = "macos", target_os = "openbsd"))]
+ #[cfg(any(target_os = "ios", target_os = "macos"))]
pub fn optimal_transfer_size(&self) -> i32 {
self.0.f_iosize
}
/// Optimal transfer block size
+ #[cfg(target_os = "openbsd")]
+ pub fn optimal_transfer_size(&self) -> u32 {
+ self.0.f_iosize
+ }
+
+ /// Optimal transfer block size
#[cfg(all(target_os = "linux", target_arch = "s390x"))]
pub fn optimal_transfer_size(&self) -> u32 {
self.0.f_bsize
}
/// Optimal transfer block size
- #[cfg(all(target_os = "linux", target_env = "musl"))]
+ #[cfg(any(
+ target_os = "android",
+ all(target_os = "linux", target_env = "musl")
+ ))]
pub fn optimal_transfer_size(&self) -> libc::c_ulong {
self.0.f_bsize
}
@@ -130,12 +139,6 @@ impl Statfs {
}
/// Optimal transfer block size
- #[cfg(target_os = "android")]
- pub fn optimal_transfer_size(&self) -> libc::c_ulong {
- self.0.f_bsize
- }
-
- /// Optimal transfer block size
#[cfg(target_os = "dragonfly")]
pub fn optimal_transfer_size(&self) -> libc::c_long {
self.0.f_iosize
@@ -375,7 +378,13 @@ impl Statfs {
}
/// Free file nodes in filesystem
- #[cfg(any(target_os = "ios", target_os = "macos", target_os = "android"))]
+ #[cfg(any(
+ target_os = "android",
+ target_os = "ios",
+ all(target_os = "linux", target_env = "musl"),
+ target_os = "macos",
+ target_os = "openbsd"
+ ))]
pub fn files_free(&self) -> u64 {
self.0.f_ffree
}
@@ -387,18 +396,12 @@ impl Statfs {
}
/// Free file nodes in filesystem
- #[cfg(any(target_os = "freebsd", target_os = "openbsd"))]
+ #[cfg(target_os = "freebsd")]
pub fn files_free(&self) -> i64 {
self.0.f_ffree
}
/// Free file nodes in filesystem
- #[cfg(all(target_os = "linux", target_env = "musl"))]
- pub fn files_free(&self) -> u64 {
- self.0.f_ffree
- }
-
- /// Free file nodes in filesystem
#[cfg(not(any(
target_os = "ios",
target_os = "macos",