Cramfs and Squashfs diffs
Index: init/do_mounts.c
===================================================================
***************
*** 11,24 ****
--- 11,27 ----
#include <linux/nfs_fs.h>
#include <linux/nfs_fs_sb.h>
#include <linux/nfs_mount.h>
#include <linux/minix_fs.h>
#include <linux/ext2_fs.h>
#include <linux/romfs_fs.h>
+ #include <linux/cramfs_fs.h>
+ #include <linux/cramfs_fs_sb.h>
+ #include <linux/squashfs_fs.h>
#define BUILD_CRAMDISK
extern int get_filesystem_list(char * buf);
extern asmlinkage long sys_mount(char *dev_name, char *dir_name, char *type,
unsigned long flags, void *data);
***************
*** 459,490 ****
--- 462,499 ----
* numbers could not be found.
*
* We currently check for the following magic numbers:
* minix
* ext2
* romfs
* gzip
+ * cramfs
+ * squashfs
*/
static int __init
identify_ramdisk_image(int fd, int start_block)
{
const int size = 512;
struct minix_super_block *minixsb;
struct ext2_super_block *ext2sb;
struct romfs_super_block *romfsb;
+ struct cramfs_super *cramfsb;
+ struct squashfs_super_block *squashfsb;
int nblocks = -1;
unsigned char *buf;
buf = kmalloc(size, GFP_KERNEL);
if (buf == 0)
return -1;
minixsb = (struct minix_super_block *) buf;
ext2sb = (struct ext2_super_block *) buf;
romfsb = (struct romfs_super_block *) buf;
+ cramfsb = (struct cramfs_super *) buf;
+ squashfsb = (struct squashfs_super_block *) buf;
memset(buf, 0xe5, size);
/*
* Read block 0 to test for gzipped kernel
*/
lseek(fd, start_block * BLOCK_SIZE, 0);
read(fd, buf, size);
***************
*** 508,521 ****
--- 517,548 ----
printk(KERN_NOTICE
"RAMDISK: romfs filesystem found at block %d\n",
start_block);
nblocks = (ntohl(romfsb->size)+BLOCK_SIZE-1)>>BLOCK_SIZE_BITS;
goto done;
}
+ /* cramfs is at block zero too */
+ if (cramfsb->magic == CRAMFS_MAGIC) {
+ printk(KERN_NOTICE
+ "RAMDISK: cramfs filesystem found at block %d\n",
+ start_block);
+ nblocks = (cramfsb->size+BLOCK_SIZE-1)>>BLOCK_SIZE_BITS;
+ goto done;
+ }
+
+ /* squashfs is at block zero too */
+ if (squashfsb->s_magic == SQUASHFS_MAGIC) {
+ printk(KERN_NOTICE
+ "RAMDISK: squashfs filesystem found at block %d\n",
+ start_block);
+ nblocks = (squashfsb->bytes_used+BLOCK_SIZE-1)>>BLOCK_SIZE_BITS;
+ goto done;
+ }
+
/*
* Read block 1 to test for minix and ext2 superblock
*/
lseek(fd, (start_block+1) * BLOCK_SIZE, 0);
read(fd, buf, size);
/* Try minix */