Skip to content

Commit e46fca9

Browse files
committed
linux(musl): deprecate lfs64 bindings
Deprecates all suffixed types and routines. They are equivalent in musl. The target matters not.
1 parent f24764d commit e46fca9

18 files changed

Lines changed: 112 additions & 29 deletions

File tree

src/unix/linux_like/linux/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ pub type dev_t = u64;
1818
pub type socklen_t = u32;
1919
pub type mode_t = u32;
2020
pub type ino64_t = u64;
21+
#[cfg_attr(
22+
any(target_env = "musl", target_env = "ohos"),
23+
deprecated(
24+
since = "0.2.187",
25+
note = "Use `off_t` instead. This type is `#define`d as an alias to `off_t` in upstream \
26+
musl and support for the suffixed variants is phasing out in `libc`."
27+
)
28+
)]
2129
pub type off64_t = i64;
2230
pub type blkcnt64_t = i64;
2331
pub type rlim64_t = u64;
@@ -3479,7 +3487,10 @@ extern "C" {
34793487
pub fn fallocate(fd: c_int, mode: c_int, offset: off_t, len: off_t) -> c_int;
34803488
#[cfg_attr(gnu_file_offset_bits64, link_name = "posix_fallocate64")]
34813489
pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int;
3490+
#[cfg(not(any(target_env = "musl", target_env = "ohos")))]
34823491
pub fn readahead(fd: c_int, offset: off64_t, count: size_t) -> ssize_t;
3492+
#[cfg(any(target_env = "musl", target_env = "ohos"))]
3493+
pub fn readahead(fd: c_int, offset: off_t, count: size_t) -> ssize_t;
34833494
pub fn getxattr(
34843495
path: *const c_char,
34853496
name: *const c_char,
@@ -3567,7 +3578,10 @@ extern "C" {
35673578

35683579
// Not available now on Android
35693580
pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
3581+
#[cfg(not(any(target_env = "musl", target_env = "ohos")))]
35703582
pub fn sync_file_range(fd: c_int, offset: off64_t, nbytes: off64_t, flags: c_uint) -> c_int;
3583+
#[cfg(any(target_env = "musl", target_env = "ohos"))]
3584+
pub fn sync_file_range(fd: c_int, offset: off_t, nbytes: off_t, flags: c_uint) -> c_int;
35713585

35723586
pub fn posix_madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int;
35733587

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ use crate::prelude::*;
33

44
pub type wchar_t = u32;
55

6-
pub type stat64 = stat;
7-
86
s! {
97
pub struct stat {
108
pub st_dev: crate::dev_t,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::prelude::*;
22

33
pub type wchar_t = u32;
4-
pub type stat64 = crate::stat;
54

65
s! {
76
pub struct stat {

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ use crate::prelude::*;
33

44
pub type wchar_t = c_int;
55

6-
pub type stat64 = stat;
7-
86
s! {
97
pub struct stat {
108
pub st_dev: crate::dev_t,
@@ -140,6 +138,11 @@ s! {
140138
pub f_spare: [c_ulong; 5],
141139
}
142140

141+
#[deprecated(
142+
since = "0.2.187",
143+
note = "Use `statfs` instead. This type is defined as an alias to the unsuffixed type \
144+
upstream, and support for suffixed types is phasing out in the `libc` crate."
145+
)]
143146
pub struct statfs64 {
144147
pub f_type: c_ulong,
145148
pub f_bsize: c_ulong,

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ use crate::prelude::*;
33

44
pub type wchar_t = i32;
55

6-
pub type stat64 = stat;
7-
86
s! {
97
pub struct termios {
108
pub c_iflag: crate::tcflag_t,

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ use crate::prelude::*;
55

66
pub type wchar_t = c_int;
77

8-
pub type stat64 = stat;
9-
108
s! {
119
pub struct stat {
1210
pub st_dev: crate::dev_t,

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ use crate::prelude::*;
33

44
pub type wchar_t = i32;
55

6-
pub type stat64 = stat;
7-
86
s! {
97
pub struct stat {
108
pub st_dev: crate::dev_t,

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ pub type wchar_t = u32;
55
pub type nlink_t = u32;
66
pub type blksize_t = c_int;
77

8-
pub type stat64 = stat;
9-
108
s! {
119
pub struct stat {
1210
pub st_dev: crate::dev_t,

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ pub type wchar_t = c_int;
88
pub type nlink_t = c_uint;
99
pub type blksize_t = c_int;
1010

11-
pub type stat64 = stat;
12-
1311
s! {
1412
pub struct stat {
1513
pub st_dev: crate::dev_t,

src/unix/linux_like/linux/musl/b64/mips64.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ pub type wchar_t = i32;
55
pub type nlink_t = c_uint;
66
pub type blksize_t = i64;
77

8-
pub type stat64 = stat;
9-
108
s! {
119
pub struct stat {
1210
pub st_dev: crate::dev_t,
@@ -89,6 +87,11 @@ s! {
8987
pub f_spare: [c_ulong; 5],
9088
}
9189

90+
#[deprecated(
91+
since = "0.2.187",
92+
note = "Use `statfs` instead. This type is defined as an alias to the unsuffixed type \
93+
upstream, and support for suffixed types is phasing out in the `libc` crate."
94+
)]
9295
pub struct statfs64 {
9396
pub f_type: c_ulong,
9497
pub f_bsize: c_ulong,

0 commit comments

Comments
 (0)