linux/fd.h
linux/major.h
linux/loop.h
+ linux/types.h
net/if_dl.h
netinet/in.h
sys/acl.h
fallocate
fallocate64
fchown
+ fcntl
fdatasync
fstat64
+ fsync
ftruncate64
futimes
getcwd
#ifndef _LINUX_TYPES_H
#define _LINUX_TYPES_H
-#ifndef _MSC_VER
-#error _MSC_VER not defined
-#endif
+//#ifndef _MSC_VER
+//#error _MSC_VER not defined
+//#endif
+#include <sys/types.h>
typedef unsigned __int8 __u8;
typedef signed __int8 __s8;
typedef unsigned __int64 __u64;
-typedef __u32 ino_t;
+//typedef __u32 ino_t;
+typedef __u32 dev_t;
+typedef __u32 uid_t;
+typedef __u32 gid_t;
+#include <stdint.h>
#endif /* LINUX_TYPES_H */
LOCAL_CFLAGS := $(libext2_com_err_cflags)
LOCAL_MODULE := libext2_com_err-host
LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_HOST_OS := darwin linux windows
include $(BUILD_HOST_SHARED_LIBRARY)
LOCAL_CFLAGS := $(libext2_com_err_cflags)
LOCAL_MODULE := libext2_com_err-host
LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_HOST_OS := darwin linux windows
include $(BUILD_HOST_STATIC_LIBRARY)
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
+#if HAVE_FCNTL
#include <fcntl.h>
+#endif
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
*/
static char *safe_getenv(const char *arg)
{
+#if !defined(_WIN32)
if ((getuid() != geteuid()) || (getgid() != getegid()))
return NULL;
+#endif
#if HAVE_PRCTL
if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0)
return NULL;
debug_f = fopen("/dev/tty", "a");
if (debug_f) {
fd = fileno(debug_f);
+#if defined(HAVE_FCNTL)
if (fd >= 0) {
flags = fcntl(fd, F_GETFD);
if (flags >= 0)
fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
}
+#endif
} else
debug_mask = DEBUG_INIT;
libext2fs_shared_libraries := \
libext2_com_err \
- libext2_uuid \
- libext2_blkid \
- libext2_e2p
+ libext2_uuid
libext2fs_system_shared_libraries := libc
libext2fs_static_libraries := \
libext2_com_err \
- libext2_uuid_static \
- libext2_blkid \
- libext2_e2p
+ libext2_uuid_static
libext2fs_system_static_libraries := libc
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(libext2fs_src_files)
-LOCAL_SHARED_LIBRARIES := $(addsuffix -host, $(libext2fs_shared_libraries))
+LOCAL_WHOLE_STATIC_LIBRARIES := libext2_com_err-host
LOCAL_STATIC_LIBRARIES := libsparse_host libz
LOCAL_C_INCLUDES := $(libext2fs_c_includes)
LOCAL_EXPORT_C_INCLUDE_DIRS := $(libext2fs_c_includes)
LOCAL_CFLAGS := $(libext2fs_cflags)
LOCAL_MODULE := libext2fs-host
LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_HOST_OS := darwin linux windows
+LOCAL_CFLAGS_windows := -isystem external/e2fsprogs/include/nonunix -Wno-format
+LOCAL_LDLIBS_windows := -lws2_32
include $(BUILD_HOST_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(libext2fs_src_files)
-LOCAL_STATIC_LIBRARIES := $(addsuffix -host, $(libext2fs_shared_libraries))
+LOCAL_WHOLE_STATIC_LIBRARIES := libext2_com_err-host
LOCAL_STATIC_LIBRARIES := libsparse_host libz
LOCAL_C_INCLUDES := $(libext2fs_c_includes)
LOCAL_EXPORT_C_INCLUDE_DIRS := $(libext2fs_c_includes)
LOCAL_CFLAGS := $(libext2fs_cflags) $(libext2fs_cflags_linux)
LOCAL_MODULE := libext2fs-host
LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_HOST_OS := darwin linux windows
+LOCAL_CFLAGS_windows := -isystem external/e2fsprogs/include/nonunix -Wno-format
+LOCAL_LDLIBS_windows := -lws2_32
include $(BUILD_HOST_STATIC_LIBRARY)
* %End-Header%
*/
+#include "config.h"
#include <stdio.h>
#include <string.h>
#if HAVE_UNISTD_H
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
+#if HAVE_LINUX_TYPES_H
+#include <linux/types.h>
+#endif
#include "ext2_fs.h"
#include "ext2fsP.h"
* still is a race condition for those kernels, but this
* reduces it greatly.)
*/
+#if defined(HAVE_FSYNC)
if (fsync (fd) == -1)
return errno;
+#endif
if (flushb) {
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
+#ifdef HAVE_WINSOCK_H
+#include <winsock.h>
+#else
#include <arpa/inet.h>
+#endif
#define printk printf
#define KERN_ERR ""
static char *safe_getenv(const char *arg)
{
+#if !defined(_WIN32)
if ((getuid() != geteuid()) || (getgid() != getegid()))
return NULL;
+#endif
#if HAVE_PRCTL
if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0)
return NULL;
int fd_flags;
fd = atoi(str_fd);
+#if defined(HAVE_FCNTL)
fd_flags = fcntl(fd, F_GETFD);
if (fd_flags == -1)
return -EBADF;
if (fd_flags & O_DIRECT)
flags |= IO_FLAG_DIRECT_IO;
#endif
+#endif /* HAVE_FCNTL */
return unix_open_channel(str_fd, fd, flags, channel, unixfd_io_manager);
}
#ifndef NO_IO_CACHE
retval = flush_cached_blocks(channel, data, 0);
#endif
+#ifdef HAVE_FSYNC
if (!retval && fsync(data->dev) != 0)
return errno;
+#endif
return retval;
}
#define DISABLE_BACKTRACE 1
#define HAVE_DIRENT_H 1
#define HAVE_ERRNO_H 1
-#define HAVE_EXT2_IOCTLS 1
-#define HAVE_FALLOCATE 1
#define HAVE_GETOPT_H 1
-#define HAVE_GETPAGESIZE 1
#define HAVE_GETPWUID_R 1
#define HAVE_INTPTR_T 1
#define HAVE_INTTYPES_H 1
-#ifdef __linux__
-#define HAVE_LINUX_FD_H 1
-#define HAVE_LSEEK64 1
-#define HAVE_LSEEK64_PROTOTYPE 1
-#endif
#define HAVE_MMAP 1
-#ifdef __linux__
-#define HAVE_MNTENT_H 1
-#endif
-#define HAVE_NETINET_IN_H 1
-#define HAVE_NET_IF_H 1
-#define HAVE_POSIX_MEMALIGN 1
-#define HAVE_PREAD 1
-#ifdef __linux__
-#define HAVE_PREAD64 1
-#endif
-#define HAVE_PWRITE 1
-#ifdef __linux__
-#define HAVE_PWRITE64 1
-#endif
#define HAVE_SETJMP_H 1
#ifdef __linux__
#define HAVE_SETMNTENT 1
#define HAVE_STRNLEN 1
#define HAVE_STRPTIME 1
#define HAVE_SYSCONF 1
-#define HAVE_SYS_IOCTL_H 1
-#define HAVE_SYS_MMAN_H 1
-#define HAVE_SYS_MOUNT_H 1
-#define HAVE_SYS_PARAM_H 1
-#ifdef __linux__
-#define HAVE_SYS_PRCTL_H 1
-#endif
-#define HAVE_SYS_RESOURCE_H 1
-#define HAVE_SYS_SELECT_H 1
-#define HAVE_SYS_STAT_H 1
-#define HAVE_SYS_TIME_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_SYS_WAIT_H 1
#define HAVE_TYPE_SSIZE_T 1
#define HAVE_UNISTD_H 1
#define HAVE_UTIME_H 1
+
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TYPES_H 1
+
+#if defined(_WIN32)
+# define HAVE_LINUX_TYPES_H 1
+# define HAVE_WINSOCK_H 1
+#endif
+#if defined(__APPLE__) || defined(__linux__)
+# define HAVE_FCNTL 1
+# define HAVE_FSYNC 1
+# define HAVE_GETPAGESIZE 1
+# define HAVE_NET_IF_H 1
+# define HAVE_NETINET_IN_H 1
+# define HAVE_PREAD 1
+# define HAVE_PWRITE 1
+# define HAVE_POSIX_MEMALIGN 1
+# define HAVE_SYS_IOCTL_H 1
+# define HAVE_SYS_MMAN_H 1
+# define HAVE_SYS_MOUNT_H 1
+# define HAVE_SYS_PARAM_H 1
+# define HAVE_SYS_RESOURCE_H 1
+# define HAVE_SYS_SELECT_H 1
+# define HAVE_SYS_WAIT_H 1
+#endif
+#if defined(__linux__)
+# define HAVE_EXT2_IOCTLS 1
+# define HAVE_FALLOCATE 1
+# define HAVE_LINUX_FD_H 1
+# define HAVE_LINUX_TYPES_H 1
+# define HAVE_LSEEK64 1
+# define HAVE_LSEEK64_PROTOTYPE 1
+# define HAVE_PREAD64 1
+# define HAVE_PWRITE64 1
+# define HAVE_SYS_PRCTL_H 1
+#endif