Skip to content

Commit 5907135

Browse files
authored
Enable statvfs on Redox (#1506)
* Enable fstatvfs for Redox * Revert statfs
1 parent 051e7e0 commit 5907135

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

src/backend/libc/fs/dir.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::fs::{fstat, Stat};
2424
target_os = "wasi",
2525
)))]
2626
use crate::fs::{fstatfs, StatFs};
27-
#[cfg(not(any(solarish, target_os = "redox", target_os = "vita", target_os = "wasi")))]
27+
#[cfg(not(any(solarish, target_os = "vita", target_os = "wasi")))]
2828
use crate::fs::{fstatvfs, StatVfs};
2929
use crate::io;
3030
#[cfg(not(any(target_os = "fuchsia", target_os = "vita", target_os = "wasi")))]
@@ -238,7 +238,6 @@ impl Dir {
238238
#[cfg(not(any(
239239
solarish,
240240
target_os = "horizon",
241-
target_os = "redox",
242241
target_os = "vita",
243242
target_os = "wasi"
244243
)))]

src/backend/libc/fs/syscalls.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ use crate::fs::Timestamps;
6060
)))]
6161
use crate::fs::{Dev, FileType};
6262
use crate::fs::{Mode, OFlags, SeekFrom, Stat};
63-
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
63+
#[cfg(not(target_os = "wasi"))]
6464
use crate::fs::{StatVfs, StatVfsMountFlags};
6565
use crate::io;
6666
#[cfg(all(target_env = "gnu", fix_y2038))]
@@ -271,7 +271,7 @@ pub(crate) fn statfs(filename: &CStr) -> io::Result<StatFs> {
271271
}
272272
}
273273

274-
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
274+
#[cfg(not(target_os = "wasi"))]
275275
#[inline]
276276
pub(crate) fn statvfs(filename: &CStr) -> io::Result<StatVfs> {
277277
unsafe {
@@ -1591,7 +1591,7 @@ pub(crate) fn fstatfs(fd: BorrowedFd<'_>) -> io::Result<StatFs> {
15911591
}
15921592
}
15931593

1594-
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
1594+
#[cfg(not(target_os = "wasi"))]
15951595
pub(crate) fn fstatvfs(fd: BorrowedFd<'_>) -> io::Result<StatVfs> {
15961596
let mut statvfs = MaybeUninit::<c::statvfs>::uninit();
15971597
unsafe {
@@ -1600,7 +1600,7 @@ pub(crate) fn fstatvfs(fd: BorrowedFd<'_>) -> io::Result<StatVfs> {
16001600
}
16011601
}
16021602

1603-
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
1603+
#[cfg(not(target_os = "wasi"))]
16041604
fn libc_statvfs_to_statvfs(from: c::statvfs) -> StatVfs {
16051605
StatVfs {
16061606
f_bsize: from.f_bsize as u64,

src/backend/libc/fs/types.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ bitflags! {
845845
}
846846
}
847847

848-
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
848+
#[cfg(not(target_os = "wasi"))]
849849
bitflags! {
850850
/// `ST_*` constants for use with [`StatVfs`].
851851
#[repr(transparent)]
@@ -877,11 +877,11 @@ bitflags! {
877877
const NOEXEC = c::ST_NOEXEC as u64;
878878

879879
/// `ST_NOSUID`
880-
#[cfg(not(any(target_os = "espidf", target_os = "haiku", target_os = "horizon", target_os = "vita")))]
880+
#[cfg(not(any(target_os = "espidf", target_os = "haiku", target_os = "horizon", target_os = "redox", target_os = "vita")))]
881881
const NOSUID = c::ST_NOSUID as u64;
882882

883883
/// `ST_RDONLY`
884-
#[cfg(not(any(target_os = "espidf", target_os = "haiku", target_os = "horizon", target_os = "vita")))]
884+
#[cfg(not(any(target_os = "espidf", target_os = "haiku", target_os = "horizon", target_os = "redox", target_os = "vita")))]
885885
const RDONLY = c::ST_RDONLY as u64;
886886

887887
/// `ST_RELATIME`
@@ -1077,7 +1077,7 @@ pub type Fsid = c::fsid_t;
10771077
///
10781078
/// [`statvfs`]: crate::fs::statvfs
10791079
/// [`fstatvfs`]: crate::fs::fstatvfs
1080-
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
1080+
#[cfg(not(target_os = "wasi"))]
10811081
#[allow(missing_docs)]
10821082
pub struct StatVfs {
10831083
pub f_bsize: u64,

src/fs/abs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::fs::Access;
1515
target_os = "wasi",
1616
)))]
1717
use crate::fs::StatFs;
18-
#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
18+
#[cfg(not(any(target_os = "haiku", target_os = "wasi")))]
1919
use crate::fs::StatVfs;
2020
use crate::fs::{Mode, OFlags, Stat};
2121
#[cfg(not(target_os = "wasi"))]
@@ -283,7 +283,7 @@ pub fn statfs<P: path::Arg>(path: P) -> io::Result<StatFs> {
283283
///
284284
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/statvfs.html
285285
/// [Linux]: https://man7.org/linux/man-pages/man2/statvfs.2.html
286-
#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
286+
#[cfg(not(any(target_os = "haiku", target_os = "wasi")))]
287287
#[inline]
288288
pub fn statvfs<P: path::Arg>(path: P) -> io::Result<StatVfs> {
289289
path.into_with_c_str(backend::fs::syscalls::statvfs)

src/fs/fd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use backend::fs::types::Stat;
4040
target_os = "wasi",
4141
)))]
4242
use backend::fs::types::StatFs;
43-
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
43+
#[cfg(not(target_os = "wasi"))]
4444
use backend::fs::types::StatVfs;
4545

4646
/// Timestamps used by [`utimensat`] and [`futimens`].
@@ -196,7 +196,7 @@ pub fn fstatfs<Fd: AsFd>(fd: Fd) -> io::Result<StatFs> {
196196
///
197197
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/fstatvfs.html
198198
/// [Linux]: https://man7.org/linux/man-pages/man2/fstatvfs.2.html
199-
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
199+
#[cfg(not(target_os = "wasi"))]
200200
#[inline]
201201
pub fn fstatvfs<Fd: AsFd>(fd: Fd) -> io::Result<StatVfs> {
202202
backend::fs::syscalls::fstatvfs(fd.as_fd())

0 commit comments

Comments
 (0)