wok rev 4704

squashfs: version 3 lzma support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Jan 03 21:15:05 2010 +0100 (2010-01-03)
parents 335b02e4e8c8
children 359526689366
files squashfs/stuff/lzma.u
line diff
     1.1 --- a/squashfs/stuff/lzma.u	Sun Jan 03 17:58:12 2010 +0000
     1.2 +++ b/squashfs/stuff/lzma.u	Sun Jan 03 21:15:05 2010 +0100
     1.3 @@ -2233,3 +2233,43 @@
     1.4   #include <sys/mman.h>
     1.5   #include <utime.h>
     1.6   #include <pwd.h>
     1.7 +
     1.8 +--- squashfs-4.0/squashfs-tools/squashfs_fs.h
     1.9 ++++ squashfs-4.0/squashfs-tools/squashfs_fs.h
    1.10 +@@ -28,6 +28,8 @@
    1.11 + #define SQUASHFS_MINOR			0
    1.12 + #define SQUASHFS_MAGIC			0x73717368
    1.13 + #define SQUASHFS_MAGIC_SWAP		0x68737173
    1.14 ++#define SQUASHFS_MAGIC_OLD_LZMA		0x71736873
    1.15 ++#define SQUASHFS_MAGIC_OLD_LZMA_SWAP	0x73687371
    1.16 + #define SQUASHFS_START			0
    1.17 + 
    1.18 + /* size of metadata (inode and directory) blocks */
    1.19 +
    1.20 +--- squashfs-4.0/squashfs-tools/unsquashfs.c
    1.21 ++++ squashfs-4.0/squashfs-tools/unsquashfs.c
    1.22 +@@ -1473,8 +1473,10 @@
    1.23 + 	 * Check it is a SQUASHFS superblock
    1.24 + 	 */
    1.25 + 	swap = 0;
    1.26 +-	if(sBlk_3.s_magic != SQUASHFS_MAGIC) {
    1.27 +-		if(sBlk_3.s_magic == SQUASHFS_MAGIC_SWAP) {
    1.28 ++	if(sBlk_3.s_magic != SQUASHFS_MAGIC  &&
    1.29 ++	   sBlk_3.s_magic != SQUASHFS_MAGIC_OLD_LZMA) {
    1.30 ++		if(sBlk_3.s_magic == SQUASHFS_MAGIC_SWAP ||
    1.31 ++		   sBlk_3.s_magic == SQUASHFS_MAGIC_OLD_LZMA_SWAP) {
    1.32 + 			squashfs_super_block_3 sblk;
    1.33 + 			ERROR("Reading a different endian SQUASHFS filesystem "
    1.34 + 				"on %s\n", source);
    1.35 +@@ -1552,7 +1554,10 @@
    1.36 + 	 * 1.x, 2.x and 3.x filesystems use gzip compression.  Gzip is always
    1.37 + 	 * suppported.
    1.38 + 	 */
    1.39 +-	comp = lookup_compressor("gzip");
    1.40 ++	if (sBlk_3.s_magic == SQUASHFS_MAGIC_OLD_LZMA ||
    1.41 ++	    sBlk_3.s_magic == SQUASHFS_MAGIC_OLD_LZMA_SWAP)
    1.42 ++		comp = lookup_compressor("lzma");
    1.43 ++	else	comp = lookup_compressor("gzip");
    1.44 + 	return TRUE;
    1.45 + 
    1.46 + failed_mount: