summaryrefslogtreecommitdiff
blob: c4ce215e975ab07d6c8153a51f02a9949e357a7b (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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
From 71bd6e496af5990836c34e4dd2d9d0107467349a Mon Sep 17 00:00:00 2001
From: Alon Bar-Lev <alon.barlev@gmail.com>
Date: Tue, 11 Sep 2018 18:49:17 +0300
Subject: [PATCH 1/6] build: do not auto build/install module

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index ec0fd7e..d52f509 100644
--- a/Makefile
+++ b/Makefile
@@ -98,7 +98,7 @@ TESTS_TARGET = $(TARGET_DIR)/tests/bctool-tests
 #
 
 # default target builds console tool with modules
-all: Makefile helpers module console
+all: Makefile helpers console
 	true
 
 rebuild: clean all
@@ -233,7 +233,7 @@ module-clean:
 #
 
 # install for default target
-install: module-install console-install helpers-install
+install: console-install helpers-install
 
 # used by RPM creation script
 build-install: module-put-files console-install helpers-install
-- 
2.16.4

From 42816e0a4e47e77f290b46460e35a1666748f8b0 Mon Sep 17 00:00:00 2001
From: Alon Bar-Lev <alon.barlev@gmail.com>
Date: Tue, 11 Sep 2018 19:35:26 +0300
Subject: [PATCH 2/6] build: remove useless log

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
---
 certificate/CertificateLib/symmetricAlgs/cAlgRIJN.cpp | 2 --
 1 file changed, 2 deletions(-)

diff --git a/certificate/CertificateLib/symmetricAlgs/cAlgRIJN.cpp b/certificate/CertificateLib/symmetricAlgs/cAlgRIJN.cpp
index 3c6fad8..9821073 100644
--- a/certificate/CertificateLib/symmetricAlgs/cAlgRIJN.cpp
+++ b/certificate/CertificateLib/symmetricAlgs/cAlgRIJN.cpp
@@ -78,14 +78,12 @@ cSymAlg * cAlgRIJN::createAlg( BYTE *key, int keySize ) // keySize in bytes
 	return alg;
 }
 
