diff options
author | Andres Salomon <dilinger@queued.net> | 2011-10-16 18:15:23 -0700 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2011-10-19 17:22:21 +0300 |
commit | 123005f3ccfa58637ad6e1a8b9f7f3f861ca65f4 (patch) | |
tree | a9bd8a539d9c950f47514a5f94f65c25c09e3b6c /fs/jffs2/super.c | |
parent | 92abc475d8de1c29373f6d96ed63d8ecaa199d25 (diff) |
jffs2: add compr=lzo and compr=zlib options
..to allow forcing of either compression scheme. This will override
compiled-in defaults. jffs2_compress is reworked a bit, as the lzo/zlib
override shares lots of code w/ the PRIORITY mode.
v2: update show_options accordingly.
Signed-off-by: Andres Salomon <dilinger@queued.net>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Diffstat (limited to 'fs/jffs2/super.c')
-rw-r--r-- | fs/jffs2/super.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 40f6e6385fd1..e7e974454115 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c @@ -82,6 +82,14 @@ static const char *jffs2_compr_name(unsigned int compr) switch (compr) { case JFFS2_COMPR_MODE_NONE: return "none"; +#ifdef CONFIG_JFFS2_LZO + case JFFS2_COMPR_MODE_FORCELZO: + return "lzo"; +#endif +#ifdef CONFIG_JFFS2_ZLIB + case JFFS2_COMPR_MODE_FORCEZLIB: + return "zlib"; +#endif default: /* should never happen; programmer error */ WARN_ON(1); @@ -195,11 +203,25 @@ static int jffs2_parse_options(struct jffs2_sb_info *c, char *data) if (!name) return -ENOMEM; - if (!strcmp(name, "none")) { + if (!strcmp(name, "none")) c->mount_opts.compr = JFFS2_COMPR_MODE_NONE; - c->mount_opts.override_compr = true; +#ifdef CONFIG_JFFS2_LZO + else if (!strcmp(name, "lzo")) + c->mount_opts.compr = JFFS2_COMPR_MODE_FORCELZO; +#endif +#ifdef CONFIG_JFFS2_ZLIB + else if (!strcmp(name, "zlib")) + c->mount_opts.compr = + JFFS2_COMPR_MODE_FORCEZLIB; +#endif + else { + printk(KERN_ERR "JFFS2 Error: unknown compressor \"%s\"", + name); + kfree(name); + return -EINVAL; } kfree(name); + c->mount_opts.override_compr = true; break; default: printk(KERN_ERR "JFFS2 Error: unrecognized mount option '%s' or missing value\n", |