initial commit of fallocate wrapper
diff --git a/Makefile b/Makefile
new file mode 100755
index 0000000..3e8869c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,29 @@
+# Copyright 2011 Google Inc. All Rights Reserved.
+# Author: qianzhang@google.com (ken Zhang)
+#MAKEFILE for cross platform
+
+ifdef TARGET
+ CROSS_PREFIX:=$(TARGET)
+ DEBUG_CFLAGS= -O3
+else
+ CROSS_PREFIX:=
+ DEBUG_CFLAGS= -g
+endif
+
+CC:=$(CROSS_PREFIX)gcc
+LD:=$(CROSS_PREFIX)ld
+AR:=$(CROSS_PREFIX)ar
+RANLIB:=$(CROSS_PREFIX)ranlib
+STRIP:=$(CROSS_PREFIX)strip
+
+CFLAGS= -Wall -fPIC -g
+
+ALL:libfallocate.so
+SRC_FILES= fallocate64.c
+INC_FILES= fallocate64.h
+
+libfallocate.so:$(SRC_FILES) $(INC_FILES)
+ $(CC) $(CFLAGS) $(DEBUG_CFLAGS) $(SRC_FILES) -shared -o libfallocate.so
+
+clean:
+ rm -f libfallocate.so
diff --git a/fallocate64.c b/fallocate64.c
new file mode 100644
index 0000000..3496268
--- /dev/null
+++ b/fallocate64.c
@@ -0,0 +1,31 @@
+// 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;
+}
diff --git a/fallocate64.h b/fallocate64.h
new file mode 100644
index 0000000..5b7686a
--- /dev/null
+++ b/fallocate64.h
@@ -0,0 +1,6 @@
+// Copyright 2011 Google Inc. All Rights Reserved.
+// Author: qianzhang@google.com (Qian Zhang)
+
+#define _GNU_SOURCE
+int fallocate64( int fd, int mode, __off64_t offset, __off64_t len );
+