From adcc84d57dea4d63f533a12c5bcc06b16ecb4eb3 Mon Sep 17 00:00:00 2001 From: Andy Caldwell Date: Thu, 1 Jun 2023 17:52:34 +0100 Subject: [PATCH] musl: Unify definitions of statvfs and statvfs64 `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 ] --- src/unix/linux_like/linux/musl/b32/arm/mod.rs | 16 ---------- src/unix/linux_like/linux/musl/b32/hexagon.rs | 16 ---------- .../linux_like/linux/musl/b32/mips/mod.rs | 19 ------------ src/unix/linux_like/linux/musl/b32/powerpc.rs | 19 ------------ .../linux_like/linux/musl/b32/riscv32/mod.rs | 31 ------------------- src/unix/linux_like/linux/musl/b32/x86/mod.rs | 16 ---------- src/unix/linux_like/linux/musl/b64/mod.rs | 15 --------- .../linux_like/linux/musl/b64/riscv64/mod.rs | 30 ------------------ src/unix/linux_like/linux/musl/mod.rs | 22 +++++++++++++ 9 files changed, 22 insertions(+), 162 deletions(-) diff --git a/src/unix/linux_like/linux/musl/b32/arm/mod.rs b/src/unix/linux_like/linux/musl/b32/arm/mod.rs index 0d291ac0eac09..14c60f7958aa1 100644 --- a/src/unix/linux_like/linux/musl/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/arm/mod.rs @@ -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, diff --git a/src/unix/linux_like/linux/musl/b32/hexagon.rs b/src/unix/linux_like/linux/musl/b32/hexagon.rs index 1802356339d27..ec55ffb4613c6 100644 --- a/src/unix/linux_like/linux/musl/b32/hexagon.rs +++ b/src/unix/linux_like/linux/musl/b32/hexagon.rs @@ -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; diff --git a/src/unix/linux_like/linux/musl/b32/mips/mod.rs b/src/unix/linux_like/linux/musl/b32/mips/mod.rs index 04e0126cc66c7..39af8372d54e8 100644 --- a/src/unix/linux_like/linux/musl/b32/mips/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/mips/mod.rs @@ -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! { diff --git a/src/unix/linux_like/linux/musl/b32/powerpc.rs b/src/unix/linux_like/linux/musl/b32/powerpc.rs index cbb7a7b0e277f..8be5a1d0865f2 100644 --- a/src/unix/linux_like/linux/musl/b32/powerpc.rs +++ b/src/unix/linux_like/linux/musl/b32/powerpc.rs @@ -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; diff --git a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs index fe5b02acd2796..be3d9ba275e2e 100644 --- a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs @@ -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, @@ -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, diff --git a/src/unix/linux_like/linux/musl/b32/x86/mod.rs b/src/unix/linux_like/linux/musl/b32/x86/mod.rs index f448f536bbbee..0d535e950f423 100644 --- a/src/unix/linux_like/linux/musl/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/x86/mod.rs @@ -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! { diff --git a/src/unix/linux_like/linux/musl/b64/mod.rs b/src/unix/linux_like/linux/musl/b64/mod.rs index ff58b7003cbd5..4b0fb4a2b8eb3 100644 --- a/src/unix/linux_like/linux/musl/b64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/mod.rs @@ -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, diff --git a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs index 1af905701eaf8..bfd34ef1a980e 100644 --- a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs @@ -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, diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index c21fdaf04efc4..467826c92796a 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -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! { @@ -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,