Skip to content

Commit

Permalink
musl: Unify definitions of statvfs and statvfs64
Browse files Browse the repository at this point in the history
`statvfs` already exists in `musl/mod.rs`. Use that were possible and
move a common version of `statvfs64` there.

[ reduce this patch to only cover statvfs*, leaving statfs as a separate
  change - Trevor ]
  • Loading branch information
bossmc authored and tgross35 committed Nov 25, 2024
1 parent e1ff5d6 commit adcc84d
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 162 deletions.
16 changes: 0 additions & 16 deletions src/unix/linux_like/linux/musl/b32/arm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,22 +127,6 @@ s! {
pub f_spare: [::c_ulong; 4],
}

pub struct statvfs64 {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: u64,
pub f_files: u64,
pub f_ffree: u64,
pub f_favail: u64,
pub f_fsid: ::c_ulong,
__f_unused: ::c_int,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
__f_spare: [::c_int; 6],
}

pub struct mcontext_t {
pub trap_no: ::c_ulong,
pub error_code: ::c_ulong,
Expand Down
16 changes: 0 additions & 16 deletions src/unix/linux_like/linux/musl/b32/hexagon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,22 +104,6 @@ s! {
pub f_flags: ::c_ulong,
pub f_spare: [::c_ulong; 4],
}

pub struct statvfs64 {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: u64,
pub f_files: u64,
pub f_ffree: u64,
pub f_favail: u64,
pub f_fsid: ::c_ulong,
__f_unused: ::c_int,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
__f_spare: [::c_int; 6],
}
}

pub const AF_FILE: ::c_int = 1;
Expand Down
19 changes: 0 additions & 19 deletions src/unix/linux_like/linux/musl/b32/mips/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,25 +134,6 @@ s! {
pub f_flags: ::c_ulong,
pub f_spare: [::c_ulong; 5],
}

pub struct statvfs64 {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: u64,
pub f_files: u64,
pub f_ffree: u64,
pub f_favail: u64,
#[cfg(target_endian = "little")]
pub f_fsid: ::c_ulong,
__f_unused: ::c_int,
#[cfg(target_endian = "big")]
pub f_fsid: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
__f_spare: [::c_int; 6],
}
}

s_no_extra_traits! {
Expand Down
19 changes: 0 additions & 19 deletions src/unix/linux_like/linux/musl/b32/powerpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,25 +126,6 @@ s! {
pub f_flags: ::c_ulong,
pub f_spare: [::c_ulong; 4],
}

pub struct statvfs64 {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: u64,
pub f_files: u64,
pub f_ffree: u64,
pub f_favail: u64,
#[cfg(target_endian = "little")]
pub f_fsid: ::c_ulong,
__f_unused: ::c_int,
#[cfg(target_endian = "big")]
pub f_fsid: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
__f_spare: [::c_int; 6],
}
}

pub const MADV_SOFT_OFFLINE: ::c_int = 101;
Expand Down
31 changes: 0 additions & 31 deletions src/unix/linux_like/linux/musl/b32/riscv32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,6 @@ s! {
pub f_spare: [::c_long; 4],
}

pub struct statvfs {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: ::fsblkcnt_t,
pub f_bfree: ::fsblkcnt_t,
pub f_bavail: ::fsblkcnt_t,
pub f_files: ::fsfilcnt_t,
pub f_ffree: ::fsfilcnt_t,
pub f_favail: ::fsfilcnt_t,
pub f_fsid: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
pub __f_spare: [::c_int; 6],
}

pub struct statfs64 {
pub f_type: ::c_ulong,
pub f_bsize: ::c_ulong,
Expand All @@ -97,22 +82,6 @@ s! {
pub f_spare: [::c_ulong; 4],
}

pub struct statvfs64 {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: u64,
pub f_files: u64,
pub f_ffree: u64,
pub f_favail: u64,
pub f_fsid: ::c_ulong,
__f_unused: ::c_int,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
__f_spare: [::c_int; 6],
}

pub struct stack_t {
pub ss_sp: *mut ::c_void,
pub ss_flags: ::c_int,
Expand Down
16 changes: 0 additions & 16 deletions src/unix/linux_like/linux/musl/b32/x86/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,22 +130,6 @@ s! {
pub f_flags: ::c_ulong,
pub f_spare: [::c_ulong; 4],
}

pub struct statvfs64 {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: u64,
pub f_files: u64,
pub f_ffree: u64,
pub f_favail: u64,
pub f_fsid: ::c_ulong,
__f_unused: ::c_int,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
__f_spare: [::c_int; 6],
}
}

s_no_extra_traits! {
Expand Down
15 changes: 0 additions & 15 deletions src/unix/linux_like/linux/musl/b64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,6 @@ s! {
pub f_spare: [::c_ulong; 4],
}

pub struct statvfs64 {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: u64,
pub f_files: u64,
pub f_ffree: u64,
pub f_favail: u64,
pub f_fsid: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
__f_spare: [::c_int; 6],
}

pub struct msghdr {
pub msg_name: *mut ::c_void,
pub msg_namelen: ::socklen_t,
Expand Down
30 changes: 0 additions & 30 deletions src/unix/linux_like/linux/musl/b64/riscv64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,36 +89,6 @@ s! {
pub f_spare: [::c_long; 4],
}

pub struct statvfs {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: ::fsblkcnt_t,
pub f_bfree: ::fsblkcnt_t,
pub f_bavail: ::fsblkcnt_t,
pub f_files: ::fsfilcnt_t,
pub f_ffree: ::fsfilcnt_t,
pub f_favail: ::fsfilcnt_t,
pub f_fsid: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
pub __f_spare: [::c_int; 6],
}

pub struct statvfs64 {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: ::fsblkcnt64_t,
pub f_bfree: ::fsblkcnt64_t,
pub f_bavail: ::fsblkcnt64_t,
pub f_files: ::fsfilcnt64_t,
pub f_ffree: ::fsfilcnt64_t,
pub f_favail: ::fsfilcnt64_t,
pub f_fsid: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
pub __f_spare: [::c_int; 6],
}

pub struct stack_t {
pub ss_sp: *mut ::c_void,
pub ss_flags: ::c_int,
Expand Down
22 changes: 22 additions & 0 deletions src/unix/linux_like/linux/musl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ pub type shmatt_t = ::c_ulong;
pub type msgqnum_t = ::c_ulong;
pub type msglen_t = ::c_ulong;
pub type fsblkcnt_t = ::c_ulonglong;
pub type fsblkcnt64_t = ::c_ulonglong;
pub type fsfilcnt_t = ::c_ulonglong;
pub type fsfilcnt64_t = ::c_ulonglong;
pub type rlim_t = ::c_ulonglong;

cfg_if! {
Expand Down Expand Up @@ -184,6 +186,26 @@ s! {
__f_spare: [::c_int; 6],
}

pub struct statvfs64 {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: ::fsblkcnt64_t,
pub f_bfree: ::fsblkcnt64_t,
pub f_bavail: ::fsblkcnt64_t,
pub f_files: ::fsfilcnt64_t,
pub f_ffree: ::fsfilcnt64_t,
pub f_favail: ::fsfilcnt64_t,
#[cfg(target_endian = "little")]
pub f_fsid: ::c_ulong,
#[cfg(target_pointer_width = "32")]
__f_unused: ::c_int,
#[cfg(target_endian = "big")]
pub f_fsid: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
__f_spare: [::c_int; 6],
}

pub struct termios {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
Expand Down

0 comments on commit adcc84d

Please sign in to comment.