[JFFS2] Whitespace cleanups.

Convert many spaces to tabs; one or two other minor cosmetic fixes.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
This commit is contained in:
David Woodhouse 2007-07-10 10:01:22 +01:00
parent 16adce7b6f
commit ef53cb02ff
20 changed files with 275 additions and 274 deletions

View file

@ -1298,52 +1298,52 @@ config JFFS2_ZLIB
select ZLIB_DEFLATE select ZLIB_DEFLATE
depends on JFFS2_FS depends on JFFS2_FS
default y default y
help help
Zlib is designed to be a free, general-purpose, legally unencumbered, Zlib is designed to be a free, general-purpose, legally unencumbered,
lossless data-compression library for use on virtually any computer lossless data-compression library for use on virtually any computer
hardware and operating system. See <http://www.gzip.org/zlib/> for hardware and operating system. See <http://www.gzip.org/zlib/> for
further information. further information.
Say 'Y' if unsure. Say 'Y' if unsure.
config JFFS2_RTIME config JFFS2_RTIME
bool "JFFS2 RTIME compression support" if JFFS2_COMPRESSION_OPTIONS bool "JFFS2 RTIME compression support" if JFFS2_COMPRESSION_OPTIONS
depends on JFFS2_FS depends on JFFS2_FS
default y default y
help help
Rtime does manage to recompress already-compressed data. Say 'Y' if unsure. Rtime does manage to recompress already-compressed data. Say 'Y' if unsure.
config JFFS2_RUBIN config JFFS2_RUBIN
bool "JFFS2 RUBIN compression support" if JFFS2_COMPRESSION_OPTIONS bool "JFFS2 RUBIN compression support" if JFFS2_COMPRESSION_OPTIONS
depends on JFFS2_FS depends on JFFS2_FS
default n default n
help help
RUBINMIPS and DYNRUBIN compressors. Say 'N' if unsure. RUBINMIPS and DYNRUBIN compressors. Say 'N' if unsure.
choice choice
prompt "JFFS2 default compression mode" if JFFS2_COMPRESSION_OPTIONS prompt "JFFS2 default compression mode" if JFFS2_COMPRESSION_OPTIONS
default JFFS2_CMODE_PRIORITY default JFFS2_CMODE_PRIORITY
depends on JFFS2_FS depends on JFFS2_FS
help help
You can set here the default compression mode of JFFS2 from You can set here the default compression mode of JFFS2 from
the available compression modes. Don't touch if unsure. the available compression modes. Don't touch if unsure.
config JFFS2_CMODE_NONE config JFFS2_CMODE_NONE
bool "no compression" bool "no compression"
help help
Uses no compression. Uses no compression.
config JFFS2_CMODE_PRIORITY config JFFS2_CMODE_PRIORITY
bool "priority" bool "priority"
help help
Tries the compressors in a predefined order and chooses the first Tries the compressors in a predefined order and chooses the first
successful one. successful one.
config JFFS2_CMODE_SIZE config JFFS2_CMODE_SIZE
bool "size (EXPERIMENTAL)" bool "size (EXPERIMENTAL)"
help help
Tries all compressors and chooses the one which has the smallest Tries all compressors and chooses the one which has the smallest
result. result.
endchoice endchoice

View file

@ -23,8 +23,8 @@ static int jffs2_garbage_collect_thread(void *);
void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c) void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c)
{ {
spin_lock(&c->erase_completion_lock); spin_lock(&c->erase_completion_lock);
if (c->gc_task && jffs2_thread_should_wake(c)) if (c->gc_task && jffs2_thread_should_wake(c))
send_sig(SIGHUP, c->gc_task, 1); send_sig(SIGHUP, c->gc_task, 1);
spin_unlock(&c->erase_completion_lock); spin_unlock(&c->erase_completion_lock);
} }

View file

