Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/sys/statfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ impl Debug for Statfs {

/// Describes a mounted file system.
///
/// The result is OS-dependent. For a portable alternative, see
/// The result is OS-dependent. For a platform portable alternative, see
/// [`statvfs`](crate::sys::statvfs::statvfs).
///
/// # Arguments
Expand All @@ -680,7 +680,7 @@ pub fn statfs<P: ?Sized + NixPath>(path: &P) -> Result<Statfs> {

/// Describes a mounted file system.
///
/// The result is OS-dependent. For a portable alternative, see
/// The result is OS-dependent. For a platform portable alternative, see
/// [`fstatvfs`](crate::sys::statvfs::fstatvfs).
///
/// # Arguments
Expand Down
4 changes: 4 additions & 0 deletions src/sys/statvfs.rs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I accept the changes in statfs.rs, but I don't think the changes in this file are necessary.

What I am more interested in is refactoring the function signatures to use integer types with specified width:

fn block_size(&self) -> u64

Looks like using u64 should just work as rustix uses u64 for all the Statvfs fields, but we may still want to check the concrete integer type used by those libc alias, just in case

Copy link
Author

@ultrabear ultrabear Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it was always u64, wouldn't have had a build failure
on darwin the block_size resolves to u32

Indeed, this can be trivially widened to u64, but that abstracts from the libc struct, so depends on what the goal of the library is (not in my domain of understanding)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, this can be trivially widened to u64

Yeah, that's what I meant

Regarding this PR, do you want to merge the changes in statfs.rs? I think they are good

Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ libc_bitflags!(

/// Wrapper around the POSIX `statvfs` struct
///
/// Note that the types provided by this struct are based off of libc definitions, and as such do
/// not always resolve to the same concrete number type on different platforms. Using techniques
/// such as `u64::from` may be desirable when implementing "Rust portable" math.
///
/// For more information see the [`statvfs(3)` man pages](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_statvfs.h.html).
#[repr(transparent)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
Expand Down
Loading