Skip to content

Commit 0300828

Browse files
bossmctgross35
authored andcommittedNov 25, 2024
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 ] (backport <rust-lang#3261>) (cherry picked from commit adcc84d)
1 parent 8189016 commit 0300828

File tree

9 files changed

+22
-162
lines changed

9 files changed

+22
-162
lines changed
 

‎src/unix/linux_like/linux/musl/b32/arm/mod.rs

-16
Original file line numberDiff line numberDiff line change
@@ -127,22 +127,6 @@ s! {
127127
pub f_spare: [::c_ulong; 4],
128128
}
129129

130-
pub struct statvfs64 {
131-
pub f_bsize: ::c_ulong,
132-
pub f_frsize: ::c_ulong,
133-
pub f_blocks: u64,
134-
pub f_bfree: u64,
135-
pub f_bavail: u64,
136-
pub f_files: u64,
137-
pub f_ffree: u64,
138-
pub f_favail: u64,
139-
pub f_fsid: ::c_ulong,
140-
__f_unused: ::c_int,
141-
pub f_flag: ::c_ulong,
142-
pub f_namemax: ::c_ulong,
143-
__f_spare: [::c_int; 6],
144-
}
145-
146130
pub struct mcontext_t {
147131
pub trap_no: ::c_ulong,
148132
pub error_code: ::c_ulong,

‎src/unix/linux_like/linux/musl/b32/hexagon.rs

-16
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,6 @@ s! {
104104
pub f_flags: ::c_ulong,
105105
pub f_spare: [::c_ulong; 4],
106106
}
107-
108-
pub struct statvfs64 {
109-
pub f_bsize: ::c_ulong,
110-
pub f_frsize: ::c_ulong,
111-
pub f_blocks: u64,
112-
pub f_bfree: u64,
113-
pub f_bavail: u64,
114-
pub f_files: u64,
115-
pub f_ffree: u64,
116-
pub f_favail: u64,
117-
pub f_fsid: ::c_ulong,
118-
__f_unused: ::c_int,
119-
pub f_flag: ::c_ulong,
120-
pub f_namemax: ::c_ulong,
121-
__f_spare: [::c_int; 6],
122-
}
123107
}
124108

125109
pub const AF_FILE: ::c_int = 1;

‎src/unix/linux_like/linux/musl/b32/mips/mod.rs

-19
Original file line numberDiff line numberDiff line change
@@ -134,25 +134,6 @@ s! {
134134
pub f_flags: ::c_ulong,
135135
pub f_spare: [::c_ulong; 5],
136136
}
137-
138-
pub struct statvfs64 {
139-
pub f_bsize: ::c_ulong,
140-
pub f_frsize: ::c_ulong,
141-
pub f_blocks: u64,
142-
pub f_bfree: u64,
143-
pub f_bavail: u64,
144-
pub f_files: u64,
145-
pub f_ffree: u64,
146-
pub f_favail: u64,
147-
#[cfg(target_endian = "little")]
148-
pub f_fsid: ::c_ulong,
149-
__f_unused: ::c_int,
150-
#[cfg(target_endian = "big")]
151-
pub f_fsid: ::c_ulong,
152-
pub f_flag: ::c_ulong,
153-
pub f_namemax: ::c_ulong,
154-
__f_spare: [::c_int; 6],
155-
}
156137
}
157138

158139
s_no_extra_traits! {

‎src/unix/linux_like/linux/musl/b32/powerpc.rs

-19
Original file line numberDiff line numberDiff line change
@@ -126,25 +126,6 @@ s! {
126126
pub f_flags: ::c_ulong,
127127
pub f_spare: [::c_ulong; 4],
128128
}
129-
130-
pub struct statvfs64 {
131-
pub f_bsize: ::c_ulong,
132-
pub f_frsize: ::c_ulong,
133-
pub f_blocks: u64,
134-
pub f_bfree: u64,
135-
pub f_bavail: u64,
136-
pub f_files: u64,
137-
pub f_ffree: u64,
138-
pub f_favail: u64,
139-
#[cfg(target_endian = "little")]
140-
pub f_fsid: ::c_ulong,
141-
__f_unused: ::c_int,
142-
#[cfg(target_endian = "big")]
143-
pub f_fsid: ::c_ulong,
144-
pub f_flag: ::c_ulong,
145-
pub f_namemax: ::c_ulong,
146-
__f_spare: [::c_int; 6],
147-
}
148129
}
149130