@ -5,7 +5,7 @@
* Created by Arjan van de Ven <arjanv@redhat.com> * Created by Arjan van de Ven <arjanv@redhat.com>
* *
* Copyright © 2004 Ferenc Havasi <havasi@inf.u-szeged.hu>, * Copyright © 2004 Ferenc Havasi <havasi@inf.u-szeged.hu>,
* University of Szeged, Hungary * University of Szeged, Hungary
* *
* For licensing information, see the file 'LICENCE' in this directory. * For licensing information, see the file 'LICENCE' in this directory.
* *
@ -43,121 +43,122 @@ static uint32_t none_stat_compr_blocks=0,none_stat_decompr_blocks=0,none_stat_co
* *datalen accordingly to show the amount of data which were compressed. * *datalen accordingly to show the amount of data which were compressed.
*/ */
uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
unsigned char *data_in, unsigned char **cpage_out, unsigned char *data_in, unsigned char **cpage_out,
uint32_t *datalen, uint32_t *cdatalen) uint32_t *datalen, uint32_t *cdatalen)
{ {
int ret = JFFS2_COMPR_NONE; int ret = JFFS2_COMPR_NONE;
int compr_ret; int compr_ret;
struct jffs2_compressor *this, *best=NULL; struct jffs2_compressor *this, *best=NULL;
unsigned char *output_buf = NULL, *tmp_buf; unsigned char *output_buf = NULL, *tmp_buf;
uint32_t orig_slen, orig_dlen; uint32_t orig_slen, orig_dlen;
uint32_t best_slen=0, best_dlen=0; uint32_t best_slen=0, best_dlen=0;
switch (jffs2_compression_mode) { switch (jffs2_compression_mode) {
case JFFS2_COMPR_MODE_NONE: case JFFS2_COMPR_MODE_NONE:
break; break;
case JFFS2_COMPR_MODE_PRIORITY: case JFFS2_COMPR_MODE_PRIORITY:
output_buf = kmalloc(*cdatalen,GFP_KERNEL); output_buf = kmalloc(*cdatalen,GFP_KERNEL);
if (!output_buf) { if (!output_buf) {
printk(KERN_WARNING "JFFS2: No memory for compressor allocation. Compression failed.\n"); printk(KERN_WARNING "JFFS2: No memory for compressor allocation. Compression failed.\n");
goto out; goto out;
} }
orig_slen = *datalen; orig_slen = *datalen;
orig_dlen = *cdatalen; orig_dlen = *cdatalen;
spin_lock(&jffs2_compressor_list_lock); spin_lock(&jffs2_compressor_list_lock);
list_for_each_entry(this, &jffs2_compressor_list, list) { list_for_each_entry(this, &jffs2_compressor_list, list) {
/* Skip decompress-only backwards-compatibility and disabled modules */ /* Skip decompress-only backwards-compatibility and disabled modules */
if ((!this->compress)||(this->disabled)) if ((!this->compress)||(this->disabled))
continue; continue;
this->usecount++; this->usecount++;
spin_unlock(&jffs2_compressor_list_lock); spin_unlock(&jffs2_compressor_list_lock);
*datalen = orig_slen; *datalen = orig_slen;
*cdatalen = orig_dlen; *cdatalen = orig_dlen;
compr_ret = this->compress(data_in, output_buf, datalen, cdatalen, NULL); compr_ret = this->compress(data_in, output_buf, datalen, cdatalen, NULL);
spin_lock(&jffs2_compressor_list_lock); spin_lock(&jffs2_compressor_list_lock);
this->usecount--; this->usecount--;
if (!compr_ret) { if (!compr_ret) {
ret = this->compr; ret = this->compr;
this->stat_compr_blocks++; this->stat_compr_blocks++;
this->stat_compr_orig_size += *datalen; this->stat_compr_orig_size += *datalen;
this->stat_compr_new_size += *cdatalen; this->stat_compr_new_size += *cdatalen;
break; break;
} }
} }
spin_unlock(&jffs2_compressor_list_lock); spin_unlock(&jffs2_compressor_list_lock);
if (ret == JFFS2_COMPR_NONE) kfree(output_buf); if (ret == JFFS2_COMPR_NONE)
break; kfree(output_buf);
case JFFS2_COMPR_MODE_SIZE: break;
orig_slen = *datalen; case JFFS2_COMPR_MODE_SIZE:
orig_dlen = *cdatalen; orig_slen = *datalen;
spin_lock(&jffs2_compressor_list_lock); orig_dlen = *cdatalen;
list_for_each_entry(this, &jffs2_compressor_list, list) { spin_lock(&jffs2_compressor_list_lock);
/* Skip decompress-only backwards-compatibility and disabled modules */ list_for_each_entry(this, &jffs2_compressor_list, list) {
if ((!this->compress)||(this->disabled)) /* Skip decompress-only backwards-compatibility and disabled modules */
continue; if ((!this->compress)||(this->disabled))
/* Allocating memory for output buffer if necessary */ continue;
if ((this->compr_buf_size<orig_dlen)&&(this->compr_buf)) { /* Allocating memory for output buffer if necessary */
spin_unlock(&jffs2_compressor_list_lock); if ((this->compr_buf_size<orig_dlen)&&(this->compr_buf)) {
kfree(this->compr_buf); spin_unlock(&jffs2_compressor_list_lock);
spin_lock(&jffs2_compressor_list_lock); kfree(this->compr_buf);
this->compr_buf_size=0; spin_lock(&jffs2_compressor_list_lock);
this->compr_buf=NULL; this->compr_buf_size=0;
} this->compr_buf=NULL;
if (!this->compr_buf) { }
spin_unlock(&jffs2_compressor_list_lock); if (!this->compr_buf) {
tmp_buf = kmalloc(orig_dlen,GFP_KERNEL); spin_unlock(&jffs2_compressor_list_lock);
spin_lock(&jffs2_compressor_list_lock); tmp_buf = kmalloc(orig_dlen,GFP_KERNEL);
if (!tmp_buf) { spin_lock(&jffs2_compressor_list_lock);
printk(KERN_WARNING "JFFS2: No memory for compressor allocation. (%d bytes)\n",orig_dlen); if (!tmp_buf) {
continue; printk(KERN_WARNING "JFFS2: No memory for compressor allocation. (%d bytes)\n",orig_dlen);
} continue;
else { }
this->compr_buf = tmp_buf; else {
this->compr_buf_size = orig_dlen; this->compr_buf = tmp_buf;
} this->compr_buf_size = orig_dlen;
} }
this->usecount++; }
spin_unlock(&jffs2_compressor_list_lock); this->usecount++;
*datalen = orig_slen; spin_unlock(&jffs2_compressor_list_lock);
*cdatalen = orig_dlen; *datalen = orig_slen;
compr_ret = this->compress(data_in, this->compr_buf, datalen, cdatalen, NULL); *cdatalen = orig_dlen;
spin_lock(&jffs2_compressor_list_lock); compr_ret = this->compress(data_in, this->compr_buf, datalen, cdatalen, NULL);
this->usecount--; spin_lock(&jffs2_compressor_list_lock);
if (!compr_ret) { this->usecount--;
if ((!best_dlen)||(best_dlen>*cdatalen)) { if (!compr_ret) {
best_dlen = *cdatalen; if ((!best_dlen)||(best_dlen>*cdatalen)) {
best_slen = *datalen; best_dlen = *cdatalen;
best = this; best_slen = *datalen;
} best = this;
} }
} }
if (best_dlen) { }
*cdatalen = best_dlen; if (best_dlen) {
*datalen = best_slen; *cdatalen = best_dlen;
output_buf = best->compr_buf; *datalen = best_slen;
best->compr_buf = NULL; output_buf = best->compr_buf;
best->compr_buf_size = 0; best->compr_buf = NULL;
best->stat_compr_blocks++; best->compr_buf_size = 0;
best->stat_compr_orig_size += best_slen; best->stat_compr_blocks++;
best->stat_compr_new_size += best_dlen; best->stat_compr_orig_size += best_slen;
ret = best->compr; best->stat_compr_new_size += best_dlen;
} ret = best->compr;
spin_unlock(&jffs2_compressor_list_lock); }
break; spin_unlock(&jffs2_compressor_list_lock);
default: break;
printk(KERN_ERR "JFFS2: unknow compression mode.\n"); default:
} printk(KERN_ERR "JFFS2: unknow compression mode.\n");
}
out: out:
if (ret == JFFS2_COMPR_NONE) { if (ret == JFFS2_COMPR_NONE) {
*cpage_out = data_in; *cpage_out = data_in;
*datalen = *cdatalen; *datalen = *cdatalen;
none_stat_compr_blocks++; none_stat_compr_blocks++;
none_stat_compr_size += *datalen; none_stat_compr_size += *datalen;
} }
else { else {
*cpage_out = output_buf; *cpage_out = output_buf;
} }
return ret; return ret;
} }
@ -165,8 +166,8 @@ int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
uint16_t comprtype, unsigned char *cdata_in, uint16_t comprtype, unsigned char *cdata_in,
unsigned char *data_out, uint32_t cdatalen, uint32_t datalen) unsigned char *data_out, uint32_t cdatalen, uint32_t datalen)
{ {
struct jffs2_compressor *this; struct jffs2_compressor *this;
int ret; int ret;
/* Older code had a bug where it would write non-zero 'usercompr' /* Older code had a bug where it would write non-zero 'usercompr'
fields. Deal with it. */ fields. Deal with it. */
@ -177,32 +178,32 @@ int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
case JFFS2_COMPR_NONE: case JFFS2_COMPR_NONE:
/* This should be special-cased elsewhere, but we might as well deal with it */ /* This should be special-cased elsewhere, but we might as well deal with it */
memcpy(data_out, cdata_in, datalen); memcpy(data_out, cdata_in, datalen);
none_stat_decompr_blocks++; none_stat_decompr_blocks++;
break; break;
case JFFS2_COMPR_ZERO: case JFFS2_COMPR_ZERO:
memset(data_out, 0, datalen); memset(data_out, 0, datalen);
break; break;
default: default:
spin_lock(&jffs2_compressor_list_lock); spin_lock(&jffs2_compressor_list_lock);
list_for_each_entry(this, &jffs2_compressor_list, list) { list_for_each_entry(this, &jffs2_compressor_list, list) {
if (comprtype == this->compr) { if (comprtype == this->compr) {
this->usecount++; this->usecount++;
spin_unlock(&jffs2_compressor_list_lock); spin_unlock(&jffs2_compressor_list_lock);
ret = this->decompress(cdata_in, data_out, cdatalen, datalen, NULL); ret = this->decompress(cdata_in, data_out, cdatalen, datalen, NULL);
spin_lock(&jffs2_compressor_list_lock); spin_lock(&jffs2_compressor_list_lock);
if (ret) { if (ret) {
printk(KERN_WARNING "Decompressor \"%s\" returned %d\n", this->name, ret); printk(KERN_WARNING "Decompressor \"%s\" returned %d\n", this->name, ret);
} }
else { else {
this->stat_decompr_blocks++; this->stat_decompr_blocks++;
} }
this->usecount--; this->usecount--;
spin_unlock(&jffs2_compressor_list_lock); spin_unlock(&jffs2_compressor_list_lock);
return ret; return ret;
} }
} }
printk(KERN_WARNING "JFFS2 compression type 0x%02x not available.\n", comprtype); printk(KERN_WARNING "JFFS2 compression type 0x%02x not available.\n", comprtype);
spin_unlock(&jffs2_compressor_list_lock); spin_unlock(&jffs2_compressor_list_lock);
return -EIO; return -EIO;
} }
return 0; return 0;
@ -210,108 +211,108 @@ int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
int jffs2_register_compressor(struct jffs2_compressor *comp) int jffs2_register_compressor(struct jffs2_compressor *comp)
{ {
struct jffs2_compressor *this; struct jffs2_compressor *this;
if (!comp->name) { if (!comp->name) {
printk(KERN_WARNING "NULL compressor name at registering JFFS2 compressor. Failed.\n"); printk(KERN_WARNING "NULL compressor name at registering JFFS2 compressor. Failed.\n");
return -1; return -1;
} }
comp->compr_buf_size=0; comp->compr_buf_size=0;
comp->compr_buf=NULL; comp->compr_buf=NULL;
comp->usecount=0; comp->usecount=0;
comp->stat_compr_orig_size=0; comp->stat_compr_orig_size=0;
comp->stat_compr_new_size=0; comp->stat_compr_new_size=0;
comp->stat_compr_blocks=0; comp->stat_compr_blocks=0;
comp->stat_decompr_blocks=0; comp->stat_decompr_blocks=0;
D1(printk(KERN_DEBUG "Registering JFFS2 compressor \"%s\"\n", comp->name)); D1(printk(KERN_DEBUG "Registering JFFS2 compressor \"%s\"\n", comp->name));
spin_lock(&jffs2_compressor_list_lock); spin_lock(&jffs2_compressor_list_lock);
list_for_each_entry(this, &jffs2_compressor_list, list) { list_for_each_entry(this, &jffs2_compressor_list, list) {
if (this->priority < comp->priority) { if (this->priority < comp->priority) {
list_add(&comp->list, this->list.prev); list_add(&comp->list, this->list.prev);
goto out; goto out;
} }
} }
list_add_tail(&comp->list, &jffs2_compressor_list); list_add_tail(&comp->list, &jffs2_compressor_list);
out: out:
D2(list_for_each_entry(this, &jffs2_compressor_list, list) { D2(list_for_each_entry(this, &jffs2_compressor_list, list) {
printk(KERN_DEBUG "Compressor \"%s\", prio %d\n", this->name, this->priority); printk(KERN_DEBUG "Compressor \"%s\", prio %d\n", this->name, this->priority);
}) })
spin_unlock(&jffs2_compressor_list_lock); spin_unlock(&jffs2_compressor_list_lock);
return 0; return 0;
} }
int jffs2_unregister_compressor(struct jffs2_compressor *comp) int jffs2_unregister_compressor(struct jffs2_compressor *comp)
{ {
D2(struct jffs2_compressor *this;) D2(struct jffs2_compressor *this;)
D1(printk(KERN_DEBUG "Unregistering JFFS2 compressor \"%s\"\n", comp->name)); D1(printk(KERN_DEBUG "Unregistering JFFS2 compressor \"%s\"\n", comp->name));
spin_lock(&jffs2_compressor_list_lock); spin_lock(&jffs2_compressor_list_lock);
if (comp->usecount) { if (comp->usecount) {
spin_unlock(&jffs2_compressor_list_lock); spin_unlock(&jffs2_compressor_list_lock);
printk(KERN_WARNING "JFFS2: Compressor modul is in use. Unregister failed.\n"); printk(KERN_WARNING "JFFS2: Compressor modul is in use. Unregister failed.\n");
return -1; return -1;
} }
list_del(&comp->list); list_del(&comp->list);
D2(list_for_each_entry(this, &jffs2_compressor_list, list) { D2(list_for_each_entry(this, &jffs2_compressor_list, list) {
printk(KERN_DEBUG "Compressor \"%s\", prio %d\n", this->name, this->priority); printk(KERN_DEBUG "Compressor \"%s\", prio %d\n", this->name, this->priority);
}) })
spin_unlock(&jffs2_compressor_list_lock); spin_unlock(&jffs2_compressor_list_lock);
return 0; return 0;
} }
void jffs2_free_comprbuf(unsigned char *comprbuf, unsigned char *orig) void jffs2_free_comprbuf(unsigned char *comprbuf, unsigned char *orig)
{ {
if (orig != comprbuf) if (orig != comprbuf)
kfree(comprbuf); kfree(comprbuf);
} }
int __init jffs2_compressors_init(void) int __init jffs2_compressors_init(void)
{ {
/* Registering compressors */ /* Registering compressors */
#ifdef CONFIG_JFFS2_ZLIB #ifdef CONFIG_JFFS2_ZLIB
jffs2_zlib_init(); jffs2_zlib_init();
#endif #endif
#ifdef CONFIG_JFFS2_RTIME #ifdef CONFIG_JFFS2_RTIME
jffs2_rtime_init(); jffs2_rtime_init();
#endif #endif
#ifdef CONFIG_JFFS2_RUBIN #ifdef CONFIG_JFFS2_RUBIN
jffs2_rubinmips_init(); jffs2_rubinmips_init();
jffs2_dynrubin_init(); jffs2_dynrubin_init();
#endif #endif
/* Setting default compression mode */ /* Setting default compression mode */
#ifdef CONFIG_JFFS2_CMODE_NONE #ifdef CONFIG_JFFS2_CMODE_NONE
jffs2_compression_mode = JFFS2_COMPR_MODE_NONE; jffs2_compression_mode = JFFS2_COMPR_MODE_NONE;
D1(printk(KERN_INFO "JFFS2: default compression mode: none\n");) D1(printk(KERN_INFO "JFFS2: default compression mode: none\n");)
#else #else
#ifdef CONFIG_JFFS2_CMODE_SIZE #ifdef CONFIG_JFFS2_CMODE_SIZE
jffs2_compression_mode = JFFS2_COMPR_MODE_SIZE; jffs2_compression_mode = JFFS2_COMPR_MODE_SIZE;
D1(printk(KERN_INFO "JFFS2: default compression mode: size\n");) D1(printk(KERN_INFO "JFFS2: default compression mode: size\n");)
#else #else
D1(printk(KERN_INFO "JFFS2: default compression mode: priority\n");) D1(printk(KERN_INFO "JFFS2: default compression mode: priority\n");)
#endif #endif
#endif #endif
return 0; return 0;
} }
int jffs2_compressors_exit(void) int jffs2_compressors_exit(void)
{ {
/* Unregistering compressors */ /* Unregistering compressors */
#ifdef CONFIG_JFFS2_RUBIN #ifdef CONFIG_JFFS2_RUBIN
jffs2_dynrubin_exit(); jffs2_dynrubin_exit();
jffs2_rubinmips_exit(); jffs2_rubinmips_exit();
#endif #endif
#ifdef CONFIG_JFFS2_RTIME #ifdef CONFIG_JFFS2_RTIME
jffs2_rtime_exit(); jffs2_rtime_exit();
#endif #endif
#ifdef CONFIG_JFFS2_ZLIB #ifdef CONFIG_JFFS2_ZLIB
jffs2_zlib_exit(); jffs2_zlib_exit();
#endif #endif
return 0; return 0;
} }

