Remove MinGW support code
authorJo-Philipp Wich <jow@openwrt.org>
Wed, 8 Apr 2015 04:45:09 +0000 (06:45 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Wed, 8 Apr 2015 05:51:39 +0000 (07:51 +0200)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
contents.c
ext4_utils.c
ext4fixup.c
libsparse/output_file.c
libsparse/sparse_read.c
make_ext4fs.c
sha1.c
sha1.h
uuid.c

index c9d6d64..1cde871 100644 (file)
 #include "extent.h"
 #include "indirect.h"
 
 #include "extent.h"
 #include "indirect.h"
 
-#ifdef USE_MINGW
-#define S_IFLNK 0  /* used by make_link, not needed under mingw */
-#endif
-
 static struct block_allocation* saved_allocation_head = NULL;
 
 struct block_allocation* get_saved_allocation_chain() {
 static struct block_allocation* saved_allocation_head = NULL;
 
 struct block_allocation* get_saved_allocation_chain() {
index ad0491f..ef77b72 100644 (file)
 #include <stddef.h>
 #include <string.h>
 
 #include <stddef.h>
 #include <string.h>
 
-#ifdef USE_MINGW
-#include <winsock2.h>
-#else
 #include <arpa/inet.h>
 #include <sys/ioctl.h>
 #include <arpa/inet.h>
 #include <sys/ioctl.h>
-#endif
 
 #if defined(__linux__)
 #include <linux/fs.h>
 
 #if defined(__linux__)
 #include <linux/fs.h>
@@ -443,16 +439,12 @@ u64 get_block_device_size(int fd)
 
 int is_block_device_fd(int fd)
 {
 
 int is_block_device_fd(int fd)
 {
-#ifdef USE_MINGW
-       return 0;
-#else
        struct stat st;
        int ret = fstat(fd, &st);
        if (ret < 0)
                return 0;
 
        return S_ISBLK(st.st_mode);
        struct stat st;
        int ret = fstat(fd, &st);
        if (ret < 0)
                return 0;
 
        return S_ISBLK(st.st_mode);
-#endif
 }
 
 u64 get_file_size(int fd)
 }
 
 u64 get_file_size(int fd)
index 184cd0d..7d11b5d 100644 (file)
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/mman.h>
 #include <fcntl.h>
 #include <unistd.h>
 
 #include <fcntl.h>
 #include <unistd.h>
 
-#ifndef USE_MINGW
-#include <sys/mman.h>
-#endif
-
 #if defined(__APPLE__) && defined(__MACH__)
 #define lseek64 lseek
 #define off64_t off_t
 #if defined(__APPLE__) && defined(__MACH__)
 #define lseek64 lseek
 #define off64_t off_t
index ba92563..a581c45 100644 (file)
@@ -699,39 +699,16 @@ int write_fd_chunk(struct output_file *out, unsigned int len,
        aligned_diff = offset - aligned_offset;
        buffer_size = len + aligned_diff;
 
        aligned_diff = offset - aligned_offset;
        buffer_size = len + aligned_diff;
 
-#ifndef USE_MINGW
        char *data = mmap64(NULL, buffer_size, PROT_READ, MAP_SHARED, fd,
                        aligned_offset);
        if (data == MAP_FAILED) {
                return -errno;
        }
        ptr = data + aligned_diff;
        char *data = mmap64(NULL, buffer_size, PROT_READ, MAP_SHARED, fd,
                        aligned_offset);
        if (data == MAP_FAILED) {
                return -errno;
        }
        ptr = data + aligned_diff;
-#else
-       off64_t pos;
-       char *data = malloc(len);
-       if (!data) {
-               return -errno;
-       }
-       pos = lseek64(fd, offset, SEEK_SET);
-       if (pos < 0) {
-                free(data);
-               return -errno;
-       }
-       ret = read_all(fd, data, len);
-       if (ret < 0) {
-                free(data);
-               return ret;
-       }
-       ptr = data;
-#endif
 
        ret = out->sparse_ops->write_data_chunk(out, len, ptr);
 
 
        ret = out->sparse_ops->write_data_chunk(out, len, ptr);
 
-#ifndef USE_MINGW
        munmap(data, buffer_size);
        munmap(data, buffer_size);
-#else
-       free(data);
-#endif
 
        return ret;
 }
 
        return ret;
 }
index 9b10293..641d451 100644 (file)
@@ -78,12 +78,9 @@ static void verbose_error(bool verbose, int err, const char *fmt, ...)
                s = " at ";
        }
        if (verbose) {
                s = " at ";
        }
        if (verbose) {
-#ifndef USE_MINGW
                if (err == -EOVERFLOW) {
                        sparse_print_verbose("EOF while reading file%s%s\n", s, at);
                if (err == -EOVERFLOW) {
                        sparse_print_verbose("EOF while reading file%s%s\n", s, at);
-               } else
-#endif
-               if (err == -EINVAL) {
+               } else if (err == -EINVAL) {
                        sparse_print_verbose("Invalid sparse file format%s%s\n", s, at);
                } else if (err == -ENOMEM) {
                        sparse_print_verbose("Failed allocation while reading file%s%s\n",
                        sparse_print_verbose("Invalid sparse file format%s%s\n", s, at);
                } else if (err == -ENOMEM) {
                        sparse_print_verbose("Failed allocation while reading file%s%s\n",
index fc1802b..5087811 100644 (file)
@@ -66,7 +66,6 @@ static u32 build_default_directory_structure(const char *dir_path)
        return root_inode;
 }
 
        return root_inode;
 }
 
-#ifndef USE_MINGW
 /* Read a local directory and create the same tree in the generated filesystem.
    Calls itself recursively with each directory in the given directory.
    full_path is an absolute or relative path, with a trailing slash, to the
 /* Read a local directory and create the same tree in the generated filesystem.
    Calls itself recursively with each directory in the given directory.
    full_path is an absolute or relative path, with a trailing slash, to the
@@ -255,7 +254,6 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path
        free(dentries);
        return inode;
 }
        free(dentries);
        return inode;
 }
-#endif
 
 static u32 compute_block_size()
 {
 
 static u32 compute_block_size()
 {
@@ -522,17 +520,11 @@ int make_ext4fs_internal(int fd, const char *_directory,
        if (info.feat_compat & EXT4_FEATURE_COMPAT_RESIZE_INODE)
                ext4_create_resize_inode();
 
        if (info.feat_compat & EXT4_FEATURE_COMPAT_RESIZE_INODE)
                ext4_create_resize_inode();
 
-#ifdef USE_MINGW
-       // Windows needs only 'create an empty fs image' functionality
-       assert(!directory);
-       root_inode_num = build_default_directory_structure(mountpoint);
-#else
        if (directory)
                root_inode_num = build_directory_structure(directory, mountpoint, 0,
                        fs_config_func, verbose, fixed_time);
        else
                root_inode_num = build_default_directory_structure(mountpoint);
        if (directory)
                root_inode_num = build_directory_structure(directory, mountpoint, 0,
                        fs_config_func, verbose, fixed_time);
        else
                root_inode_num = build_default_directory_structure(mountpoint);
-#endif
 
        root_mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
        inode_set_permissions(root_inode_num, root_mode, 0, 0, 0);
 
        root_mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
        inode_set_permissions(root_inode_num, root_mode, 0, 0, 0);
diff --git a/sha1.c b/sha1.c
index 463ec38..1db9134 100644 (file)
--- a/sha1.c
+++ b/sha1.c
@@ -17,9 +17,7 @@
 
 #define SHA1HANDSOFF           /* Copies data before messing with it. */
 
 
 #define SHA1HANDSOFF           /* Copies data before messing with it. */
 
-#ifndef USE_MINGW
 #include <sys/cdefs.h>
 #include <sys/cdefs.h>
-#endif
 #include <sys/types.h>
 #include <assert.h>
 #include <string.h>
 #include <sys/types.h>
 #include <assert.h>
 #include <string.h>
diff --git a/sha1.h b/sha1.h
index 9a8f7e3..13328d3 100644 (file)
--- a/sha1.h
+++ b/sha1.h
 #define        _SYS_SHA1_H_
 
 #include <sys/types.h>
 #define        _SYS_SHA1_H_
 
 #include <sys/types.h>
-#include <stdint.h>
-
-#ifdef USE_MINGW
-typedef unsigned char u_char;
-typedef unsigned int uint32_t;
-typedef unsigned int u_int32_t;
-typedef unsigned int u_int;
-
-#define __BEGIN_DECLS
-#define __END_DECLS
-#else
 #include <sys/cdefs.h>
 #include <sys/cdefs.h>
-#endif
+#include <stdint.h>
 
 #define SHA1_DIGEST_LENGTH             20
 #define SHA1_DIGEST_STRING_LENGTH      41
 
 #define SHA1_DIGEST_LENGTH             20
 #define SHA1_DIGEST_STRING_LENGTH      41
diff --git a/uuid.c b/uuid.c
index 33d2494..7ded43a 100644 (file)
--- a/uuid.c
+++ b/uuid.c
 
 #include <string.h>
 
 
 #include <string.h>
 
-#ifdef USE_MINGW
-#include <winsock2.h>
-#else
 #include <arpa/inet.h>
 #include <arpa/inet.h>
-#endif
 
 #include "ext4_utils.h"
 #include "sha1.h"
 
 #include "ext4_utils.h"
 #include "sha1.h"