From: Jo-Philipp Wich Date: Wed, 8 Apr 2015 04:45:09 +0000 (+0200) Subject: Remove MinGW support code X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fmake_ext4fs.git;a=commitdiff_plain;h=d8400e132c67a993248d25fd9026dcc5ffedc96c Remove MinGW support code Signed-off-by: Jo-Philipp Wich --- diff --git a/contents.c b/contents.c index c9d6d64..1cde871 100644 --- a/contents.c +++ b/contents.c @@ -30,10 +30,6 @@ #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() { diff --git a/ext4_utils.c b/ext4_utils.c index ad0491f..ef77b72 100644 --- a/ext4_utils.c +++ b/ext4_utils.c @@ -29,12 +29,8 @@ #include #include -#ifdef USE_MINGW -#include -#else #include #include -#endif #if defined(__linux__) #include @@ -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) diff --git a/ext4fixup.c b/ext4fixup.c index 184cd0d..7d11b5d 100644 --- a/ext4fixup.c +++ b/ext4fixup.c @@ -24,13 +24,10 @@ #include #include #include +#include #include #include -#ifndef USE_MINGW -#include -#endif - #if defined(__APPLE__) && defined(__MACH__) #define lseek64 lseek #define off64_t off_t diff --git a/libsparse/output_file.c b/libsparse/output_file.c index ba92563..a581c45 100644 --- a/libsparse/output_file.c +++ b/libsparse/output_file.c @@ -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; } diff --git a/libsparse/sparse_read.c b/libsparse/sparse_read.c index 9b10293..641d451 100644 --- a/libsparse/sparse_read.c +++ b/libsparse/sparse_read.c @@ -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", diff --git a/make_ext4fs.c b/make_ext4fs.c index fc1802b..5087811 100644 --- a/make_ext4fs.c +++ b/make_ext4fs.c @@ -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 463ec38..1db9134 100644 --- a/sha1.c +++ b/sha1.c @@ -17,9 +17,7 @@ #define SHA1HANDSOFF /* Copies data before messing with it. */ -#ifndef USE_MINGW #include -#endif #include #include #include diff --git a/sha1.h b/sha1.h index 9a8f7e3..13328d3 100644 --- a/sha1.h +++ b/sha1.h @@ -10,19 +10,8 @@ #define _SYS_SHA1_H_ #include -#include - -#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 -#endif +#include #define SHA1_DIGEST_LENGTH 20 #define SHA1_DIGEST_STRING_LENGTH 41 diff --git a/uuid.c b/uuid.c index 33d2494..7ded43a 100644 --- a/uuid.c +++ b/uuid.c @@ -16,11 +16,7 @@ #include -#ifdef USE_MINGW -#include -#else #include -#endif #include "ext4_utils.h" #include "sha1.h"