View file

@ -2,7 +2,7 @@
* JFFS2 -- Journalling Flash File System, Version 2. * JFFS2 -- Journalling Flash File System, Version 2.
* *
* Copyright © 2004 Ferenc Havasi <havasi@inf.u-szeged.hu>, * Copyright © 2004 Ferenc Havasi <havasi@inf.u-szeged.hu>,
* University of Szeged, Hungary * University of Szeged, Hungary
* *
* For licensing information, see the file 'LICENCE' in this directory. * For licensing information, see the file 'LICENCE' in this directory.
* *
@ -32,29 +32,29 @@
#define JFFS2_ZLIB_PRIORITY 60 #define JFFS2_ZLIB_PRIORITY 60
#define JFFS2_RUBINMIPS_DISABLED /* RUBINs will be used only */ #define JFFS2_RUBINMIPS_DISABLED /* RUBINs will be used only */
#define JFFS2_DYNRUBIN_DISABLED /* for decompression */ #define JFFS2_DYNRUBIN_DISABLED /* for decompression */
#define JFFS2_COMPR_MODE_NONE 0 #define JFFS2_COMPR_MODE_NONE 0
#define JFFS2_COMPR_MODE_PRIORITY 1 #define JFFS2_COMPR_MODE_PRIORITY 1
#define JFFS2_COMPR_MODE_SIZE 2 #define JFFS2_COMPR_MODE_SIZE 2
struct jffs2_compressor { struct jffs2_compressor {
struct list_head list; struct list_head list;
int priority; /* used by prirority comr. mode */ int priority; /* used by prirority comr. mode */
char *name; char *name;
char compr; /* JFFS2_COMPR_XXX */ char compr; /* JFFS2_COMPR_XXX */
int (*compress)(unsigned char *data_in, unsigned char *cpage_out, int (*compress)(unsigned char *data_in, unsigned char *cpage_out,
uint32_t *srclen, uint32_t *destlen, void *model); uint32_t *srclen, uint32_t *destlen, void *model);
int (*decompress)(unsigned char *cdata_in, unsigned char *data_out, int (*decompress)(unsigned char *cdata_in, unsigned char *data_out,
uint32_t cdatalen, uint32_t datalen, void *model); uint32_t cdatalen, uint32_t datalen, void *model);
int usecount; int usecount;
int disabled; /* if seted the compressor won't compress */ int disabled; /* if set the compressor won't compress */
unsigned char *compr_buf; /* used by size compr. mode */ unsigned char *compr_buf; /* used by size compr. mode */
uint32_t compr_buf_size; /* used by size compr. mode */ uint32_t compr_buf_size; /* used by size compr. mode */
uint32_t stat_compr_orig_size; uint32_t stat_compr_orig_size;
uint32_t stat_compr_new_size; uint32_t stat_compr_new_size;
uint32_t stat_compr_blocks; uint32_t stat_compr_blocks;
uint32_t stat_decompr_blocks; uint32_t stat_decompr_blocks;
}; };
int jffs2_register_compressor(struct jffs2_compressor *comp); int jffs2_register_compressor(struct jffs2_compressor *comp);
@ -64,12 +64,12 @@ int jffs2_compressors_init(void);
int jffs2_compressors_exit(void); int jffs2_compressors_exit(void);
uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
unsigned char *data_in, unsigned char **cpage_out, unsigned char *data_in, unsigned char **cpage_out,
uint32_t *datalen, uint32_t *cdatalen); uint32_t *datalen, uint32_t *cdatalen);
int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
uint16_t comprtype, unsigned char *cdata_in, uint16_t comprtype, unsigned char *cdata_in,
unsigned char *data_out, uint32_t cdatalen, uint32_t datalen); unsigned char *data_out, uint32_t cdatalen, uint32_t datalen);
void jffs2_free_comprbuf(unsigned char *comprbuf, unsigned char *orig); void jffs2_free_comprbuf(unsigned char *comprbuf, unsigned char *orig);

