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 c9d6d64a97e8804eef2dc5c03b07c5d7a5495ca9..1cde871e898bdffe65044c180369ab6960bb8b19 100644 (file)
 #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() {
index ad0491f6cbc59cbcf8340a3333fe07c8b6bed6d9..ef77b72fe989c406cac521d15506bb0ddbb377a0 100644 (file)
 #include <stddef.h>
 #include <string.h>
 
-#ifdef USE_MINGW
-#include <winsock2.h>
-#else
 #include <arpa/inet.h>
 #include <sys/ioctl.h>
-#endif
 
 #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)
 {
-#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);
-#endif
 }
 
 u64 get_file_size(int fd)
index 184cd0d6071bf896ed9a43a1c12c5dc4c8466b1d..7d11b5db63d92ab67e7162f90fce73a4f71aa38f 100644 (file)
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/mman.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
index ba92563dd3da11117c8f8308ba805165289dfdc7..a581c457cc001b40edd71cb99318e1a530a4f53a 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;
 
-#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;
-#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);
 
-#ifndef USE_MINGW
        munmap(data, buffer_size);
-#else
-       free(data);
-#endif
 
        return ret;
 }
index 9b10293feff78265be8ea1e567f83b61ef2c13a0..641d4513dc3be1dcf12328f735caf88ba22a92cb 100644 (file)
@@ -78,12 +78,9 @@ static void verbose_error(bool verbose, int err, const char *fmt, ...)
                s = " at ";
        }
        if (verbose) {
-#ifndef USE_MINGW
                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",
index fc1802b900df28f1b3a55f6805857d62c374703e..5087811026126d4073f16f502d24b1784ebca8c9 100644 (file)
@@ -66,7 +66,6 @@ static u32 build_default_directory_structure(const char *dir_path)
        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
@@ -255,7 +254,6 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path
        free(dentries);
        return inode;
 }
-#endif
 
 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();
 
-#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);
-#endif
 
        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 463ec388870fab0447f0748cdca50f546c8a07e0..1db9134a45368d68f71900117bf7147c6d1b3294 100644 (file)
--- a/sha1.c
+++ b/sha1.c
@@ -17,9 +17,7 @@
 
 #define SHA1HANDSOFF           /* Copies data before messing with it. */
 
-#ifndef USE_MINGW
 #include <sys/cdefs.h>
-#endif
 #include <sys/types.h>
 #include <assert.h>
 #include <string.h>
diff --git a/sha1.h b/sha1.h
index 9a8f7e326043454f285ba0ef5869e1578e5b8a0f..13328d3a3bc4008cf5a7818e593b325c44e5c0df 100644 (file)
--- a/sha1.h
+++ b/sha1.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>
-#endif
+#include <stdint.h>
 
 #define SHA1_DIGEST_LENGTH             20
 #define SHA1_DIGEST_STRING_LENGTH      41
diff --git a/uuid.c b/uuid.c
index 33d2494a1c7b7404e4f285dbeb43818997b9568d..7ded43a03c5ffa622e5035bfed62a0627507c1c9 100644 (file)
--- a/uuid.c
+++ b/uuid.c
 
 #include <string.h>
 
-#ifdef USE_MINGW
-#include <winsock2.h>
-#else
 #include <arpa/inet.h>
-#endif
 
 #include "ext4_utils.h"
 #include "sha1.h"