summaryrefslogtreecommitdiff
path: root/target/tools/squashfs/patches/squashfs-bsd.patch
blob: 6e23ed8d65959b745043b91bba956c8a232d4102 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
diff -Nur squashfs4.0.orig/squashfs-tools/mksquashfs.c squashfs4.0/squashfs-tools/mksquashfs.c
--- squashfs4.0.orig/squashfs-tools/mksquashfs.c	Sun Apr  5 23:22:48 2009
+++ squashfs4.0/squashfs-tools/mksquashfs.c	Tue Dec 29 18:23:15 2009
@@ -48,16 +48,9 @@
 #include <regex.h>
 #include <fnmatch.h>
 
-#ifndef linux
-#define __BYTE_ORDER BYTE_ORDER
-#define __BIG_ENDIAN BIG_ENDIAN
-#define __LITTLE_ENDIAN LITTLE_ENDIAN
-#include <sys/sysctl.h>
-#else
-#include <endian.h>
-#include <sys/sysinfo.h>
-#endif
+#include <sys/param.h>
 
+
 #include "squashfs_fs.h"
 #include "squashfs_swap.h"
 #include "mksquashfs.h"
@@ -3688,23 +3681,9 @@
 	signal(SIGUSR1, sigusr1_handler);
 
 	if(processors == -1) {
-#ifndef linux
-		int mib[2];
-		size_t len = sizeof(processors);
-
-		mib[0] = CTL_HW;
-#ifdef HW_AVAILCPU
-		mib[1] = HW_AVAILCPU;
+#if defined(BSD)
+		processors = 1;
 #else
-		mib[1] = HW_NCPU;
-#endif
-
-		if(sysctl(mib, 2, &processors, &len, NULL, 0) == -1) {
-			ERROR("Failed to get number of available processors.  "
-				"Defaulting to 1\n");
-			processors = 1;
-		}
-#else
 		processors = get_nprocs();
 #endif
 	}
@@ -3974,9 +3953,15 @@
 			int match = use_regex ?
 				regexec(path->name[i].preg, name, (size_t) 0,
 					NULL, 0) == 0 :
+#if defined(BSD)
 				fnmatch(path->name[i].name, name,
+					FNM_PATHNAME|FNM_PERIOD) ==
+					 0;
+#else
+				fnmatch(path->name[i].name, name,
 					FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) ==
 					 0;
+#endif
 
 			if(match && path->name[i].paths == NULL) {
 				/* match on a leaf component, any subdirectories
diff -Nur squashfs4.0.orig/squashfs-tools/pseudo.c squashfs4.0/squashfs-tools/pseudo.c
--- squashfs4.0.orig/squashfs-tools/pseudo.c	Sun Apr  5 04:01:58 2009
+++ squashfs4.0/squashfs-tools/pseudo.c	Tue Dec 29 18:07:33 2009
@@ -30,6 +30,11 @@
 #include <string.h>
 #include <stdlib.h>
 #include <sys/types.h>
+#include <sys/param.h>
+
+#if defined(BSD)
+#include <sys/stat.h>
+#endif
 
 #include "pseudo.h"
 
diff -Nur squashfs4.0.orig/squashfs-tools/unsquashfs.c squashfs4.0/squashfs-tools/unsquashfs.c
--- squashfs4.0.orig/squashfs-tools/unsquashfs.c	Sun Apr  5 23:23:06 2009
+++ squashfs4.0/squashfs-tools/unsquashfs.c	Tue Dec 29 18:25:56 2009
@@ -21,6 +21,8 @@
  * unsquashfs.c
  */
 
+#include <sys/param.h>
+
 #include "unsquashfs.h"
 #include "squashfs_swap.h"
 #include "squashfs_compat.h"
@@ -1193,10 +1195,17 @@
 		struct pathname *path = paths->path[n];
 		for(i = 0; i < path->names; i++) {
 			int match = use_regex ?
+#if defined(BSD)
 				regexec(path->name[i].preg, name, (size_t) 0,
 				NULL, 0) == 0 : fnmatch(path->name[i].name,
+				name, FNM_PATHNAME|FNM_PERIOD) ==
+				0;
+#else
+				regexec(path->name[i].preg, name, (size_t) 0,
+				NULL, 0) == 0 : fnmatch(path->name[i].name,
 				name, FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) ==
 				0;
+#endif
 			if(match && path->name[i].paths == NULL)
 				/*
 				 * match on a leaf component, any subdirectories
@@ -1795,21 +1804,7 @@
 
 	if(processors == -1) {
 #ifndef linux
-		int mib[2];
-		size_t len = sizeof(processors);
-
-		mib[0] = CTL_HW;
-#ifdef HW_AVAILCPU
-		mib[1] = HW_AVAILCPU;
-#else
-		mib[1] = HW_NCPU;
-#endif
-
-		if(sysctl(mib, 2, &processors, &len, NULL, 0) == -1) {
-			ERROR("Failed to get number of available processors.  "
-				"Defaulting to 1\n");
-			processors = 1;
-		}
+		processors = 1;
 #else
 		processors = get_nprocs();
 #endif