diff options
author | Daniel Verkamp <dverkamp@chromium.org> | 2018-11-28 09:39:27 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-11-30 12:53:08 -0800 |
commit | 9ae286d008fd1c2a5b7f25f4184529fe6b5f169d (patch) | |
tree | efe37c2517f17ec41f2fe0e19fdf676c771c1cde /sys_util | |
parent | 510c1cfb46846a084a6316476602a658573ed93e (diff) | |
download | crosvm-9ae286d008fd1c2a5b7f25f4184529fe6b5f169d.tar crosvm-9ae286d008fd1c2a5b7f25f4184529fe6b5f169d.tar.gz crosvm-9ae286d008fd1c2a5b7f25f4184529fe6b5f169d.tar.bz2 crosvm-9ae286d008fd1c2a5b7f25f4184529fe6b5f169d.tar.lz crosvm-9ae286d008fd1c2a5b7f25f4184529fe6b5f169d.tar.xz crosvm-9ae286d008fd1c2a5b7f25f4184529fe6b5f169d.tar.zst crosvm-9ae286d008fd1c2a5b7f25f4184529fe6b5f169d.zip |
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 <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1352866 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Stephen Barber <smbarber@chromium.org>
Diffstat (limited to 'sys_util')
-rw-r--r-- | sys_util/src/lib.rs | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/sys_util/src/lib.rs b/sys_util/src/lib.rs index 63d1a21..25b6ed0 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 { |