blob: 3496268aa8c76f3ed837cd7d699df5f32bf7177f [file] [log] [blame]
// Copyright 2011 Google Inc. All Rights Reserved.
// Author: qianzhang@google.com (Qian Zhang)
#define _GNU_SOURCE
#include <linux/falloc.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <inttypes.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
//mipsel-linux-gcc glibc hasn't imported fallocate api to support ext4 fallocate,
//we implment the API for the project for now.
int fallocate64( int fd, int mode, __off64_t offset, __off64_t len )
{
int result;
#ifdef __LP64__
result = syscall( SYS_fallocate, fd, mode, offset, len );
#else
result = syscall( SYS_fallocate, fd, mode,
__LONG_LONG_PAIR((uint32_t)(offset >> 32), (uint32_t)offset),
__LONG_LONG_PAIR((uint32_t)(len >> 32), (uint32_t)len));
#endif
return result;
}