Skip to content

Commit d8400e1

Browse files
committed
Remove MinGW support code
Signed-off-by: Jo-Philipp Wich <[email protected]>
1 parent 5e571bc commit d8400e1

File tree

9 files changed

+3
-69
lines changed

9 files changed

+3
-69
lines changed

contents.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
#include "extent.h"
3131
#include "indirect.h"
3232

33-
#ifdef USE_MINGW
34-
#define S_IFLNK 0 /* used by make_link, not needed under mingw */
35-
#endif
36-
3733
static struct block_allocation* saved_allocation_head = NULL;
3834

3935
struct block_allocation* get_saved_allocation_chain() {

ext4_utils.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,8 @@
2929
#include <stddef.h>
3030
#include <string.h>
3131

32-
#ifdef USE_MINGW
33-
#include <winsock2.h>
34-
#else
3532
#include <arpa/inet.h>
3633
#include <sys/ioctl.h>
37-
#endif
3834

3935
#if defined(__linux__)
4036
#include <linux/fs.h>
@@ -443,16 +439,12 @@ u64 get_block_device_size(int fd)
443439

444440
int is_block_device_fd(int fd)
445441
{
446-
#ifdef USE_MINGW
447-
return 0;
448-
#else
449442
struct stat st;
450443
int ret = fstat(fd, &st);
451444
if (ret < 0)
452445
return 0;
453446

454447
return S_ISBLK(st.st_mode);
455-
#endif
456448
}
457449

458450
u64 get_file_size(int fd)

ext4fixup.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,10 @@
2424
#include <sys/types.h>
2525
#include <sys/stat.h>
2626
#include <sys/types.h>
27+
#include <sys/mman.h>
2728
#include <fcntl.h>
2829
#include <unistd.h>
2930

30-
#ifndef USE_MINGW
31-
#include <sys/mman.h>
32-
#endif
33-
3431
#if defined(__APPLE__) && defined(__MACH__)
3532
#define lseek64 lseek
3633
#define off64_t off_t

libsparse/output_file.c

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -699,39 +699,16 @@ int write_fd_chunk(struct output_file *out, unsigned int len,
699699
aligned_diff = offset - aligned_offset;
700700
buffer_size = len + aligned_diff;
701701

702-
#ifndef USE_MINGW
703702
char *data = mmap64(NULL, buffer_size, PROT_READ, MAP_SHARED, fd,
704703
aligned_offset);
705704
if (data == MAP_FAILED) {
706705
return -errno;
707706
}
708707
ptr = data + aligned_diff;
709-
#else
710-
off64_t pos;
711-
char *data = malloc(len);
712-
if (!data) {
713-
return -errno;
714-
}
715-
pos = lseek64(fd, offset, SEEK_SET);
716-
if (pos < 0) {
717-
free(data);
718-
return -errno;
719-
}
720-
ret = read_all(fd, data, len);
721-
if (ret < 0) {
722-
free(data);
723-
return ret;
724-
}
725-
ptr = data;
726-
#endif
727708

728709
ret = out->sparse_ops->write_data_chunk(out, len, ptr);
729710

730-
#ifndef USE_MINGW
731711
munmap(data, buffer_size);
732-
#else
733-
free(data);
734-
#endif
735712

736713
return ret;
737714
}

libsparse/sparse_read.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,9 @@ static void verbose_error(bool verbose, int err, const char *fmt, ...)
7878
s = " at ";
7979
}
8080
if (verbose) {
81-
#ifndef USE_MINGW
8281
if (err == -EOVERFLOW) {
8382
sparse_print_verbose("EOF while reading file%s%s\n", s, at);
84-
} else
85-
#endif
86-
if (err == -EINVAL) {
83+
} else if (err == -EINVAL) {
8784
sparse_print_verbose("Invalid sparse file format%s%s\n", s, at);
8885
} else if (err == -ENOMEM) {
8986
sparse_print_verbose("Failed allocation while reading file%s%s\n",

make_ext4fs.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ static u32 build_default_directory_structure(const char *dir_path)
6666
return root_inode;
6767
}
6868

69-
#ifndef USE_MINGW
7069
/* Read a local directory and create the same tree in the generated filesystem.
7170
Calls itself recursively with each directory in the given directory.
7271
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
255254
free(dentries);
256255
return inode;
257256
}
258-
#endif
259257

260258
static u32 compute_block_size()
261259
{
@@ -522,17 +520,11 @@ int make_ext4fs_internal(int fd, const char *_directory,
522520
if (info.feat_compat & EXT4_FEATURE_COMPAT_RESIZE_INODE)
523521
ext4_create_resize_inode();
524522

525-
#ifdef USE_MINGW
526-
// Windows needs only 'create an empty fs image' functionality
527-
assert(!directory);
528-
root_inode_num = build_default_directory_structure(mountpoint);
529-
#else
530523
if (directory)
531524
root_inode_num = build_directory_structure(directory, mountpoint, 0,
532525
fs_config_func, verbose, fixed_time);
533526
else
534527
root_inode_num = build_default_directory_structure(mountpoint);
535-
#endif
536528

537529
root_mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
538530
inode_set_permissions(root_inode_num, root_mode, 0, 0, 0);

sha1.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717

1818
#define SHA1HANDSOFF /* Copies data before messing with it. */
1919

20-
#ifndef USE_MINGW
2120
#include <sys/cdefs.h>
22-
#endif
2321
#include <sys/types.h>
2422
#include <assert.h>
2523
#include <string.h>

sha1.h

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,8 @@
1010
#define _SYS_SHA1_H_
1111

1212
#include <sys/types.h>
13-
#include <stdint.h>
14-
15-
#ifdef USE_MINGW
16-
typedef unsigned char u_char;
17-
typedef unsigned int uint32_t;
18-
typedef unsigned int u_int32_t;
19-
typedef unsigned int u_int;
20-
21-
#define __BEGIN_DECLS
22-
#define __END_DECLS
23-
#else
2413
#include <sys/cdefs.h>
25-
#endif
14+
#include <stdint.h>
2615

2716
#define SHA1_DIGEST_LENGTH 20
2817
#define SHA1_DIGEST_STRING_LENGTH 41

uuid.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@
1616

1717
#include <string.h>
1818

19-
#ifdef USE_MINGW
20-
#include <winsock2.h>
21-
#else
2219
#include <arpa/inet.h>
23-
#endif
2420

2521
#include "ext4_utils.h"
2622
#include "sha1.h"

0 commit comments

Comments
 (0)