From 9ae286d008fd1c2a5b7f25f4184529fe6b5f169d Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Wed, 28 Nov 2018 09:39:27 -0800 Subject: [PATCH] sys_util: replace fallocate64 with libc call Now that libc includes the fallocate64 function declaration that we need, we can drop our own declaration and resolve the TODOs. BUG=None TEST=cargo build Change-Id: I7548a561d672739fa7cdd7eb996ad2b2e307d69a Signed-off-by: Daniel Verkamp Reviewed-on: https://chromium-review.googlesource.com/1352866 Commit-Ready: ChromeOS CL Exonerator Bot Reviewed-by: Stephen Barber --- sys_util/src/lib.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/sys_util/src/lib.rs b/sys_util/src/lib.rs index 63d1a21939..25b6ed07c8 100644 --- a/sys_util/src/lib.rs +++ b/sys_util/src/lib.rs @@ -165,16 +165,6 @@ pub enum FallocateMode { ZeroRange, } -// TODO(dverkamp): Remove this once fallocate64 is available in libc. -extern "C" { - pub fn fallocate64( - fd: libc::c_int, - mode: libc::c_int, - offset: libc::off64_t, - len: libc::off64_t, - ) -> libc::c_int; -} - /// Safe wrapper for `fallocate()`. pub fn fallocate( file: &AsRawFd, @@ -206,8 +196,7 @@ pub fn fallocate( // Safe since we pass in a valid fd and fallocate mode, validate offset and len, // and check the return value. - // TODO(dverkamp): Replace this with libc::fallocate64 once it is available. - let ret = unsafe { fallocate64(file.as_raw_fd(), mode, offset, len) }; + let ret = unsafe { libc::fallocate64(file.as_raw_fd(), mode, offset, len) }; if ret < 0 { errno_result() } else {