Re: [PATCH 1/2 ] Add support LZO in cramfs

From: Michael Tokarev
Date: Sat Oct 27 2007 - 05:10:04 EST


vince kim wrote:
> This is a kernel patch to add support LZO compression in cramfs.
[]
> --- linux-2.6.23/fs/cramfs/inode.c 2007-10-09 13:31:38.000000000 -0700
> +++ linux-2.6.23_cramfs_lzo/fs/cramfs/inode.c 2007-10-26 14:35:59.000000000 -0700
> @@ -31,6 +31,8 @@
> static const struct inode_operations cramfs_dir_inode_operations;
> static const struct file_operations cramfs_directory_operations;
> static const struct address_space_operations cramfs_aops;
> +/* function pointer to uncompress block */
> +static int (* cramfs_uncompress_block) (void *dst, int dstlen, void *src, int srclen);

Shouldn't this pointer be mountpoint-specific? I mean,
if I've two cramfs images, one using zlib and another
using lzo, the two will not work at the same time.

[]
> --- linux-2.6.23/fs/Kconfig 2007-10-09 13:31:38.000000000 -0700
> +++ linux-2.6.23_cramfs_lzo/fs/Kconfig 2007-10-26 14:19:01.000000000 -0700
> @@ -1348,6 +1348,7 @@
> tristate "Compressed ROM file system support (cramfs)"
> depends on BLOCK
> select ZLIB_INFLATE
> + select LZO_DECOMPRESS
> help
> Saying Y here includes support for CramFs (Compressed ROM File
> System). CramFs is designed to be a simple, small, and compressed

Hmm. How about using modular decompressor? I mean,
it isn't really necessary for a given config to handle
both lzo- and zlib-compressed cramfs images, only one
may be needed, so the other compression library becomes
a useless dependency. This is especially important for
embedded environments where memory/disk space is limited.
Since you're using a pointer-to-function anyway, it can
be done fully dynamically, by requesting a module to de-
compress the thing at runtime. Pretty much like it's
done f.e. in crypto/ipsec layer currently.

By the way, your patch is word-wrapped.

/mjt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/