jffs2: Allow selection of compression mode via a sysfs attribute
Subsystems (4)
PATCH 4/5 jffs2: Allow selection of compression mode via a sysfs attribute
Allow selection of the compression mode for jffs2 via a sysfs attribute. This establishes a sysfs presence for jffs2 through which other compression options could easily be exported too.
--- fs/Kconfig | 9 ++++++++ fs/jffs2/compr.c | 41 ++++++++++++++++++++++++++++++++++++ fs/jffs2/compr.h | 6 +++++ fs/jffs2/super.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 117 insertions(+), 0 deletions(-)
fs/Kconfig +9 -0
@@ -1283,6 +1283,15 @@ config JFFS2_FS_SECURITY If you are not using a security module that requires using extended attributes for file security labels, say N. +config JFFS2_SYSFS + bool "JFFS2 sysfs attributes" + depends on JFFS2_FS + default n + help + Enable control of jffs2 features through sysfs. + + If unsure, say 'N'. + config JFFS2_COMPRESSION_OPTIONS bool "Advanced compression options for JFFS2" depends on JFFS2_FS
fs/jffs2/compr.c +41 -0
53 lines not on this page · raw message
fs/jffs2/compr.h +6 -0
@@ -77,6 +77,12 @@ int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,void jffs2_free_comprbuf (unsigned char *comprbuf,unsigned char *orig); +#ifdef CONFIG_JFFS2_SYSFS +int jffs2_set_compression_mode_name (const char *mode_name); +char *jffs2_get_compression_mode_name (void ); +#endif + +/* Compressor modules */ /* These functions will be called by jffs2_compressors_init/exit */
fs/jffs2/super.c +61 -0
79 lines not on this page · raw message
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 19 lines · On Tue, 01 May 2007 15:47:19 +0100 Richard Purdie wrote:
Allow selection of the compression mode for jffs2 via a sysfs attribute. This establishes a sysfs presence for jffs2 through which other compression options could easily be exported too.
Signed-off-by Richard Purdie <[email protected]>--- fs/Kconfig | 9 ++++++++ fs/jffs2/compr.c | 41 ++++++++++++++++++++++++++++++++++++ fs/jffs2/compr.h | 6 +++++ fs/jffs2/super.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 117 insertions(+), 0 deletions(-)fs/Kconfig +0
-0fs/jffs2/compr.c +0
-0
fs/jffs2/compr.c line 14
Quoted 4 lines
fs/jffs2/compr.c +1
-0@@ -11,6 +11,7 @@* */ +#include <linux/kobject.h>
is that used/needed in this source file?
Quoted 12 lines
fs/jffs2/compr.c +5
-0#include "compr.h" static DEFINE_SPINLOCK (jffs2_compressor_list_lock);@@ -296,6 +297,46 @@ int jffs2_unregister_compressor(struct jffs2_compressor *comp)return 0 ; } +#ifdef CONFIG_JFFS2_SYSFS + +char *jffs2_get_compression_mode_name (void ) +{ +switch (jffs2_compression_mode) {
fs/jffs2/compr.c int jffs2_unregister_compressor(struct jffs2_compressor *comp) · line 314
Quoted 10 lines
fs/jffs2/compr.c +10
-0+case JFFS2_COMPR_MODE_NONE : +return "none" ; +case JFFS2_COMPR_MODE_PRIORITY : +return "priority" ; +case JFFS2_COMPR_MODE_SIZE : +return "size" ; +case JFFS2_COMPR_MODE_FAVOURLZO : +return "favourlzo" ; + } +return "unkown" ;
Lots of whitespace damage above (needs tabs).
Quoted 11 lines
fs/jffs2/compr.c +11
-0+} + +int jffs2_set_compression_mode_name (const char *name) +{ +if (!strncmp ("none" , name,4 )) { + jffs2_compression_mode =JFFS2_COMPR_MODE_NONE ; +return 0 ; + } +if (!strncmp ("priority" , name,8 )) { + jffs2_compression_mode =JFFS2_COMPR_MODE_PRIORITY ; +return 0 ;
fs/jffs2/compr.c int jffs2_unregister_compressor(struct jffs2_compressor *comp) · line 335
Quoted 10 lines
fs/jffs2/compr.c +10
-0+ } +if (!strncmp ("size" , name,4 )) { + jffs2_compression_mode =JFFS2_COMPR_MODE_SIZE ; +return 0 ; + } +if (!strncmp ("favourlzo" , name,9 )) { + jffs2_compression_mode =JFFS2_COMPR_MODE_FAVOURLZO ; +return 0 ; + } +return -EINVAL ;
Lots of tabs needed above also.
fs/jffs2/compr.c int jffs2_unregister_compressor(struct jffs2_compressor *comp) · line 342
Quoted 7 lines
fs/jffs2/compr.c +4
-0+} + +#endif +void jffs2_free_comprbuf (unsigned char *comprbuf,unsigned char *orig) {if (orig != comprbuf)
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***