View file

@ -104,7 +104,7 @@ static int jffs2_rtime_decompress(unsigned char *data_in,
} }
} }
} }
return 0; return 0;
} }
static struct jffs2_compressor jffs2_rtime_comp = { static struct jffs2_compressor jffs2_rtime_comp = {

View file

@ -384,7 +384,7 @@ static int jffs2_rubinmips_decompress(unsigned char *data_in,
void *model) void *model)
{ {
rubin_do_decompress(BIT_DIVIDER_MIPS, bits_mips, data_in, cpage_out, sourcelen, dstlen); rubin_do_decompress(BIT_DIVIDER_MIPS, bits_mips, data_in, cpage_out, sourcelen, dstlen);
return 0; return 0;
} }
static int jffs2_dynrubin_decompress(unsigned char *data_in, static int jffs2_dynrubin_decompress(unsigned char *data_in,
@ -399,7 +399,7 @@ static int jffs2_dynrubin_decompress(unsigned char *data_in,
bits[c] = data_in[c]; bits[c] = data_in[c];
rubin_do_decompress(256, bits, data_in+8, cpage_out, sourcelen-8, dstlen); rubin_do_decompress(256, bits, data_in+8, cpage_out, sourcelen-8, dstlen);
return 0; return 0;
} }
static struct jffs2_compressor jffs2_rubinmips_comp = { static struct jffs2_compressor jffs2_rubinmips_comp = {

View file

@ -181,7 +181,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in,
} }
zlib_inflateEnd(&inf_strm); zlib_inflateEnd(&inf_strm);
mutex_unlock(&inflate_mutex); mutex_unlock(&inflate_mutex);
return 0; return 0;
} }
static struct jffs2_compressor jffs2_zlib_comp = { static struct jffs2_compressor jffs2_zlib_comp = {
@ -203,11 +203,11 @@ int __init jffs2_zlib_init(void)
ret = alloc_workspaces(); ret = alloc_workspaces();
if (ret) if (ret)
return ret; return ret;
ret = jffs2_register_compressor(&jffs2_zlib_comp); ret = jffs2_register_compressor(&jffs2_zlib_comp);
if (ret) if (ret)
free_workspaces(); free_workspaces();
return ret; return ret;
} }

