wok-current rev 23763
fusecloop: multicompressor support (again)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue May 05 20:14:04 2020 +0000 (2020-05-05) |
parents | cea6e929d21e |
children | b534f8a24834 |
files | fusecloop/stuff/fusecloop.u |
line diff
1.1 --- a/fusecloop/stuff/fusecloop.u Tue May 05 11:06:44 2020 +0000 1.2 +++ b/fusecloop/stuff/fusecloop.u Tue May 05 20:14:04 2020 +0000 1.3 @@ -1977,7 +1977,23 @@ 1.4 return 0; 1.5 --- create_compressed_fs.c 1.6 +++ create_compressed_fs.c 1.7 -@@ -179,7 +179,6 @@ 1.8 +@@ -78,6 +78,7 @@ 1.9 + if (lzma_code(&strm, LZMA_FINISH) == LZMA_STREAM_END) { 1.10 + 1.11 + *compressed_len -= strm.avail_out; 1.12 ++ *compressed_len |= (CLOOP_COMPRESSOR_XZ << 28); 1.13 + res = Z_OK; 1.14 + } 1.15 + } 1.16 +@@ -101,6 +102,7 @@ 1.17 + (void) level; 1.18 + if (res <= 0) return Z_ERRNO; 1.19 + *compressed_len = res; 1.20 ++ *compressed_len |= (CLOOP_COMPRESSOR_LZ4 << 28); 1.21 + return Z_OK; 1.22 + } 1.23 + 1.24 +@@ -179,7 +181,6 @@ 1.25 static unsigned long block_size = 0; 1.26 static void flush_index(int sig) 1.27 { 1.28 @@ -1985,7 +2001,7 @@ 1.29 struct cloop_tail tail; 1.30 unsigned long len; 1.31 int flags = 0; 1.32 -@@ -187,24 +186,21 @@ 1.33 +@@ -187,24 +188,21 @@ 1.34 fprintf(stderr, "Write index for %u blocks\n", n); 1.35 if (block_size >= 0x1000000) lastlen = 0; 1.36 if (sig) flags = 0x80; 1.37 @@ -2015,7 +2031,7 @@ 1.38 write(STDOUT_FILENO, compressed, len); 1.39 write(STDOUT_FILENO, &tail, sizeof(tail)); 1.40 exit(sig != 0); 1.41 -@@ -242,7 +238,7 @@ 1.42 +@@ -242,7 +240,7 @@ 1.43 #endif 1.44 block_size = atoi(argv[1]); 1.45 } 1.46 @@ -2024,7 +2040,7 @@ 1.47 block_size = DEFAULT_BLOCKSIZE; 1.48 fprintf(stderr, "Block size is %lu\n", block_size); 1.49 zlenmax = block_size + block_size/1000 + 12; 1.50 -@@ -280,7 +276,7 @@ 1.51 +@@ -280,7 +278,7 @@ 1.52 quit("Realloc hash"); 1.53 } 1.54 hash[n] = md5sum(uncompressed, len); 1.55 @@ -2033,24 +2049,33 @@ 1.56 if (n < j) 1.57 j = n; 1.58 for (i = 0; i < j; i++) { 1.59 -@@ -289,7 +285,7 @@ 1.60 +@@ -289,7 +287,7 @@ 1.61 break; 1.62 } 1.63 if (i != j) { 1.64 - block_index[n] = ntohl(0x80000000 | i); 1.65 -+ block_index[n] = ntohl((CLOOP_COMPRESSOR_LINK >> 28) | i); 1.66 ++ block_index[n] = ntohl((CLOOP_COMPRESSOR_LINK << 28) | i); 1.67 fprintf(stderr, "Block %u length %lu => duplicate %u\n", 1.68 n, block_size, i); 1.69 continue; 1.70 -@@ -299,7 +295,7 @@ 1.71 +@@ -297,14 +295,14 @@ 1.72 + } 1.73 + len = zlenmax; 1.74 if (compress3(compressed, &len, uncompressed, lastlen, 1.75 - Z_BEST_SPEED) != Z_OK || len >= lastlen) { 1.76 +- Z_BEST_SPEED) != Z_OK || len >= lastlen) { 1.77 ++ Z_BEST_SPEED) != Z_OK || (len & 0x0FFFFFFF) >= lastlen) { 1.78 len = lastlen; 1.79 - block_index[n] = ntohl(0xFFFFFFFF); 1.80 -+ block_index[n] = ntohl((CLOOP_COMPRESSOR_NONE >> 28) | lastlen); 1.81 ++ block_index[n] = ntohl((CLOOP_COMPRESSOR_NONE << 28) | lastlen); 1.82 write(STDOUT_FILENO, uncompressed, len); 1.83 } 1.84 else { 1.85 + block_index[n] = ntohl(len); 1.86 +- write(STDOUT_FILENO, compressed, len); 1.87 ++ write(STDOUT_FILENO, compressed, len &= 0x0FFFFFFF); 1.88 + } 1.89 + fprintf(stderr, "Block %u length %lu => %lu\n", 1.90 + n, block_size, len); 1.91 --- extract_compressed_fs.c 1.92 +++ extract_compressed_fs.c 1.93 @@ -69,9 +69,8 @@