wok diff fusecloop/stuff/fusecloop.u @ rev 15649

Up: hubbub (0.1.2)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Dec 10 16:06:02 2013 +0000 (2013-12-10)
parents 297bc4cc8984
children ade6b9da6804
line diff
     1.1 --- a/fusecloop/stuff/fusecloop.u	Mon Apr 02 22:48:21 2012 +0200
     1.2 +++ b/fusecloop/stuff/fusecloop.u	Tue Dec 10 16:06:02 2013 +0000
     1.3 @@ -165,7 +165,7 @@
     1.4   		exit(1);
     1.5   	}
     1.6   
     1.7 -@@ -24,44 +28,91 @@
     1.8 +@@ -24,44 +28,99 @@
     1.9   		exit(1);
    1.10   	}
    1.11   
    1.12 @@ -226,13 +226,15 @@
    1.13  +	fprintf(stderr, "Index %s.\n", build_index(offsets, num_blocks));
    1.14  +	
    1.15  +	if (argc > 2) {
    1.16 ++		unsigned n;
    1.17  +		loff_t data, offset = ((num_blocks + 1) * sizeof(offset)) + sizeof(head);
    1.18  +		
    1.19  +		strcpy(head.preamble, CLOOP_PREAMBLE);
    1.20 -+		write(STDOUT_FILENO, &head, sizeof(head));
    1.21 ++		write(STDOUT_FILENO, &head, n = sizeof(head));
    1.22  +		for (i = 0; i < num_blocks; i++) {
    1.23  +			data = __be64_to_cpu(offset);
    1.24  +			write(STDOUT_FILENO, &data, sizeof(data));
    1.25 ++			n += sizeof(data);
    1.26  +			offset += offsets[i].size;
    1.27  +		}
    1.28  +		data = __be64_to_cpu(offset);
    1.29 @@ -240,6 +242,12 @@
    1.30  +		for (i = 0; i < num_blocks && lseek64(handle, offsets[i].offset, SEEK_SET) >= 0; i++) {
    1.31  +			read(handle, buffer, offsets[i].size);
    1.32  +			write(STDOUT_FILENO, buffer, offsets[i].size);
    1.33 ++			n += offsets[i].size;
    1.34 ++		}
    1.35 ++		n &= 0x1FF;
    1.36 ++		if (n) {
    1.37 ++			memset(buffer, 0, 512);
    1.38 ++			write(STDOUT_FILENO, buffer, 512 - n);
    1.39  +		}
    1.40  +		return 0;
    1.41  +	}
    1.42 @@ -283,7 +291,7 @@
    1.43   		if (i == 3) {
    1.44   			fprintf(stderr,
    1.45   				"Block head:%02X%02X%02X%02X%02X%02X%02X%02X\n",
    1.46 -@@ -105,12 +156,12 @@
    1.47 +@@ -105,12 +164,12 @@
    1.48   			fprintf(stderr, "Uncomp: unknown error %u\n", i);
    1.49   			exit(1);
    1.50   		}