View file

@ -32,7 +32,7 @@ static int jffs2_mkdir (struct inode *,struct dentry *,int);
static int jffs2_rmdir (struct inode *,struct dentry *); static int jffs2_rmdir (struct inode *,struct dentry *);
static int jffs2_mknod (struct inode *,struct dentry *,int,dev_t); static int jffs2_mknod (struct inode *,struct dentry *,int,dev_t);
static int jffs2_rename (struct inode *, struct dentry *, static int jffs2_rename (struct inode *, struct dentry *,
struct inode *, struct dentry *); struct inode *, struct dentry *);
const struct file_operations jffs2_dir_operations = const struct file_operations jffs2_dir_operations =
{ {
@ -770,7 +770,7 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de
} }
static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
struct inode *new_dir_i, struct dentry *new_dentry) struct inode *new_dir_i, struct dentry *new_dentry)
{ {
int ret; int ret;
struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb); struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb);

View file

@ -38,8 +38,8 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
#ifdef __ECOS #ifdef __ECOS
ret = jffs2_flash_erase(c, jeb); ret = jffs2_flash_erase(c, jeb);
if (!ret) { if (!ret) {
jffs2_erase_succeeded(c, jeb); jffs2_erase_succeeded(c, jeb);
return; return;
} }
bad_offset = jeb->offset; bad_offset = jeb->offset;
#else /* Linux */ #else /* Linux */

