wok-6.x rev 18828

cloop: deduplicate support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Jan 17 14:10:13 2016 +0100 (2016-01-17)
parents abbb1698abc0
children 74ce1799eee7
files fusecloop/stuff/fusecloop.u linux-cloop/stuff/cloop.u linux64-cloop/stuff/cloop.u qemu/stuff/cloop.u
line diff
     1.1 --- a/fusecloop/stuff/fusecloop.u	Sun Jan 17 11:38:57 2016 +0100
     1.2 +++ b/fusecloop/stuff/fusecloop.u	Sun Jan 17 14:10:13 2016 +0100
     1.3 @@ -1,6 +1,6 @@
     1.4  --- compressed_loop.h
     1.5  +++ compressed_loop.h
     1.6 -@@ -41,6 +41,75 @@
     1.7 +@@ -41,6 +41,80 @@
     1.8   /* data_index (num_blocks 64bit pointers, network order)...      */
     1.9   /* compressed data (gzip block compressed format)...             */
    1.10   
    1.11 @@ -67,7 +67,12 @@
    1.12  +			offsets[i].size = ntohl(ofs32[i]); 
    1.13  +		for (i = 0, j = sizeof(struct cloop_head); i < n; i++) {
    1.14  +			offsets[i].offset = j;
    1.15 -+			j += offsets[i].size;
    1.16 ++			if (offsets[i].size & 0x80000000) {
    1.17 ++				unsigned long k = offset[i].size & 0x7FFFFFFF;
    1.18 ++				offsets[i].offset = offsets[k].offset;
    1.19 ++				offsets[i].size = offsets[k].size;
    1.20 ++			}
    1.21 ++			else j += offsets[i].size;
    1.22  +		}
    1.23  +		return (char *) "32BE v3.0";
    1.24  +	}
     2.1 --- a/linux-cloop/stuff/cloop.u	Sun Jan 17 11:38:57 2016 +0100
     2.2 +++ b/linux-cloop/stuff/cloop.u	Sun Jan 17 14:10:13 2016 +0100
     2.3 @@ -1,6 +1,6 @@
     2.4  --- cloop.h
     2.5  +++ cloop.h
     2.6 -@@ -20,6 +20,75 @@
     2.7 +@@ -20,6 +20,80 @@
     2.8   /* data_index (num_blocks 64bit pointers, network order)...      */
     2.9   /* compressed data (gzip block compressed format)...             */
    2.10   
    2.11 @@ -67,7 +67,12 @@
    2.12  +			offsets[i].size = ntohl(ofs32[i]); 
    2.13  +		for (i = 0, j = sizeof(struct cloop_head); i < n; i++) {
    2.14  +			offsets[i].offset = j;
    2.15 -+			j += offsets[i].size;
    2.16 ++			if (offsets[i].size & 0x80000000) {
    2.17 ++				unsigned long k = offset[i].size & 0x7FFFFFFF;
    2.18 ++				offsets[i].offset = offsets[k].offset;
    2.19 ++				offsets[i].size = offsets[k].size;
    2.20 ++			}
    2.21 ++			else j += offsets[i].size;
    2.22  +		}
    2.23  +		return (char *) "32BE v3.0";
    2.24  +	}
     3.1 --- a/linux64-cloop/stuff/cloop.u	Sun Jan 17 11:38:57 2016 +0100
     3.2 +++ b/linux64-cloop/stuff/cloop.u	Sun Jan 17 14:10:13 2016 +0100
     3.3 @@ -1,6 +1,6 @@
     3.4  --- cloop.h
     3.5  +++ cloop.h
     3.6 -@@ -20,6 +20,75 @@
     3.7 +@@ -20,6 +20,80 @@
     3.8   /* data_index (num_blocks 64bit pointers, network order)...      */
     3.9   /* compressed data (gzip block compressed format)...             */
    3.10   
    3.11 @@ -67,7 +67,12 @@
    3.12  +			offsets[i].size = ntohl(ofs32[i]); 
    3.13  +		for (i = 0, j = sizeof(struct cloop_head); i < n; i++) {
    3.14  +			offsets[i].offset = j;
    3.15 -+			j += offsets[i].size;
    3.16 ++			if (offsets[i].size & 0x80000000) {
    3.17 ++				unsigned long k = offset[i].size & 0x7FFFFFFF;
    3.18 ++				offsets[i].offset = offsets[k].offset;
    3.19 ++				offsets[i].size = offsets[k].size;
    3.20 ++			}
    3.21 ++			else j += offsets[i].size;
    3.22  +		}
    3.23  +		return (char *) "32BE v3.0";
    3.24  +	}
     4.1 --- a/qemu/stuff/cloop.u	Sun Jan 17 11:38:57 2016 +0100
     4.2 +++ b/qemu/stuff/cloop.u	Sun Jan 17 14:10:13 2016 +0100
     4.3 @@ -1,6 +1,6 @@
     4.4  --- block/cloop.c
     4.5  +++ block/cloop.c
     4.6 -@@ -29,11 +29,85 @@
     4.7 +@@ -29,11 +29,90 @@
     4.8   /* Maximum compressed block size */
     4.9   #define MAX_BLOCK_SIZE (64 * 1024 * 1024)
    4.10   
    4.11 @@ -72,7 +72,12 @@
    4.12  +		}
    4.13  +		for (i = 0, j = 128 + 4 + 4; i < n; i++) {
    4.14  +			offsets[i].offset = j;
    4.15 -+			j += offsets[i].size;
    4.16 ++			if (offsets[i].size & 0x80000000) {
    4.17 ++				unsigned long k = offset[i].size & 0x7FFFFFFF;
    4.18 ++				offsets[i].offset = offsets[k].offset;
    4.19 ++				offsets[i].size = offsets[k].size;
    4.20 ++			}
    4.21 ++			else j += offsets[i].size;
    4.22  +		}
    4.23  +	}
    4.24  +	return 0;