-#include "../../../../fs-lib/log.h"
 int cAlgRIJN::encryptECB(
 		const BYTE *inBf,		// Input plaintext buffer. 
 		BYTE *outBf,	// Output encrypted buffer
 		int  bfSize		// In/out buffers' size.
 		)
 {
-	LIBLOG_INFO("");
 	int i;
 
 	if ((bfSize % BC_BLOCK_SIZE) != 0) return sae_invalidBlockSize;
-- 
2.16.4

From a0ffdc5a135b549b62e1421fcf75d627e0394529 Mon Sep 17 00:00:00 2001
From: Alon Bar-Lev <alon.barlev@gmail.com>
Date: Tue, 11 Sep 2018 19:41:17 +0300
Subject: [PATCH 3/6] build: do not strip binaries

---
 Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index d52f509..a93b850 100644
--- a/Makefile
+++ b/Makefile
@@ -243,9 +243,9 @@ uninstall: before-uninstall module-uninstall console-uninstall helpers-uninstall
 
 helpers-install:
 	install -o root -m 0755 -d $(PREFIX)/sbin
-	install -o root -m 4755 -s $(TARGET_DIR)/bcmount_helper      $(PREFIX)/sbin
-	install -o root -m 4755 -s $(TARGET_DIR)/bcumount_helper     $(PREFIX)/sbin
-	install -o root -m 4755 -s $(TARGET_DIR)/bcrrpart_helper     $(PREFIX)/sbin
+	install -o root -m 4755 $(TARGET_DIR)/bcmount_helper         $(PREFIX)/sbin
+	install -o root -m 4755 $(TARGET_DIR)/bcumount_helper        $(PREFIX)/sbin
+	install -o root -m 4755 $(TARGET_DIR)/bcrrpart_helper        $(PREFIX)/sbin
 
 helpers-uninstall:
 	rm -f $(PREFIX)/sbin/bcmount_helper
@@ -267,7 +267,7 @@ before-uninstall:
 .PHONY: console-install
 console-install:
 	install -o root -m 0755 -d $(PREFIX)/usr/bin
-	install -o root -m 0755 -s build/bctool             $(PREFIX)/usr/bin/
+	install -o root -m 0755 build/bctool                $(PREFIX)/usr/bin/
 	install -o root -m 0755 -d $(PREFIX)/$(MAN_PATH)/man8
 	install -m 644 bctool.8                             $(PREFIX)/$(MAN_PATH)/man8/
 
-- 
2.16.4

From 7947ac3e152da1ed590364b7c8948deb602a5b50 Mon Sep 17 00:00:00 2001
From: Alon Bar-Lev <alon.barlev@gmail.com>
Date: Tue, 11 Sep 2018 18:52:32 +0300
Subject: [PATCH 4/6] build: allow override programs

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
---
 Makefile                            | 11 +++++++----
 certificate/CertificateLib/Makefile |  4 +++-
 disk/Makefile                       |  6 ++++--
 fslib/Makefile                      | 16 +++++++++-------
 kernel/Makefile                     |  5 +++--
 keygens/kgghost/Makefile            |  7 +++++--
 keygens/kgsha/Makefile              |  7 +++++--
 mount/Makefile                      |  9 +++++----
 spacemap/Makefile                   |  6 ++++--
 tests/Makefile                      | 12 ++++++------
 10 files changed, 51 insertions(+), 32 deletions(-)

diff --git a/Makefile b/Makefile
index a93b850..d57ee79 100644
--- a/Makefile
+++ b/Makefile
@@ -56,6 +56,9 @@ KGSHA_LIB = $(KGSHA_BUILD_DIR)/lib$(KGSHA_LIB_NAME).a
 KGGHOST_LIB = $(KGGHOST_BUILD_DIR)/lib$(KGGHOST_LIB_NAME).a
 SPACEMAP_LIB = $(SPACEMAP_BUILD_DIR)/lib$(SPACEMAP_LIB_NAME).a
 
+CC = gcc
+CXX = g++
+
 BC_EXTRA_CFLAGS= $(CFLAGS) -D_LARGE_FILES -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
 BC_EXTRA_LDFLAGS = $(LDFLAGS)
 
@@ -125,7 +128,7 @@ helpers: create-dirs
 console: spacemap-lib certificate-lib fs-lib kernel-lib keygen-libs $(TARGET)
 	true
 $(TARGET): $(BCTOOL_OBJS)
-	g++ $(BCTOOL_OBJS) $(BCTOOL_CFLAGS) $(BCTOOL_LDFLAGS) -o $(TARGET)
+	$(CXX) $(BCTOOL_OBJS) $(BCTOOL_CFLAGS) $(BCTOOL_LDFLAGS) -o $(TARGET)
 
 # GUI executable only (w/o console and helpers)
 panel: certificate-lib kernel-lib keygen-libs fs-lib
@@ -339,10 +342,10 @@ module-uninstall:
 	bash ./scripts/remove_mods
 
 %.o:%.cpp
-	g++ -c $(BCTOOL_CFLAGS) $< -o $@
+	$(CXX) -c $(BCTOOL_CFLAGS) $< -o $@
 
 %.o:%.cc
-	g++ -c $(BCTOOL_CFLAGS) $< -o $@
+	$(CXX) -c $(BCTOOL_CFLAGS) $< -o $@
 
 %.o:%.c
-	gcc -c $(BCTOOL_CFLAGS) $< -o $@
+	$(CC) -c $(BCTOOL_CFLAGS) $< -o $@
diff --git a/certificate/CertificateLib/Makefile b/certificate/CertificateLib/Makefile
index 06353bc..19b772c 100644
--- a/certificate/CertificateLib/Makefile
+++ b/certificate/CertificateLib/Makefile
@@ -1,5 +1,7 @@
 
-CP = cp
+CC = gcc
+CXX = g++
+AR = ar
 CFLAGS += -Wall -fPIC -fno-strict-aliasing
 CXXFLAGS = -Wall -fPIC
 #-Werror
diff --git a/disk/Makefile b/disk/Makefile
index e3915b0..1a9ff01 100644
--- a/disk/Makefile
+++ b/disk/Makefile
@@ -1,14 +1,16 @@
 DISKMON_OBJS = disk.o diskmon.o
+
+CXX = g++
 CFLAGS += -Wall -I. -I../ -p -gdwarf-2 #-DBC_DEBUG
 LDFLAGS += -ludev
 
 all:diskmon Makefile
 
 diskmon:$(DISKMON_OBJS)
-	g++ $(DISKMON_OBJS) $(LDFLAGS) -o diskmon
+	$(CXX) $(DISKMON_OBJS) $(LDFLAGS) -o diskmon
 
 %.o:%.cc
-	g++ $(CFLAGS) -c $< -o $@
+	$(CXX) $(CFLAGS) -c $< -o $@
 
 clean:
 	rm -rf diskmon *.o
diff --git a/fslib/Makefile b/fslib/Makefile
index 9b99e89..0075a9f 100644
--- a/fslib/Makefile
+++ b/fslib/Makefile
@@ -1,3 +1,5 @@
+CC = gcc
+AR = ar
 
 FSLIB_CFLAGS = $(CFLAGS) -Wall -fPIC -O0 -DFSLIB_DEBUG -g  # -O3 
 FSLIB_CFLAGS += -I. -D_LARGE_FILES -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 #-fvisibility=hidden
@@ -17,25 +19,25 @@ FSLIB_TOOLS = file_hfs test_hfs test_info test_free_space diskinfo
 all: Makefile $(FSLIB) $(FSLIB_TOOLS)
 
 $(FSLIB): $(OBJS)
-	ar rcs $(FSLIB) $(OBJS)
+	$(AR) rcs $(FSLIB) $(OBJS)
 
 test_hfs: $(FSLIB) test/test_hfs.o
-	gcc test/test_hfs.o $(OBJS) $(FSLIB_LDFLAGS) -o test_hfs
+	$(CC) test/test_hfs.o $(OBJS) $(FSLIB_LDFLAGS) -o test_hfs
 
 file_hfs: $(FSLIB) test/file_hfs.o
-	gcc test/file_hfs.o $(OBJS) $(FSLIB_LDFLAGS) -o file_hfs
+	$(CC) test/file_hfs.o $(OBJS) $(FSLIB_LDFLAGS) -o file_hfs
 
 test_info: $(FSLIB) test/test_info.o
-	gcc test/test_info.o $(OBJS) $(FSLIB_LDFLAGS) -o test_info
+	$(CC) test/test_info.o $(OBJS) $(FSLIB_LDFLAGS) -o test_info
 	
 test_free_space: $(FSLIB) test/test_free_space.o
-	gcc test/test_free_space.o $(FSLIB_CFLAGS) $(OBJS) $(FSLIB_LDFLAGS) -o test_free_space
+	$(CC) test/test_free_space.o $(FSLIB_CFLAGS) $(OBJS) $(FSLIB_LDFLAGS) -o test_free_space
 	
 diskinfo: $(FSLIB) test/diskinfo.o
-	gcc test/diskinfo.o $(OBJS) $(FSLIB_LDFLAGS) -g  -o diskinfo
+	$(CC) test/diskinfo.o $(OBJS) $(FSLIB_LDFLAGS) -g  -o diskinfo
 
 .c.o:
-	gcc $(FSLIB_CFLAGS) -c $< -o $@
+	$(CC) $(FSLIB_CFLAGS) -c $< -o $@
 	
 clean:
 	rm -rf *~ *.o test/*.o $(OBJS) $(FSLIB) $(FSLIB_TOOLS)
diff --git a/kernel/Makefile b/kernel/Makefile
index 1a71617..4f9760d 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -3,6 +3,7 @@ OBJECTS = $(SOURCES:.cc=.o)
 TARGET_DIR = ./build/
 TARGET = $(TARGET_DIR)/libbckernel.a
 BC_CFLAGS = $(BC_EXTRA_CFLAGS) -fPIC -c -Wall -ludev -L../build/ -lspacemap -I../ -fvisibility=hidden #-fvisibility-inlines-hidden
+CXX = g++
 
 
 ### Build ###
@@ -21,12 +22,12 @@ module: create-dirs force_look
 
 kernel-lib: create-dirs $(TARGET)
 $(TARGET): $(OBJECTS)
-	ar rcs $(TARGET) $(OBJECTS)
+	$(AR) rcs $(TARGET) $(OBJECTS)
 
 $(OBJECTS): Makefile $(SOURCES) BCKernel.h
 	set -e; \
 	for i in $(SOURCES); do \
-		g++ -c $(BC_CFLAGS) $$i -o $${i%.cc}.o; \
+		$(CXX) -c $(BC_CFLAGS) $$i -o $${i%.cc}.o; \
 	done
 
 create-dirs: $(TARGET_DIR)
diff --git a/keygens/kgghost/Makefile b/keygens/kgghost/Makefile
index 65c4bf6..a7b0af8 100644
--- a/keygens/kgghost/Makefile
+++ b/keygens/kgghost/Makefile
@@ -5,10 +5,13 @@ KGGHOST_OBJS = hash.o pbe.o keyblock.o datablock.o kgghost.o
 KGGHOST_CFLAGS = -Wall -fPIC -p -ggdb -I. -I../../ -I../../certificate -DBC_LINUX
 KGGHOST_CFLAGS += $(BC_EXTRA_CFLAGS)
 
+CXX = g++
+AR = ar
+
 all: $(KGGHOST) Makefile
 
 $(KGGHOST):$(KGGHOST_OBJS) $(CERTIFICATE_LIB)
-	ar rcs $(KGGHOST) $(KGGHOST_OBJS)
+	$(AR) rcs $(KGGHOST) $(KGGHOST_OBJS)
 
 $(CERTIFICATE_LIB):
 	make -C ../../certificate/CertificateLib
@@ -17,7 +20,7 @@ $(KERNEL_LIB):
 	make -C ../../kernel/build
 
 %.o:%.cpp
-	g++ $(KGGHOST_CFLAGS) -c -o $@ $<
+	$(CXX) $(KGGHOST_CFLAGS) -c -o $@ $<
 
 clean:
 	rm -f *.o *.ver *~ $(KGGHOST)
diff --git a/keygens/kgsha/Makefile b/keygens/kgsha/Makefile
index d3a33d0..9c8c688 100644
--- a/keygens/kgsha/Makefile
+++ b/keygens/kgsha/Makefile
@@ -10,10 +10,13 @@ KGSHA_OBJS = hash.o datablock.o kgsha.o
 KGSHA_CFLAGS = -Wall -fPIC -p -gdwarf-2 -I. -I../../ -I../../certificate -DBC_LINUX
 KGSHA_CFLAGS += $(EXTRA_CFLAGS)
 
+CXX = g++
+AR = ar
+
 all: $(KGSHA) $(KGSHA_OBJS) Makefile hidden_sector.h defs.h datablock.h
 
 $(KGSHA): $(KGSHA_OBJS) $(CERTIFICATE_LIB) $(KERN_LIB)
-	ar rcs $(KGSHA) $(KGSHA_OBJS)
+	$(AR) rcs $(KGSHA) $(KGSHA_OBJS)
 
 $(CERT_LIB):
 	make -C ../../certificate/CertificateLib
@@ -22,7 +25,7 @@ $(KERN_LIB):
 	make -C ../../kernel/
 
 %.o:%.cpp
-	g++ $(KGSHA_CFLAGS) -c -o $@ $<
+	$(CXX) $(KGSHA_CFLAGS) -c -o $@ $<
 
 clean:
 	rm -f *.o *.ver *~ $(KGSHA)
diff --git a/mount/Makefile b/mount/Makefile
index 7a3d66b..0e60095 100644
--- a/mount/Makefile
+++ b/mount/Makefile
@@ -1,22 +1,23 @@
 
 HELPERS = bcrrpart_helper bcmount_helper bcumount_helper
 
+CC = gcc
 OBJS = common.o
 CFLAGS += -Wall -O3
 
 all: $(HELPERS) Makefile
 
 bcrrpart_helper: $(OBJS) rrpart.o
-	gcc $(OBJS) rrpart.o $(LDFLAGS) -o bcrrpart_helper
+	$(CC) $(OBJS) rrpart.o $(LDFLAGS) -o bcrrpart_helper
 
 bcmount_helper: $(OBJS) mount.o
-	gcc $(OBJS) mount.o $(LDFLAGS) -o bcmount_helper
+	$(CC) $(OBJS) mount.o $(LDFLAGS) -o bcmount_helper
 
 bcumount_helper: $(OBJS) umount.o
-	gcc $(OBJS) umount.o $(LDFLAGS) -o bcumount_helper
+	$(CC) $(OBJS) umount.o $(LDFLAGS) -o bcumount_helper
 	
 %.o:%.c
-	gcc $(CFLAGS) -c -o $@ $<
+	$(CC) $(CFLAGS) -c -o $@ $<
 	
 clean:
 	rm -f *.o *.ver *~ $(HELPERS)
diff --git a/spacemap/Makefile b/spacemap/Makefile
index 6dff240..7dd2ad9 100644
--- a/spacemap/Makefile
+++ b/spacemap/Makefile
@@ -5,17 +5,19 @@ LIB_NAME = spacemap
 STATIC_TARGET = lib$(LIB_NAME).a
 OBJECT_CFLAGS = -fPIC -g -c -Wall -ludev -fvisibility=hidden #-fvisibility-inlines-hidden
 
+CXX = g++
+AR = ar
 
 all: static
 	true
 
 static: $(OBJECTS)
-	ar rcs $(STATIC_TARGET) $(OBJECTS)
+	$(AR) rcs $(STATIC_TARGET) $(OBJECTS)
 
 $(OBJECTS): $(SOURCES)
 	set -e; \
 	for i in $(SOURCES); do \
-		g++ $(OBJECT_CFLAGS) $$i -o $${i%.c}.o; \
+		$(CXX) $(OBJECT_CFLAGS) $$i -o $${i%.c}.o; \
 	done
 
 clean:
diff --git a/tests/Makefile b/tests/Makefile
index c6d78f0..419020b 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -2,8 +2,8 @@ TESTS_PWD = ../build/tests/
 TESTS_TARGET = $(TESTS_PWD)/bctool-tests
 TESTS_SOURCES = tests-main.c ../container/cipher.cc ../keygens/kgsha/datablock.cpp ../keygens/kgsha/hash.cpp ../container/linux/file.cpp
 TESTS_CFLAGS = -I../ -I../certificate/ -L../build/ -L../build/kernel/ -DBC_LINUX -ludev -g
-CP = gcc
-CPP = g++
+CC = gcc
+CXX = g++
 CERT_LIB_NAME = certificate
 KERN_LIB_NAME = bckernel
 SPACEMAP_LIB_NAME = spacemap
@@ -15,11 +15,11 @@ all: $(TESTS_TARGET)
 	cp insert-modules.sh remove-modules.sh bcmod-loaded.sh $(TESTS_PWD)
 
 $(TESTS_TARGET): $(TESTS_SOURCES) Makefile
-	$(CPP) -o $(TESTS_TARGET) $(TESTS_CFLAGS) $(TESTS_SOURCES) -l$(CERT_LIB_NAME) -l$(KERN_LIB_NAME) -l$(SPACEMAP_LIB_NAME) -lcunit -ludev
+	$(CXX) -o $(TESTS_TARGET) $(TESTS_CFLAGS) $(TESTS_SOURCES) -l$(CERT_LIB_NAME) -l$(KERN_LIB_NAME) -l$(SPACEMAP_LIB_NAME) -lcunit -ludev
 	cp kernel/print-struct-size.c $(TESTS_PWD)
-	$(CP) -o $(TESTS_PWD)test-data-generator kernel/test-data-generator.c $(TESTS_CFLAGS) -l$(KERN_LIB_NAME) -l$(SPACEMAP_LIB_NAME)
-	$(CPP) -o $(TESTS_PWD)kgsha-key-generator kgsha/kgsha-data-generator.cpp ../keygens/kgsha/datablock.cpp ../keygens/kgsha/hash.cpp ../container/cipher.cc  $(TESTS_CFLAGS) -l$(KERN_LIB_NAME) -l$(CERT_LIB_NAME) -l$(SPACEMAP_LIB_NAME)
-	$(CP) -o $(TESTS_PWD)/bcdevchecker bcdevchecker.c
+	$(CC) -o $(TESTS_PWD)test-data-generator kernel/test-data-generator.c $(TESTS_CFLAGS) -l$(KERN_LIB_NAME) -l$(SPACEMAP_LIB_NAME)
+	$(CXX) -o $(TESTS_PWD)kgsha-key-generator kgsha/kgsha-data-generator.cpp ../keygens/kgsha/datablock.cpp ../keygens/kgsha/hash.cpp ../container/cipher.cc  $(TESTS_CFLAGS) -l$(KERN_LIB_NAME) -l$(CERT_LIB_NAME) -l$(SPACEMAP_LIB_NAME)
+	$(CC) -o $(TESTS_PWD)/bcdevchecker bcdevchecker.c
 
 clean:
 	rm -rf $(TESTS_PWD)
-- 
2.16.4

From a7e9a6048e443b0a592c56b1b48e66d20092cf76 Mon Sep 17 00:00:00 2001
From: Alon Bar-Lev <alon.barlev@gmail.com>
Date: Tue, 11 Sep 2018 19:34:59 +0300
Subject: [PATCH 5/6] build: add missing sys/sysmacros.h

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
---
 mount/common.c | 1 +
 mount/mount.c  | 1 +
 mount/rrpart.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/mount/common.c b/mount/common.c
index 0a14ea4..d88394e 100644
--- a/mount/common.c
+++ b/mount/common.c
@@ -9,6 +9,7 @@
 #include <stdarg.h>
 #include <errno.h>
 #include <unistd.h>
+#include <sys/sysmacros.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
diff --git a/mount/mount.c b/mount/mount.c
index c57594f..7c802fe 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -10,6 +10,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
+#include <sys/sysmacros.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
diff --git a/mount/rrpart.c b/mount/rrpart.c
index f7ce125..7ba5692 100644
--- a/mount/rrpart.c
+++ b/mount/rrpart.c
@@ -13,6 +13,7 @@
 #include <unistd.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
+#include <sys/sysmacros.h>
 #include <sys/types.h>
 #include <linux/fs.h>
 
-- 
2.16.4

From 9cb62cc4cbe9cb929aa1fca34d3d807a4e83bcca Mon Sep 17 00:00:00 2001
From: Alon Bar-Lev <alon.barlev@gmail.com>
Date: Tue, 11 Sep 2018 19:12:13 +0300
Subject: [PATCH 6/6] modules: build for kernel-4.14

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
---
 kernel/kmod/bc_dev.c | 4 +++-
 kernel/kmod/bc_mem.c | 1 +
 spacemap/defs.h      | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/kmod/bc_dev.c b/kernel/kmod/bc_dev.c
index cddbf49..8b5657b 100644
--- a/kernel/kmod/bc_dev.c
+++ b/kernel/kmod/bc_dev.c
@@ -86,9 +86,11 @@ static void reject_bio(struct bio *bio)
 {
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0))
             bio_endio(bio, -EIO);
-#else
+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0))
             bio->bi_error = -EIO;
             bio_endio(bio);
+#else
+            bio_io_error(bio);
 #endif
 }
 
diff --git a/kernel/kmod/bc_mem.c b/kernel/kmod/bc_mem.c
index 0b516c8..69ec832 100644
--- a/kernel/kmod/bc_mem.c
+++ b/kernel/kmod/bc_mem.c
@@ -6,6 +6,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/kernel.h>
+#include <linux/sched.h>
 #include <asm/uaccess.h>
 
 #define BC_GET_CALLER_PTR __builtin_return_address(0)
diff --git a/spacemap/defs.h b/spacemap/defs.h
index f0c87ba..7de9052 100644
--- a/spacemap/defs.h
+++ b/spacemap/defs.h
@@ -17,6 +17,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/slab.h>
+#include <linux/sched.h>
 #include <asm/uaccess.h>
 
 typedef int8_t		bc_8;
-- 
2.16.4