View file

@ -556,7 +556,7 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
node = kmalloc(rawlen, GFP_KERNEL); node = kmalloc(rawlen, GFP_KERNEL);
if (!node) if (!node)
return -ENOMEM; return -ENOMEM;
ret = jffs2_flash_read(c, ref_offset(raw), rawlen, &retlen, (char *)node); ret = jffs2_flash_read(c, ref_offset(raw), rawlen, &retlen, (char *)node);
if (!ret && retlen != rawlen) if (!ret && retlen != rawlen)
@ -624,7 +624,7 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
if (ret || (retlen != rawlen)) { if (ret || (retlen != rawlen)) {
printk(KERN_NOTICE "Write of %d bytes at 0x%08x failed. returned %d, retlen %zd\n", printk(KERN_NOTICE "Write of %d bytes at 0x%08x failed. returned %d, retlen %zd\n",
rawlen, phys_ofs, ret, retlen); rawlen, phys_ofs, ret, retlen);
if (retlen) { if (retlen) {
jffs2_add_physical_node_ref(c, phys_ofs | REF_OBSOLETE, rawlen, NULL); jffs2_add_physical_node_ref(c, phys_ofs | REF_OBSOLETE, rawlen, NULL);
} else { } else {

View file

@ -127,7 +127,7 @@ static inline struct jffs2_inode_cache *jffs2_raw_ref_to_ic(struct jffs2_raw_nod
return ((struct jffs2_inode_cache *)raw); return ((struct jffs2_inode_cache *)raw);
} }
/* flash_offset & 3 always has to be zero, because nodes are /* flash_offset & 3 always has to be zero, because nodes are
always aligned at 4 bytes. So we have a couple of extra bits always aligned at 4 bytes. So we have a couple of extra bits
to play with, which indicate the node's status; see below: */ to play with, which indicate the node's status; see below: */
#define REF_UNCHECKED 0 /* We haven't yet checked the CRC or built its inode */ #define REF_UNCHECKED 0 /* We haven't yet checked the CRC or built its inode */

View file

@ -154,7 +154,7 @@ int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize,
while(ret == -EAGAIN) { while(ret == -EAGAIN) {
ret = jffs2_do_reserve_space(c, minsize, len, sumsize); ret = jffs2_do_reserve_space(c, minsize, len, sumsize);
if (ret) { if (ret) {
D1(printk(KERN_DEBUG "jffs2_reserve_space_gc: looping, ret is %d\n", ret)); D1(printk(KERN_DEBUG "jffs2_reserve_space_gc: looping, ret is %d\n", ret));
} }
} }
spin_unlock(&c->erase_completion_lock); spin_unlock(&c->erase_completion_lock);

View file

@ -211,7 +211,7 @@ static void jffs2_kill_tn(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info *
* ordering. * ordering.
* *
* Returns 0 if the node was handled (including marking it obsolete) * Returns 0 if the node was handled (including marking it obsolete)
* < 0 an if error occurred * < 0 an if error occurred
*/ */
static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c, static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c,
struct jffs2_readinode_info *rii, struct jffs2_readinode_info *rii,
@ -862,8 +862,8 @@ static inline int read_unknown(struct jffs2_sb_info *c, struct jffs2_raw_node_re
JFFS2_ERROR("REF_UNCHECKED but unknown node at %#08x\n", JFFS2_ERROR("REF_UNCHECKED but unknown node at %#08x\n",
ref_offset(ref)); ref_offset(ref));
JFFS2_ERROR("Node is {%04x,%04x,%08x,%08x}. Please report this error.\n", JFFS2_ERROR("Node is {%04x,%04x,%08x,%08x}. Please report this error.\n",
je16_to_cpu(un->magic), je16_to_cpu(un->nodetype), je16_to_cpu(un->magic), je16_to_cpu(un->nodetype),
je32_to_cpu(un->totlen), je32_to_cpu(un->hdr_crc)); je32_to_cpu(un->totlen), je32_to_cpu(un->hdr_crc));
jffs2_mark_node_obsolete(c, ref); jffs2_mark_node_obsolete(c, ref);
return 0; return 0;
} }

View file

@ -863,7 +863,7 @@ scan_more:
switch (je16_to_cpu(node->nodetype) & JFFS2_COMPAT_MASK) { switch (je16_to_cpu(node->nodetype) & JFFS2_COMPAT_MASK) {
case JFFS2_FEATURE_ROCOMPAT: case JFFS2_FEATURE_ROCOMPAT:
printk(KERN_NOTICE "Read-only compatible feature node (0x%04x) found at offset 0x%08x\n", je16_to_cpu(node->nodetype), ofs); printk(KERN_NOTICE "Read-only compatible feature node (0x%04x) found at offset 0x%08x\n", je16_to_cpu(node->nodetype), ofs);
c->flags |= JFFS2_SB_FLAG_RO; c->flags |= JFFS2_SB_FLAG_RO;
if (!(jffs2_is_readonly(c))) if (!(jffs2_is_readonly(c)))
return -EROFS; return -EROFS;
if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(node->totlen))))) if ((err = jffs2_scan_dirty_space(c, jeb, PAD(je32_to_cpu(node->totlen)))))

View file

@ -38,9 +38,9 @@ int jffs2_init_security(struct inode *inode, struct inode *dir)
} }
rc = do_jffs2_setxattr(inode, JFFS2_XPREFIX_SECURITY, name, value, len, 0); rc = do_jffs2_setxattr(inode, JFFS2_XPREFIX_SECURITY, name, value, len, 0);
kfree(name); kfree(name);
kfree(value); kfree(value);
return rc; return rc;
} }
/* ---- XATTR Handler for "security.*" ----------------- */ /* ---- XATTR Handler for "security.*" ----------------- */

