aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-08-02 07:26:23 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-08-02 07:26:23 +0000
commitb33ead9838f0ab6eedbf98ab04faef80cd024722 (patch)
treeb460a4c4b2da743e6ed169a8eee57b089d4b9c43
parentf687d5c2a49703298b8432aae67777d95e08801d (diff)
parent9f3b79acf7ecdabc9c3ca728894f2e18515000d2 (diff)
downloade2fsprogs-b33ead9838f0ab6eedbf98ab04faef80cd024722.tar.gz
Change-Id: I6c638965e7a19c3860aa08ad67ca2084176f0507
-rw-r--r--contrib/android/Android.bp37
-rw-r--r--contrib/android/e2fsdroid.c12
-rw-r--r--include/mingw/grp.h16
-rw-r--r--include/mingw/linux/types.h33
-rw-r--r--include/mingw/pwd.h20
-rw-r--r--include/mingw/sys/stat.h20
-rw-r--r--include/mingw/sys/sysmacros.h11
-rw-r--r--include/mingw/sys/types.h9
-rw-r--r--include/mingw/unistd.h13
-rw-r--r--lib/blkid/Android.bp11
-rw-r--r--lib/blkid/list.h2
-rw-r--r--lib/blkid/save.c8
-rw-r--r--lib/config.h1
-rw-r--r--lib/e2p/Android.bp7
-rw-r--r--lib/e2p/fgetversion.c2
-rw-r--r--lib/e2p/fsetversion.c2
-rw-r--r--lib/e2p/getversion.c2
-rw-r--r--lib/e2p/setversion.c2
-rw-r--r--lib/ext2fs/Android.bp9
-rw-r--r--lib/ext2fs/initialize.c5
-rw-r--r--lib/ext2fs/sparse_io.c10
-rw-r--r--lib/support/Android.bp7
-rw-r--r--lib/uuid/Android.bp7
-rw-r--r--lib/uuid/gen_uuid.c15
-rw-r--r--misc/Android.bp54
-rw-r--r--misc/create_inode.c9
-rw-r--r--misc/mk_hugefiles.c2
-rw-r--r--misc/mke2fs.c11
28 files changed, 294 insertions, 43 deletions
diff --git a/contrib/android/Android.bp b/contrib/android/Android.bp
index afa335e0..18d38501 100644
--- a/contrib/android/Android.bp
+++ b/contrib/android/Android.bp
@@ -18,15 +18,34 @@ cc_binary {
"hashmap.c",
],
cflags: ["-W", "-Wall"],
- shared_libs: [
- "libext2fs",
- "libext2_com_err",
- "libext2_misc",
- "libcutils",
- "libbase",
- "libselinux",
- "libcrypto",
- ],
+ target: {
+ host: {
+ static_libs: [
+ "libext2_com_err",
+ "libext2_misc",
+ "libext2fs",
+ "libsparse",
+ "libz",
+ "libcutils",
+ "libbase",
+ "libselinux",
+ "libcrypto",
+ "liblog",
+ ],
+ },
+ android: {
+ shared_libs: [
+ "libext2fs",
+ "libext2_com_err",
+ "libext2_misc",
+ "libcutils",
+ "libbase",
+ "libselinux",
+ "libcrypto",
+ ],
+ },
+ },
+ stl: "libc++_static",
}
//##########################################################################
diff --git a/contrib/android/e2fsdroid.c b/contrib/android/e2fsdroid.c
index 1ae133d5..223ea687 100644
--- a/contrib/android/e2fsdroid.c
+++ b/contrib/android/e2fsdroid.c
@@ -118,9 +118,17 @@ int main(int argc, char *argv[])
fprintf(stderr, "Expected filename after options\n");
exit(EXIT_FAILURE);
}
- in_file = strdup(argv[optind]);
- io_mgr = android_sparse_file ? sparse_io_manager: unix_io_manager;
+ if (android_sparse_file) {
+ io_mgr = sparse_io_manager;
+ if (asprintf(&in_file, "(%s)", argv[optind]) == -1) {
+ fprintf(stderr, "Failed to allocate file name\n");
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ io_mgr = unix_io_manager;
+ in_file = strdup(argv[optind]);
+ }
retval = ext2fs_open(in_file, flags, 0, 0, io_mgr, &fs);
if (retval) {
com_err(prog_name, retval, "while opening file %s\n", in_file);
diff --git a/include/mingw/grp.h b/include/mingw/grp.h
new file mode 100644
index 00000000..67f62d94
--- /dev/null
+++ b/include/mingw/grp.h
@@ -0,0 +1,16 @@
+
+#pragma once
+
+#include <sys/types.h>
+
+__inline struct group * getgrnam(char* g){return 0;}
+
+struct group
+ {
+ char *gr_name;
+ char *gr_passwd;
+ __gid_t gr_gid;
+ char **gr_mem;
+ };
+
+#define getgrgid(i) NULL
diff --git a/include/mingw/linux/types.h b/include/mingw/linux/types.h
new file mode 100644
index 00000000..eb870113
--- /dev/null
+++ b/include/mingw/linux/types.h
@@ -0,0 +1,33 @@
+#ifndef _LINUX_TYPES_H
+#define _LINUX_TYPES_H
+
+//#ifndef _MSC_VER
+//#error _MSC_VER not defined
+//#endif
+
+#include <sys/types.h>
+
+typedef unsigned __int8 __u8;
+typedef signed __int8 __s8;
+
+typedef signed __int64 __s64;
+typedef unsigned __int64 __u64;
+
+typedef signed __int16 __s16;
+typedef unsigned __int16 __u16;
+
+typedef signed __int32 __s32;
+typedef unsigned __int32 __u32;
+
+typedef signed __int64 __s64;
+typedef unsigned __int64 __u64;
+
+
+//typedef __u32 ino_t;
+typedef __u32 dev_t;
+typedef __u32 uid_t;
+typedef __u32 gid_t;
+
+#include <stdint.h>
+
+#endif /* LINUX_TYPES_H */
diff --git a/include/mingw/pwd.h b/include/mingw/pwd.h
new file mode 100644
index 00000000..d048842b
--- /dev/null
+++ b/include/mingw/pwd.h
@@ -0,0 +1,20 @@
+
+#pragma once
+
+#include <sys/types.h>
+
+__inline struct passwd* getpwnam (char* g){return 0;}
+
+struct passwd
+{
+ char *pw_name;
+ char *pw_passwd;
+ __uid_t pw_uid;
+ __gid_t pw_gid;
+ char *pw_gecos;
+ char *pw_dir;
+ char *pw_shell;
+};
+
+#define getpwuid(i) NULL
+
diff --git a/include/mingw/sys/stat.h b/include/mingw/sys/stat.h
new file mode 100644
index 00000000..0ca1d1b1
--- /dev/null
+++ b/include/mingw/sys/stat.h
@@ -0,0 +1,20 @@
+
+#pragma once
+
+#if HAVE_SYS_STAT_H
+#include_next <sys/stat.h>
+#endif
+
+#ifndef lstat
+#define lstat stat
+#endif
+
+#ifndef S_ISLNK
+#ifdef __S_IFLNK
+#define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK)
+#else
+#define S_ISLNK(mode) 0
+#endif
+#endif
+
+#define link(a, b) CreateHardLink((a), (b), NULL)
diff --git a/include/mingw/sys/sysmacros.h b/include/mingw/sys/sysmacros.h
new file mode 100644
index 00000000..18fcaaa3
--- /dev/null
+++ b/include/mingw/sys/sysmacros.h
@@ -0,0 +1,11 @@
+
+#pragma once
+
+/*
+ * Fall back to Linux's definitions of makedev and major are needed.
+ * The search_sysfs_block() function is highly unlikely to work on
+ * non-Linux systems anyway.
+ */
+#ifndef makedev
+#define makedev(maj, min) (((maj) << 8) + (min))
+#endif \ No newline at end of file
diff --git a/include/mingw/sys/types.h b/include/mingw/sys/types.h
new file mode 100644
index 00000000..9d048fcb
--- /dev/null
+++ b/include/mingw/sys/types.h
@@ -0,0 +1,9 @@
+
+#pragma once
+
+#include_next <sys/types.h>
+
+#include <linux/types.h>
+
+typedef unsigned short __uid_t;
+typedef unsigned short __gid_t;
diff --git a/include/mingw/unistd.h b/include/mingw/unistd.h
new file mode 100644
index 00000000..9c0dc81a
--- /dev/null
+++ b/include/mingw/unistd.h
@@ -0,0 +1,13 @@
+
+#pragma once
+
+#include_next <unistd.h>
+
+__inline __uid_t getuid(void){return 0;}
+__inline int geteuid(void){return 1;}
+
+__inline __gid_t getgid(void){return 0;}
+__inline __gid_t getegid(void){return 0;}
+
+// no-oped sync
+__inline void sync(void){};
diff --git a/lib/blkid/Android.bp b/lib/blkid/Android.bp
index 9b385f9c..53381df8 100644
--- a/lib/blkid/Android.bp
+++ b/lib/blkid/Android.bp
@@ -20,11 +20,20 @@ cc_library {
],
shared_libs: ["libext2_uuid"],
+ target: {
+ windows: {
+ include_dirs: [ "external/e2fsprogs/include/mingw" ],
+ cflags: [
+ "-Wno-pointer-to-int-cast",
+ ],
+ enabled: true
+ },
+ },
+
cflags: [
"-W",
"-Wall",
"-fno-strict-aliasing",
- "-Wno-macro-redefined",
],
header_libs: ["libext2-headers"],
diff --git a/lib/blkid/list.h b/lib/blkid/list.h
index 26a5ac1b..7e0ccd77 100644
--- a/lib/blkid/list.h
+++ b/lib/blkid/list.h
@@ -146,7 +146,7 @@ _INLINE_ void list_splice(struct list_head *list, struct list_head *head)
* @member: the name of the list_struct within the struct.
*/
#define list_entry(ptr, type, member) \
- ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
+ ((type *)((char *)(ptr)-(unsigned long)(intptr_t)(&((type *)0)->member)))
/**
* list_for_each - iterate over elements in a list
diff --git a/lib/blkid/save.c b/lib/blkid/save.c
index 762ffefd..036f07a4 100644
--- a/lib/blkid/save.c
+++ b/lib/blkid/save.c
@@ -27,6 +27,10 @@
#endif
#include "blkidP.h"
+#ifdef _WIN32
+#include "windows.h"
+#endif
+
static int save_dev(blkid_dev dev, FILE *file)
{
struct list_head *p;
@@ -102,7 +106,11 @@ int blkid_flush_cache(blkid_cache cache)
file = fdopen(fd, "w");
opened = tmp;
}
+#ifndef _WIN32
fchmod(fd, 0644);
+#else
+ chmod(tmp, 0644);
+#endif
}
}
diff --git a/lib/config.h b/lib/config.h
index 5655c3ba..029f7da7 100644
--- a/lib/config.h
+++ b/lib/config.h
@@ -44,6 +44,7 @@
#if defined(_WIN32)
# define HAVE_LINUX_TYPES_H 1
# define HAVE_WINSOCK_H 1
+# define HAVE_SYS_SYSMACROS_H 1
#endif
#if defined(__APPLE__) || defined(__linux__)
# define HAVE_FCNTL 1
diff --git a/lib/e2p/Android.bp b/lib/e2p/Android.bp
index db516707..9d5b0b61 100644
--- a/lib/e2p/Android.bp
+++ b/lib/e2p/Android.bp
@@ -35,6 +35,13 @@ cc_library {
"-Wno-macro-redefined",
],
+ target: {
+ windows: {
+ include_dirs: [ "external/e2fsprogs/include/mingw" ],
+ enabled: true
+ },
+ },
+
header_libs: ["libext2-headers"],
export_include_dirs: ["."],
export_header_lib_headers: ["libext2-headers"],
diff --git a/lib/e2p/fgetversion.c b/lib/e2p/fgetversion.c
index 33becfe3..a65e9a5c 100644
--- a/lib/e2p/fgetversion.c
+++ b/lib/e2p/fgetversion.c
@@ -31,7 +31,9 @@
#include <unistd.h>
#endif
#include <fcntl.h>
+#if HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
+#endif
#include "e2p.h"
diff --git a/lib/e2p/fsetversion.c b/lib/e2p/fsetversion.c
index dcbff5b9..c2e04559 100644
--- a/lib/e2p/fsetversion.c
+++ b/lib/e2p/fsetversion.c
@@ -31,7 +31,9 @@
#include <unistd.h>
#endif
#include <fcntl.h>
+#if HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
+#endif
#include "e2p.h"
diff --git a/lib/e2p/getversion.c b/lib/e2p/getversion.c
index 71031ffc..9f719b4a 100644
--- a/lib/e2p/getversion.c
+++ b/lib/e2p/getversion.c
@@ -20,7 +20,9 @@
#if HAVE_ERRNO_H
#include <errno.h>
#endif
+#if HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
+#endif
#include "e2p.h"
diff --git a/lib/e2p/setversion.c b/lib/e2p/setversion.c
index 202834f1..2bc93374 100644
--- a/lib/e2p/setversion.c
+++ b/lib/e2p/setversion.c
@@ -20,7 +20,9 @@
#if HAVE_ERRNO_H
#include <errno.h>
#endif
+#if HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
+#endif
#include "e2p.h"
diff --git a/lib/ext2fs/Android.bp b/lib/ext2fs/Android.bp
index df07a9b7..cc28de17 100644
--- a/lib/ext2fs/Android.bp
+++ b/lib/ext2fs/Android.bp
@@ -114,15 +114,10 @@ cc_library {
],
},
windows: {
- // include/nonunix is used as an overlay on top of the system
- // include directory. Some empty header files in include/nonunix
- // hide the ones in the system include path. This setup doesn't work
- // unless we pass the include/nonunix as an -isystem flag.
- // TODO(deymo): Enable windows
- enabled: false,
+ enabled: true,
+ include_dirs: [ "external/e2fsprogs/include/mingw" ],
cflags: [
"-Wno-format",
- // "-isystem external/e2fsprogs/include/nonunix",
],
host_ldlibs: ["-lws2_32"],
},
diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
index 32f43210..99fedcd3 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -28,6 +28,10 @@
#include "ext2_fs.h"
#include "ext2fs.h"
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
#if defined(__linux__) && defined(EXT2_OS_LINUX)
#define CREATOR_OS EXT2_OS_LINUX
#else
@@ -124,6 +128,7 @@ errcode_t ext2fs_initialize(const char *name, int flags,
io_flags |= IO_FLAG_EXCLUSIVE;
if (flags & EXT2_FLAG_DIRECT_IO)
io_flags |= IO_FLAG_DIRECT_IO;
+ io_flags |= O_BINARY;
retval = manager->open(name, io_flags, &fs->io);
if (retval)
goto cleanup;
diff --git a/lib/ext2fs/sparse_io.c b/lib/ext2fs/sparse_io.c
index a307859f..a83baf1f 100644
--- a/lib/ext2fs/sparse_io.c
+++ b/lib/ext2fs/sparse_io.c
@@ -7,6 +7,10 @@
#include "ext2_fs.h"
#include "ext2fs.h"
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
#if !defined(ENABLE_LIBSPARSE)
static errcode_t sparse_open(const char *name EXT2FS_ATTR((unused)),
int flags EXT2FS_ATTR((unused)),
@@ -155,7 +159,7 @@ static errcode_t io_manager_configure(struct sparse_io_params *params,
goto err_alloc;
}
if (params->fd < 0) {
- sm->fd = open(params->file, O_CREAT | O_RDWR | O_TRUNC,
+ sm->fd = open(params->file, O_CREAT | O_RDWR | O_TRUNC | O_BINARY,
0644);
if (sm->fd < 0) {
retval = errno;
@@ -206,11 +210,11 @@ static errcode_t read_sparse_argv(const char *name, bool is_fd,
}
if (is_fd) {
- ret = sscanf(name, "%d:%llu:%u", &sparse_params->fd,
+ ret = sscanf(name, "(%d):%llu:%u", &sparse_params->fd,
(unsigned long long *)&sparse_params->blocks_count,
&sparse_params->block_size);
} else {
- ret = sscanf(name, "%[^:]%*[:]%llu%*[:]%u", sparse_params->file,
+ ret = sscanf(name, "(%[^)])%*[:]%llu%*[:]%u", sparse_params->file,
(unsigned long long *)&sparse_params->blocks_count,
&sparse_params->block_size);
}
diff --git a/lib/support/Android.bp b/lib/support/Android.bp
index 24414a45..4a89b8f3 100644
--- a/lib/support/Android.bp
+++ b/lib/support/Android.bp
@@ -18,10 +18,15 @@ cc_library {
],
shared_libs: [
"libext2fs",
- "libext2_com_err",
"libext2_blkid",
],
+ target: {
+ windows: {
+ enabled: true
+ },
+ },
+
cflags: [
"-W",
"-Wall",
diff --git a/lib/uuid/Android.bp b/lib/uuid/Android.bp
index d173788a..b6664f99 100644
--- a/lib/uuid/Android.bp
+++ b/lib/uuid/Android.bp
@@ -22,7 +22,12 @@ cc_library {
"-Wno-unused-function",
"-Wno-unused-parameter",
],
-
+ target: {
+ windows: {
+ include_dirs: [ "external/e2fsprogs/include/mingw" ],
+ enabled: true
+ },
+ },
header_libs: ["libext2-headers"],
export_include_dirs: ["."],
export_header_lib_headers: ["libext2-headers"],
diff --git a/lib/uuid/gen_uuid.c b/lib/uuid/gen_uuid.c
index 0028c7ca..69c187ed 100644
--- a/lib/uuid/gen_uuid.c
+++ b/lib/uuid/gen_uuid.c
@@ -60,7 +60,9 @@
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
+#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
+#endif
#include <sys/stat.h>
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
@@ -113,6 +115,7 @@ THREAD_LOCAL unsigned short jrand_seed[3];
#endif
#ifdef _WIN32
+#ifndef USE_MINGW
static void gettimeofday (struct timeval *tv, void *dummy)
{
FILETIME ftime;
@@ -129,11 +132,7 @@ static void gettimeofday (struct timeval *tv, void *dummy)
tv->tv_sec = n / 1000000;
tv->tv_usec = n % 1000000;
}
-
-static int getuid (void)
-{
- return 1;
-}
+#endif
#endif
static int get_random_fd(void)
@@ -317,7 +316,9 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low,
THREAD_LOCAL FILE *state_f;
THREAD_LOCAL uint16_t clock_seq;
struct timeval tv;
+#ifndef _WIN32
struct flock fl;
+#endif
uint64_t clock_reg;
mode_t save_umask;
int len;
@@ -335,6 +336,7 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low,
}
}
}
+#ifndef _WIN32
fl.l_type = F_WRLCK;
fl.l_whence = SEEK_SET;
fl.l_start = 0;
@@ -350,6 +352,7 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low,
break;
}
}
+#endif
if (state_fd >= 0) {
unsigned int cl;
unsigned long tv1, tv2;
@@ -413,11 +416,13 @@ try_again:
fflush(state_f);
}
rewind(state_f);
+#ifndef _WIN32
fl.l_type = F_UNLCK;
if (fcntl(state_fd, F_SETLK, &fl) < 0) {
fclose(state_f);
state_fd = -1;
}
+#endif
}
*clock_high = clock_reg >> 32;
diff --git a/misc/Android.bp b/misc/Android.bp
index 5183981f..3b5f7c18 100644
--- a/misc/Android.bp
+++ b/misc/Android.bp
@@ -6,10 +6,17 @@ cc_library {
name: "libext2_misc",
host_supported: true,
+ target: {
+ windows: {
+ include_dirs: [ "external/e2fsprogs/include/mingw" ],
+ enabled: true
+ },
+ },
+
srcs: [
"create_inode.c",
],
- cflags: ["-W", "-Wall", "-Wno-macro-redefined"],
+ cflags: ["-W", "-Wall"],
shared_libs: [
"libext2_quota",
"libext2fs",
@@ -35,16 +42,41 @@ cc_binary {
"mke2fs.conf",
],
cflags: ["-W", "-Wall", "-Wno-macro-redefined"],
- shared_libs: [
- "libext2fs",
- "libext2_blkid",
- "libext2_misc",
- "libext2_uuid",
- "libext2_quota",
- "libext2_com_err",
- "libext2_e2p",
- ],
- system_shared_libs: ["libc"],
+ target: {
+ host: {
+ static_libs: [
+ "libext2_blkid",
+ "libext2_misc",
+ "libext2_uuid",
+ "libext2_quota",
+ "libext2_com_err",
+ "libext2_e2p",
+ "libext2fs",
+ "libsparse",
+ "libbase",
+ "libz",
+ ],
+ },
+ windows: {
+ include_dirs: [ "external/e2fsprogs/include/mingw" ],
+ cflags: ["-D_POSIX", "-D__USE_MINGW_ALARM"],
+ ldflags: ["-static"],
+ host_ldlibs: ["-lws2_32"],
+ enabled: true
+ },
+ android: {
+ shared_libs: [
+ "libext2fs",
+ "libext2_blkid",
+ "libext2_misc",
+ "libext2_uuid",
+ "libext2_quota",
+ "libext2_com_err",
+ "libext2_e2p",
+ ],
+ },
+ },
+ stl: "libc++_static",
include_dirs: ["external/e2fsprogs/e2fsck"],
}
diff --git a/misc/create_inode.c b/misc/create_inode.c
index e7ff0a4e..94c29b8d 100644
--- a/misc/create_inode.c
+++ b/misc/create_inode.c
@@ -15,13 +15,16 @@
#include "config.h"
#include <time.h>
+#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <limits.h> /* for PATH_MAX */
#ifdef HAVE_ATTR_XATTR_H
#include <attr/xattr.h>
#endif
+#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
+#endif
#ifdef HAVE_SYS_SYSMACROS_H
#include <sys/sysmacros.h>
#endif
@@ -227,6 +230,7 @@ static errcode_t set_inode_xattr(ext2_filsys fs EXT2FS_ATTR((unused)),
}
#endif /* HAVE_LLISTXATTR */
+#ifndef _WIN32
/* Make a special files (block and character devices), fifo's, and sockets */
errcode_t do_mknod_internal(ext2_filsys fs, ext2_ino_t cwd, const char *name,
struct stat *st)
@@ -250,10 +254,12 @@ errcode_t do_mknod_internal(ext2_filsys fs, ext2_ino_t cwd, const char *name,
mode = LINUX_S_IFIFO;
filetype = EXT2_FT_FIFO;
break;
+#ifndef _WIN32
case S_IFSOCK:
mode = LINUX_S_IFSOCK;
filetype = EXT2_FT_SOCK;
break;
+#endif
default:
return EXT2_ET_INVALID_ARGUMENT;
}
@@ -311,6 +317,7 @@ errcode_t do_mknod_internal(ext2_filsys fs, ext2_ino_t cwd, const char *name,
return retval;
}
+#endif
/* Make a symlink name -> target */
errcode_t do_symlink_internal(ext2_filsys fs, ext2_ino_t cwd, const char *name,
@@ -783,6 +790,7 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino,
case S_IFCHR:
case S_IFBLK:
case S_IFIFO:
+#ifndef _WIN32
case S_IFSOCK:
retval = do_mknod_internal(fs, parent_ino, name, &st);
if (retval) {
@@ -827,6 +835,7 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino,
goto out;
}
break;
+#endif
case S_IFREG:
retval = do_write_internal(fs, parent_ino, name, name,
root);
diff --git a/misc/mk_hugefiles.c b/misc/mk_hugefiles.c
index 00e95cdf..79d3ae56 100644
--- a/misc/mk_hugefiles.c
+++ b/misc/mk_hugefiles.c
@@ -32,7 +32,9 @@ extern int optind;
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
+#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
+#endif
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_SYS_SYSMACROS_H
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 4d12947d..ed10cc4a 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -43,7 +43,9 @@ extern int optind;
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
+#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
+#endif
#include <libgen.h>
#include <limits.h>
#include <blkid/blkid.h>
@@ -1896,10 +1898,15 @@ profile_error:
dev_size = fs_blocks_count;
retval = 0;
} else
+#ifndef _WIN32
retval = ext2fs_get_device_size2(device_name,
EXT2_BLOCK_SIZE(&fs_param),
&dev_size);
-
+#else
+ retval = ext2fs_get_device_size(device_name,
+ EXT2_BLOCK_SIZE(&fs_param),
+ &dev_size);
+#endif
if (retval && (retval != EXT2_ET_UNIMPLEMENTED)) {
com_err(program_name, retval, "%s",
_("while trying to determine filesystem size"));
@@ -2820,7 +2827,7 @@ int main (int argc, char *argv[])
_("in malloc for android_sparse_params"));
exit(1);
}
- snprintf(android_sparse_params, PATH_MAX + 32, "%s:%u:%u",
+ snprintf(android_sparse_params, PATH_MAX + 32, "(%s):%u:%u",
device_name, fs_param.s_blocks_count,
1024 << fs_param.s_log_block_size);
retval = ext2fs_initialize(android_sparse_params, flags,