summaryrefslogtreecommitdiffstats
path: root/sys-apps/util-linux/files/util-linux-2.12-gcloop.patch
blob: 97be88c07b2c8e2685c7a19ec34cda702c3dd1d2 (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
diff -ruN util-linux-2.12.orig/mount/lomount.c util-linux-2.12/mount/lomount.c
--- util-linux-2.12.orig/mount/lomount.c	2004-02-17 02:08:05.341716624 +0100
+++ util-linux-2.12/mount/lomount.c	2004-02-17 02:12:10.653423576 +0100
@@ -60,7 +60,8 @@
         info->lo_flags = info64->lo_flags;
         info->lo_init[0] = info64->lo_init[0];
         info->lo_init[1] = info64->lo_init[1];
-        if (info->lo_encrypt_type == LO_CRYPT_CRYPTOAPI)
+        if ((info->lo_encrypt_type == LO_CRYPT_CRYPTOAPI) ||
+		(info->lo_encrypt_type == LO_CRYPT_COMPRESS))
                 memcpy(info->lo_name, info64->lo_crypt_name, LO_NAME_SIZE);
         else
                 memcpy(info->lo_name, info64->lo_file_name, LO_NAME_SIZE);
@@ -321,7 +322,8 @@
 
 int
 set_loop(const char *device, const char *file, int offset,
-	 const char *encryption, int pfd, int *loopro) {
+	 const char *encnumber,const char *encryption,
+	 int pfd, int *loopro) {
 	struct loop_info64 loopinfo64;
 	int fd, ffd, mode;
 	char *pass;
@@ -344,8 +346,9 @@
 	memset(&loopinfo64, 0, sizeof(loopinfo64));
 
 	xstrncpy(loopinfo64.lo_file_name, file, LO_NAME_SIZE);
-
+			
 	if (encryption && *encryption) {
+
 		if (digits_only(encryption)) {
 			loopinfo64.lo_encrypt_type = atoi(encryption);
 		} else {
@@ -386,6 +389,12 @@
 		}
 	}
 
+	if (encnumber && *encnumber) {
+
+		if (digits_only(encnumber))
+			loopinfo64.lo_encrypt_type = atoi(encnumber);
+	}
+
 	loopinfo64.lo_offset = offset;
 
 #ifdef MCL_FUTURE  
@@ -601,7 +610,7 @@
 
 int
 main(int argc, char **argv) {
-	char *offset, *encryption, *passfd;
+	char *offset, *encryption, *encnumber, *passfd;
 	int delete, off, c;
 	int res = 0;
 	int ro = 0;
@@ -612,7 +621,7 @@
 	textdomain(PACKAGE);
 
 	delete = off = 0;
-	offset = encryption = passfd = NULL;
+	offset = encryption = encnumber = passfd = NULL;
 	progname = argv[0];
 	while ((c = getopt(argc,argv,"de:E:o:p:v")) != -1) {
 		switch (c) {
@@ -620,6 +629,7 @@
 			delete = 1;
 			break;
 		case 'E':
+			encnumber = optarg;
 		case 'e':
 			encryption = optarg;
 			break;
@@ -651,7 +661,7 @@
 		if (passfd && sscanf(passfd,"%d",&pfd) != 1)
 			usage();
 		res = set_loop(argv[optind], argv[optind+1], off,
-			       encryption, pfd, &ro);
+				encnumber, encryption, pfd, &ro);
 	}
 	return res;
 }
diff -ruN util-linux-2.12.orig/mount/lomount.h util-linux-2.12/mount/lomount.h
--- util-linux-2.12.orig/mount/lomount.h	2004-02-17 02:08:05.339716928 +0100
+++ util-linux-2.12/mount/lomount.h	2004-02-17 02:08:14.921260312 +0100
@@ -1,6 +1,6 @@
 extern int verbose;
 extern int set_loop(const char *, const char *, int, const char *,
-		    int, int *);
+		    const char *, int, int *);
 extern int del_loop(const char *);
 extern int is_loop_device(const char *);
 extern char * find_unused_loop_device(void);
diff -ruN util-linux-2.12.orig/mount/loop.h util-linux-2.12/mount/loop.h
--- util-linux-2.12.orig/mount/loop.h	2004-02-17 02:08:05.341716624 +0100
+++ util-linux-2.12/mount/loop.h	2004-02-17 02:08:14.922260160 +0100
@@ -2,6 +2,7 @@
 #define LO_CRYPT_XOR	1
 #define LO_CRYPT_DES	2
 #define LO_CRYPT_CRYPTOAPI 18
+#define LO_CRYPT_COMPRESS  19
 
 #define LOOP_SET_FD		0x4C00
 #define LOOP_CLR_FD		0x4C01
diff -ruN util-linux-2.12.orig/mount/mount.c util-linux-2.12/mount/mount.c
--- util-linux-2.12.orig/mount/mount.c	2004-02-17 02:08:05.281725744 +0100
+++ util-linux-2.12/mount/mount.c	2004-02-17 02:08:14.924259856 +0100
@@ -612,7 +612,7 @@
       offset = opt_offset ? strtoul(opt_offset, NULL, 0) : 0;
       if (opt_keygen)
 	pfd = use_keygen_prog(opt_keygen, keygen_args, _n_keygen_args);
-      if (set_loop(*loopdev, *loopfile, offset,
+      if (set_loop(*loopdev, *loopfile, offset, NULL,
 		   opt_encryption, pfd, &loopro)) {
 	if (verbose)
 	  printf(_("mount: failed setting up loop device\n"));