View file

@ -2,10 +2,10 @@
* JFFS2 -- Journalling Flash File System, Version 2. * JFFS2 -- Journalling Flash File System, Version 2.
* *
* Copyright © 2004 Ferenc Havasi <havasi@inf.u-szeged.hu>, * Copyright © 2004 Ferenc Havasi <havasi@inf.u-szeged.hu>,
* Zoltan Sogor <weth@inf.u-szeged.hu>, * Zoltan Sogor <weth@inf.u-szeged.hu>,
* Patrik Kluba <pajko@halom.u-szeged.hu>, * Patrik Kluba <pajko@halom.u-szeged.hu>,
* University of Szeged, Hungary * University of Szeged, Hungary
* 2006 KaiGai Kohei <kaigai@ak.jp.nec.com> * 2006 KaiGai Kohei <kaigai@ak.jp.nec.com>
* *
* For licensing information, see the file 'LICENCE' in this directory. * For licensing information, see the file 'LICENCE' in this directory.
* *

View file

@ -2,9 +2,9 @@
* JFFS2 -- Journalling Flash File System, Version 2. * JFFS2 -- Journalling Flash File System, Version 2.
* *
* Copyright © 2004 Ferenc Havasi <havasi@inf.u-szeged.hu>, * Copyright © 2004 Ferenc Havasi <havasi@inf.u-szeged.hu>,
* Zoltan Sogor <weth@inf.u-szeged.hu>, * Zoltan Sogor <weth@inf.u-szeged.hu>,
* Patrik Kluba <pajko@halom.u-szeged.hu>, * Patrik Kluba <pajko@halom.u-szeged.hu>,
* University of Szeged, Hungary * University of Szeged, Hungary
* *
* For licensing information, see the file 'LICENCE' in this directory. * For licensing information, see the file 'LICENCE' in this directory.
* *

