diff options
Diffstat (limited to 'fs/cramfs')
| -rw-r--r-- | fs/cramfs/Kconfig | 5 | ||||
| -rw-r--r-- | fs/cramfs/inode.c | 54 | ||||
| -rw-r--r-- | fs/cramfs/internal.h | 4 | ||||
| -rw-r--r-- | fs/cramfs/uncompress.c | 2 | 
4 files changed, 42 insertions, 23 deletions
diff --git a/fs/cramfs/Kconfig b/fs/cramfs/Kconfig index cd06466f365..11b29d491b7 100644 --- a/fs/cramfs/Kconfig +++ b/fs/cramfs/Kconfig @@ -1,5 +1,5 @@  config CRAMFS -	tristate "Compressed ROM file system support (cramfs)" +	tristate "Compressed ROM file system support (cramfs) (OBSOLETE)"  	depends on BLOCK  	select ZLIB_INFLATE  	help @@ -16,4 +16,7 @@ config CRAMFS  	  cramfs.  Note that the root file system (the one containing the  	  directory /) cannot be compiled as a module. +	  This filesystem is obsoleted by SquashFS, which is much better +	  in terms of performance and features. +  	  If unsure, say N. diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index e501ac3a49f..ddcfe590b8a 100644 --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c @@ -17,14 +17,30 @@  #include <linux/init.h>  #include <linux/string.h>  #include <linux/blkdev.h> -#include <linux/cramfs_fs.h>  #include <linux/slab.h> -#include <linux/cramfs_fs_sb.h>  #include <linux/vfs.h>  #include <linux/mutex.h> - +#include <uapi/linux/cramfs_fs.h>  #include <asm/uaccess.h> +#include "internal.h" + +/* + * cramfs super-block data in memory + */ +struct cramfs_sb_info { +	unsigned long magic; +	unsigned long size; +	unsigned long blocks; +	unsigned long files; +	unsigned long flags; +}; + +static inline struct cramfs_sb_info *CRAMFS_SB(struct super_block *sb) +{ +	return sb->s_fs_info; +} +  static const struct super_operations cramfs_ops;  static const struct inode_operations cramfs_dir_inode_operations;  static const struct file_operations cramfs_directory_operations; @@ -179,8 +195,7 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i  		struct page *page = NULL;  		if (blocknr + i < devsize) { -			page = read_mapping_page_async(mapping, blocknr + i, -									NULL); +			page = read_mapping_page(mapping, blocknr + i, NULL);  			/* synchronous error? */  			if (IS_ERR(page))  				page = NULL; @@ -219,14 +234,16 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i  	return read_buffers[buffer] + offset;  } -static void cramfs_put_super(struct super_block *sb) +static void cramfs_kill_sb(struct super_block *sb)  { -	kfree(sb->s_fs_info); -	sb->s_fs_info = NULL; +	struct cramfs_sb_info *sbi = CRAMFS_SB(sb); +	kill_block_super(sb); +	kfree(sbi);  }  static int cramfs_remount(struct super_block *sb, int *flags, char *data)  { +	sync_filesystem(sb);  	*flags |= MS_RDONLY;  	return 0;  } @@ -261,7 +278,7 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)  		if (super.magic == CRAMFS_MAGIC_WEND) {  			if (!silent)  				printk(KERN_ERR "cramfs: wrong endianness\n"); -			goto out; +			return -EINVAL;  		}  		/* check at 512 byte offset */ @@ -273,20 +290,20 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)  				printk(KERN_ERR "cramfs: wrong endianness\n");  			else if (!silent)  				printk(KERN_ERR "cramfs: wrong magic\n"); -			goto out; +			return -EINVAL;  		}  	}  	/* get feature flags first */  	if (super.flags & ~CRAMFS_SUPPORTED_FLAGS) {  		printk(KERN_ERR "cramfs: unsupported filesystem features\n"); -		goto out; +		return -EINVAL;  	}  	/* Check that the root inode is in a sane state */  	if (!S_ISDIR(super.root.mode)) {  		printk(KERN_ERR "cramfs: root is not a directory\n"); -		goto out; +		return -EINVAL;  	}  	/* correct strange, hard-coded permissions of mkcramfs */  	super.root.mode |= (S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); @@ -310,22 +327,18 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)  		  (root_offset != 512 + sizeof(struct cramfs_super))))  	{  		printk(KERN_ERR "cramfs: bad root offset %lu\n", root_offset); -		goto out; +		return -EINVAL;  	}  	/* Set it all up.. */  	sb->s_op = &cramfs_ops;  	root = get_cramfs_inode(sb, &super.root, 0);  	if (IS_ERR(root)) -		goto out; +		return PTR_ERR(root);  	sb->s_root = d_make_root(root);  	if (!sb->s_root) -		goto out; +		return -ENOMEM;  	return 0; -out: -	kfree(sbi); -	sb->s_fs_info = NULL; -	return -EINVAL;  }  static int cramfs_statfs(struct dentry *dentry, struct kstatfs *buf) @@ -550,7 +563,6 @@ static const struct inode_operations cramfs_dir_inode_operations = {  };  static const struct super_operations cramfs_ops = { -	.put_super	= cramfs_put_super,  	.remount_fs	= cramfs_remount,  	.statfs		= cramfs_statfs,  }; @@ -565,7 +577,7 @@ static struct file_system_type cramfs_fs_type = {  	.owner		= THIS_MODULE,  	.name		= "cramfs",  	.mount		= cramfs_mount, -	.kill_sb	= kill_block_super, +	.kill_sb	= cramfs_kill_sb,  	.fs_flags	= FS_REQUIRES_DEV,  };  MODULE_ALIAS_FS("cramfs"); diff --git a/fs/cramfs/internal.h b/fs/cramfs/internal.h new file mode 100644 index 00000000000..349d7127215 --- /dev/null +++ b/fs/cramfs/internal.h @@ -0,0 +1,4 @@ +/* Uncompression interfaces to the underlying zlib */ +int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen); +int cramfs_uncompress_init(void); +void cramfs_uncompress_exit(void); diff --git a/fs/cramfs/uncompress.c b/fs/cramfs/uncompress.c index 023329800d2..1760c1b84d9 100644 --- a/fs/cramfs/uncompress.c +++ b/fs/cramfs/uncompress.c @@ -19,7 +19,7 @@  #include <linux/errno.h>  #include <linux/vmalloc.h>  #include <linux/zlib.h> -#include <linux/cramfs_fs.h> +#include "internal.h"  static z_stream stream;  static int initialized;  | 
