Skip to content

Commit 5520ce1

Browse files
committed
drop "libc::" from largefile_fn patterns and invocations
The "::" is not accepted by newer versions of Rust.
1 parent 5ad9dab commit 5520ce1

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

src/fcntl.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ pub fn open<P: ?Sized + NixPath>(
200200
mode: Mode,
201201
) -> Result<RawFd> {
202202
let fd = path.with_nix_path(|cstr| unsafe {
203-
largefile_fn![libc::open](cstr.as_ptr(), oflag.bits(), mode.bits() as c_uint)
203+
largefile_fn![open](cstr.as_ptr(), oflag.bits(), mode.bits() as c_uint)
204204
})?;
205205

206206
Errno::result(fd)
@@ -216,7 +216,7 @@ pub fn openat<P: ?Sized + NixPath>(
216216
mode: Mode,
217217
) -> Result<RawFd> {
218218
let fd = path.with_nix_path(|cstr| unsafe {
219-
largefile_fn![libc::openat](dirfd, cstr.as_ptr(), oflag.bits(), mode.bits() as c_uint)
219+
largefile_fn![openat](dirfd, cstr.as_ptr(), oflag.bits(), mode.bits() as c_uint)
220220
})?;
221221
Errno::result(fd)
222222
}
@@ -750,7 +750,7 @@ pub fn fallocate(
750750
offset: off_t,
751751
len: off_t,
752752
) -> Result<()> {
753-
let res = unsafe { largefile_fn![libc::fallocate](fd, mode.bits(), offset, len) };
753+
let res = unsafe { largefile_fn![fallocate](fd, mode.bits(), offset, len) };
754754
Errno::result(res).map(drop)
755755
}
756756

@@ -929,7 +929,7 @@ mod posix_fadvise {
929929
advice: PosixFadviseAdvice,
930930
) -> Result<()> {
931931
let res = unsafe {
932-
largefile_fn![libc::posix_fadvise](fd, offset, len, advice as libc::c_int)
932+
largefile_fn![posix_fadvise](fd, offset, len, advice as libc::c_int)
933933
};
934934

935935
if res == 0 {
@@ -955,7 +955,7 @@ pub fn posix_fallocate(
955955
offset: off_t,
956956
len: off_t,
957957
) -> Result<()> {
958-
let res = unsafe { largefile_fn![libc::posix_fallocate](fd, offset, len) };
958+
let res = unsafe { largefile_fn![posix_fallocate](fd, offset, len) };
959959
match Errno::result(res) {
960960
Err(err) => Err(err),
961961
Ok(0) => Ok(()),

src/macros.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -341,20 +341,20 @@ cfg_if! {
341341
/// identifier of the corresponding I/O function with large file
342342
/// support.
343343
macro_rules! largefile_fn {
344-
[libc::fallocate] => (libc::fallocate64);
345-
[libc::ftruncate] => (libc::ftruncate64);
346-
[libc::lseek] => (libc::lseek64);
347-
[libc::mmap] => (libc::mmap64);
348-
[libc::open] => (libc::open64);
349-
[libc::openat] => (libc::openat64);
350-
[libc::posix_fadvise] => (libc::posix_fadvise64);
351-
[libc::posix_fallocate] => (libc::posix_fallocate64);
352-
[libc::pread] => (libc::pread64);
353-
[libc::preadv] => (libc::preadv64);
354-
[libc::pwrite] => (libc::pwrite64);
355-
[libc::pwritev] => (libc::pwritev64);
356-
[libc::sendfile] => (libc::sendfile64);
357-
[libc::truncate] => (libc::truncate64);
344+
[fallocate] => (libc::fallocate64);
345+
[ftruncate] => (libc::ftruncate64);
346+
[lseek] => (libc::lseek64);
347+
[mmap] => (libc::mmap64);
348+
[open] => (libc::open64);
349+
[openat] => (libc::openat64);
350+
[posix_fadvise] => (libc::posix_fadvise64);
351+
[posix_fallocate] => (libc::posix_fallocate64);
352+
[pread] => (libc::pread64);
353+
[preadv] => (libc::preadv64);
354+
[pwrite] => (libc::pwrite64);
355+
[pwritev] => (libc::pwritev64);
356+
[sendfile] => (libc::sendfile64);
357+
[truncate] => (libc::truncate64);
358358
}
359359
} else {
360360
/// Function variant that supports large file positions.

src/sys/mman.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ pub unsafe fn mmap<F: AsFd>(
429429
addr.map_or(std::ptr::null_mut(), |a| usize::from(a) as *mut c_void);
430430

431431
let fd = f.map(|f| f.as_fd().as_raw_fd()).unwrap_or(-1);
432-
let ret = largefile_fn![libc::mmap](
432+
let ret = largefile_fn![mmap](
433433
ptr, length.into(),
434434
prot.bits(),
435435
flags.bits(),

src/sys/sendfile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub fn sendfile<F1: AsFd, F2: AsFd>(
3434
.map(|offset| offset as *mut _)
3535
.unwrap_or(ptr::null_mut());
3636
let ret = unsafe {
37-
largefile_fn![libc::sendfile](
37+
largefile_fn![sendfile](
3838
out_fd.as_fd().as_raw_fd(),
3939
in_fd.as_fd().as_raw_fd(),
4040
offset,

src/sys/uio.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub fn pwritev<Fd: AsFd>(fd: Fd, iov: &[IoSlice<'_>], offset: off_t) -> Result<u
5151

5252
// SAFETY: same as in writev()
5353
let res = unsafe {
54-
largefile_fn![libc::pwritev](
54+
largefile_fn![pwritev](
5555
fd.as_fd().as_raw_fd(),
5656
iov.as_ptr() as *const libc::iovec,
5757
iov.len() as c_int,
@@ -81,7 +81,7 @@ pub fn preadv<Fd: AsFd>(
8181

8282
// SAFETY: same as in readv()
8383
let res = unsafe {
84-
largefile_fn![libc::preadv](
84+
largefile_fn![preadv](
8585
fd.as_fd().as_raw_fd(),
8686
iov.as_ptr() as *const libc::iovec,
8787
iov.len() as c_int,
@@ -98,7 +98,7 @@ pub fn preadv<Fd: AsFd>(
9898
// TODO: move to unistd
9999
pub fn pwrite<Fd: AsFd>(fd: Fd, buf: &[u8], offset: off_t) -> Result<usize> {
100100
let res = unsafe {
101-
largefile_fn![libc::pwrite](
101+
largefile_fn![pwrite](
102102
fd.as_fd().as_raw_fd(),
103103
buf.as_ptr() as *const c_void,
104104
buf.len() as size_t,
@@ -115,7 +115,7 @@ pub fn pwrite<Fd: AsFd>(fd: Fd, buf: &[u8], offset: off_t) -> Result<usize> {
115115
// TODO: move to unistd
116116
pub fn pread<Fd: AsFd>(fd: Fd, buf: &mut [u8], offset: off_t) -> Result<usize> {
117117
let res = unsafe {
118-
largefile_fn![libc::pread](
118+
largefile_fn![pread](
119119
fd.as_fd().as_raw_fd(),
120120
buf.as_mut_ptr() as *mut c_void,
121121
buf.len() as size_t,

src/unistd.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ pub enum Whence {
11691169
///
11701170
/// See also [lseek(2)](https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html)
11711171
pub fn lseek(fd: RawFd, offset: off_t, whence: Whence) -> Result<off_t> {
1172-
let res = unsafe { largefile_fn![libc::lseek](fd, offset, whence as i32) };
1172+
let res = unsafe { largefile_fn![lseek](fd, offset, whence as i32) };
11731173

11741174
Errno::result(res).map(|r| r as off_t)
11751175
}
@@ -1249,7 +1249,7 @@ pub fn pipe2(flags: OFlag) -> Result<(RawFd, RawFd)> {
12491249
pub fn truncate<P: ?Sized + NixPath>(path: &P, len: off_t) -> Result<()> {
12501250
let res = path
12511251
.with_nix_path(|cstr| unsafe {
1252-
largefile_fn![libc::truncate](cstr.as_ptr(), len)
1252+
largefile_fn![truncate](cstr.as_ptr(), len)
12531253
})?;
12541254

12551255
Errno::result(res).map(drop)
@@ -1261,7 +1261,7 @@ pub fn truncate<P: ?Sized + NixPath>(path: &P, len: off_t) -> Result<()> {
12611261
/// [ftruncate(2)](https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html)
12621262
pub fn ftruncate<Fd: AsFd>(fd: Fd, len: off_t) -> Result<()> {
12631263
Errno::result(unsafe {
1264-
largefile_fn![libc::ftruncate](fd.as_fd().as_raw_fd(), len)
1264+
largefile_fn![ftruncate](fd.as_fd().as_raw_fd(), len)
12651265
}).map(drop)
12661266
}
12671267

0 commit comments

Comments
 (0)