View file

@ -1021,8 +1021,8 @@ int jffs2_check_oob_empty(struct jffs2_sb_info *c,
/* /*
* Check for a valid cleanmarker. * Check for a valid cleanmarker.
* Returns: 0 if a valid cleanmarker was found * Returns: 0 if a valid cleanmarker was found
* 1 if no cleanmarker was found * 1 if no cleanmarker was found
* negative error code if an error occurred * negative error code if an error occurred
*/ */
int jffs2_check_nand_cleanmarker(struct jffs2_sb_info *c, int jffs2_check_nand_cleanmarker(struct jffs2_sb_info *c,
struct jffs2_eraseblock *jeb) struct jffs2_eraseblock *jeb)

View file

@ -75,7 +75,7 @@ extern void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c);
extern void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c); extern void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c);
extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c, extern struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c,
uint32_t xid, uint32_t version); uint32_t xid, uint32_t version);
extern void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); extern void jffs2_xattr_delete_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);
extern void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); extern void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic);

View file

@ -17,7 +17,7 @@
#include "nodelist.h" #include "nodelist.h"
static int jffs2_user_getxattr(struct inode *inode, const char *name, static int jffs2_user_getxattr(struct inode *inode, const char *name,
void *buffer, size_t size) void *buffer, size_t size)
{ {
if (!strcmp(name, "")) if (!strcmp(name, ""))
return -EINVAL; return -EINVAL;
@ -25,7 +25,7 @@ static int jffs2_user_getxattr(struct inode *inode, const char *name,
} }
static int jffs2_user_setxattr(struct inode *inode, const char *name, const void *buffer, static int jffs2_user_setxattr(struct inode *inode, const char *name, const void *buffer,
size_t size, int flags) size_t size, int flags)
{ {
if (!strcmp(name, "")) if (!strcmp(name, ""))
return -EINVAL; return -EINVAL;