150131
pub const MADV_SOFT_OFFLINE: ::c_int = 101;

‎src/unix/linux_like/linux/musl/b32/riscv32/mod.rs

-31
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,6 @@ s! {
6767
pub f_spare: [::c_long; 4],
6868
}
6969

70-
pub struct statvfs {
71-
pub f_bsize: ::c_ulong,
72-
pub f_frsize: ::c_ulong,
73-
pub f_blocks: ::fsblkcnt_t,
74-
pub f_bfree: ::fsblkcnt_t,
75-
pub f_bavail: ::fsblkcnt_t,
76-
pub f_files: ::fsfilcnt_t,
77-
pub f_ffree: ::fsfilcnt_t,
78-
pub f_favail: ::fsfilcnt_t,
79-
pub f_fsid: ::c_ulong,
80-
pub f_flag: ::c_ulong,
81-
pub f_namemax: ::c_ulong,
82-
pub __f_spare: [::c_int; 6],
83-
}
84-
8570
pub struct statfs64 {
8671
pub f_type: ::c_ulong,
8772
pub f_bsize: ::c_ulong,
@@ -97,22 +82,6 @@ s! {
9782
pub f_spare: [::c_ulong; 4],
9883
}
9984

100-
pub struct statvfs64 {
101-
pub f_bsize: ::c_ulong,
102-
pub f_frsize: ::c_ulong,
103-
pub f_blocks: u64,
104-
pub f_bfree: u64,
105-
pub f_bavail: u64,
106-
pub f_files: u64,
107-
pub f_ffree: u64,
108-
pub f_favail: u64,
109-
pub f_fsid: ::c_ulong,
110-
__f_unused: ::c_int,
111-
pub f_flag: ::c_ulong,
112-
pub f_namemax: ::c_ulong,
113-
__f_spare: [::c_int; 6],
114-
}
115-
11685
pub struct stack_t {
11786
pub ss_sp: *mut ::c_void,
11887
pub ss_flags: ::c_int,

‎src/unix/linux_like/linux/musl/b32/x86/mod.rs

-16
Original file line numberDiff line numberDiff line change
@@ -130,22 +130,6 @@ s! {
130130
pub f_flags: ::c_ulong,
131131
pub f_spare: [::c_ulong; 4],
132132
}
133-
134-
pub struct statvfs64 {
135-
pub f_bsize: ::c_ulong,
136-
pub f_frsize: ::c_ulong,
137-
pub f_blocks: u64,
138-
pub f_bfree: u64,
139-
pub f_bavail: u64,
140-
pub f_files: u64,
141-
pub f_ffree: u64,
142-
pub f_favail: u64,
143-
pub f_fsid: ::c_ulong,
144-
__f_unused: ::c_int,
145-
pub f_flag: ::c_ulong,
146-
pub f_namemax: ::c_ulong,
147-
__f_spare: [::c_int; 6],
148-
}
149133
}
150134

151135
s_no_extra_traits! {

‎src/unix/linux_like/linux/musl/b64/mod.rs

-15
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,6 @@ s! {
7474
pub f_spare: [::c_ulong; 4],
7575
}
7676

77-
pub struct statvfs64 {
78-
pub f_bsize: ::c_ulong,
79-
pub f_frsize: ::c_ulong,
80-
pub f_blocks: u64,
81-
pub f_bfree: u64,
82-
pub f_bavail: u64,
83-
pub f_files: u64,
84-
pub f_ffree: u64,
85-
pub f_favail: u64,
86-
pub f_fsid: ::c_ulong,
87-
pub f_flag: ::c_ulong,
88-
pub f_namemax: ::c_ulong,
89-
__f_spare: [::c_int; 6],
90-
}
91-
9277
pub struct msghdr {
9378
pub msg_name: *mut ::c_void,
9479
pub msg_namelen: ::socklen_t,

‎src/unix/linux_like/linux/musl/b64/riscv64/mod.rs

-30
Original file line numberDiff line numberDiff line change
@@ -89,36 +89,6 @@ s! {
8989
pub f_spare: [::c_long; 4],
9090
}
9191

92-
pub struct statvfs {
93-
pub f_bsize: ::c_ulong,
94-
pub f_frsize: ::c_ulong,
95-
pub f_blocks: ::fsblkcnt_t,
96-
pub f_bfree: ::fsblkcnt_t,
97-
pub f_bavail: ::fsblkcnt_t,
98-
pub f_files: ::fsfilcnt_t,
99-
pub f_ffree: ::fsfilcnt_t,
100-
pub f_favail: ::fsfilcnt_t,
101-
pub f_fsid: ::c_ulong,
102-
pub f_flag: ::c_ulong,
103-
pub f_namemax: ::c_ulong,
104-
pub __f_spare: [::c_int; 6],
105-
}
106-
107-
pub struct statvfs64 {
108-
pub f_bsize: ::c_ulong,
109-
pub f_frsize: ::c_ulong,
110-
pub f_blocks: ::fsblkcnt64_t,
111-
pub f_bfree: ::fsblkcnt64_t,
112-
pub f_bavail: ::fsblkcnt64_t,
113-
pub f_files: ::fsfilcnt64_t,
114-
pub f_ffree: ::fsfilcnt64_t,
115-
pub f_favail: ::fsfilcnt64_t,
116-
pub f_fsid: ::c_ulong,
117-
pub f_flag: ::c_ulong,
118-
pub f_namemax: ::c_ulong,
119-
pub __f_spare: [::c_int; 6],
120-
}
121-
12292
pub struct stack_t {
12393
pub ss_sp: *mut ::c_void,
12494
pub ss_flags: ::c_int,

‎src/unix/linux_like/linux/musl/mod.rs

+22
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ pub type shmatt_t = ::c_ulong;
1919
pub type msgqnum_t = ::c_ulong;
2020
pub type msglen_t = ::c_ulong;
2121
pub type fsblkcnt_t = ::c_ulonglong;
22+
pub type fsblkcnt64_t = ::c_ulonglong;
2223
pub type fsfilcnt_t = ::c_ulonglong;
24+
pub type fsfilcnt64_t = ::c_ulonglong;
2325
pub type rlim_t = ::c_ulonglong;
2426

2527
cfg_if! {
@@ -184,6 +186,26 @@ s! {
184186
__f_spare: [::c_int; 6],
185187
}
186188

189+
pub struct statvfs64 {
190+
pub f_bsize: ::c_ulong,
191+
pub f_frsize: ::c_ulong,
192+
pub f_blocks: ::fsblkcnt64_t,
193+
pub f_bfree: ::fsblkcnt64_t,
194+
pub f_bavail: ::fsblkcnt64_t,
195+
pub f_files: ::fsfilcnt64_t,
196+
pub f_ffree: ::fsfilcnt64_t,
197+
pub f_favail: ::fsfilcnt64_t,
198+
#[cfg(target_endian = "little")]
199+
pub f_fsid: ::c_ulong,
200+
#[cfg(target_pointer_width = "32")]
201+
__f_unused: ::c_int,
202+
#[cfg(target_endian = "big")]
203+
pub f_fsid: ::c_ulong,
204+
pub f_flag: ::c_ulong,
205+
pub f_namemax: ::c_ulong,
206+
__f_spare: [::c_int; 6],
207+
}
208+
187209
pub struct termios {
188210
pub c_iflag: ::tcflag_t,
189211
pub c_oflag: ::tcflag_t,

0 commit comments

Comments
 (0)