aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/jffs2/compr.c138
-rw-r--r--fs/jffs2/compr.h10
2 files changed, 0 insertions, 148 deletions
diff --git a/fs/jffs2/compr.c b/fs/jffs2/compr.c
index 7001ba26c067..647cb15d5499 100644
--- a/fs/jffs2/compr.c
+++ b/fs/jffs2/compr.c
@@ -268,144 +268,6 @@ int jffs2_unregister_compressor(struct jffs2_compressor *comp)
268 return 0; 268 return 0;
269} 269}
270 270
271#ifdef CONFIG_JFFS2_PROC
272
273#define JFFS2_STAT_BUF_SIZE 16000
274
275char *jffs2_list_compressors(void)
276{
277 struct jffs2_compressor *this;
278 char *buf, *act_buf;
279
280 act_buf = buf = kmalloc(JFFS2_STAT_BUF_SIZE,GFP_KERNEL);
281 list_for_each_entry(this, &jffs2_compressor_list, list) {
282 act_buf += sprintf(act_buf, "%10s priority:%d ", this->name, this->priority);
283 if ((this->disabled)||(!this->compress))
284 act_buf += sprintf(act_buf,"disabled");
285 else
286 act_buf += sprintf(act_buf,"enabled");
287 act_buf += sprintf(act_buf,"\n");
288 }
289 return buf;
290}
291
292char *jffs2_stats(void)
293{
294 struct jffs2_compressor *this;
295 char *buf, *act_buf;
296
297 act_buf = buf = kmalloc(JFFS2_STAT_BUF_SIZE,GFP_KERNEL);
298
299 act_buf += sprintf(act_buf,"JFFS2 compressor statistics:\n");
300 act_buf += sprintf(act_buf,"%10s ","none");
301 act_buf += sprintf(act_buf,"compr: %d blocks (%d) decompr: %d blocks\n", none_stat_compr_blocks,
302 none_stat_compr_size, none_stat_decompr_blocks);
303 spin_lock(&jffs2_compressor_list_lock);
304 list_for_each_entry(this, &jffs2_compressor_list, list) {
305 act_buf += sprintf(act_buf,"%10s ",this->name);
306 if ((this->disabled)||(!this->compress))
307 act_buf += sprintf(act_buf,"- ");
308 else
309 act_buf += sprintf(act_buf,"+ ");
310 act_buf += sprintf(act_buf,"compr: %d blocks (%d/%d) decompr: %d blocks ", this->stat_compr_blocks,
311 this->stat_compr_new_size, this->stat_compr_orig_size,
312 this->stat_decompr_blocks);
313 act_buf += sprintf(act_buf,"\n");
314 }
315 spin_unlock(&jffs2_compressor_list_lock);
316
317 return buf;
318}
319
320char *jffs2_get_compression_mode_name(void)
321{
322 switch (jffs2_compression_mode) {
323 case JFFS2_COMPR_MODE_NONE:
324 return "none";
325 case JFFS2_COMPR_MODE_PRIORITY:
326 return "priority";
327 case JFFS2_COMPR_MODE_SIZE:
328 return "size";
329 }
330 return "unkown";
331}
332
333int jffs2_set_compression_mode_name(const char *name)
334{
335 if (!strcmp("none",name)) {
336 jffs2_compression_mode = JFFS2_COMPR_MODE_NONE;
337 return 0;
338 }
339 if (!strcmp("priority",name)) {
340 jffs2_compression_mode = JFFS2_COMPR_MODE_PRIORITY;
341 return 0;
342 }
343 if (!strcmp("size",name)) {
344 jffs2_compression_mode = JFFS2_COMPR_MODE_SIZE;
345 return 0;
346 }
347 return 1;
348}
349
350static int jffs2_compressor_Xable(const char *name, int disabled)
351{
352 struct jffs2_compressor *this;
353 spin_lock(&jffs2_compressor_list_lock);
354 list_for_each_entry(this, &jffs2_compressor_list, list) {
355 if (!strcmp(this->name, name)) {
356 this->disabled = disabled;
357 spin_unlock(&jffs2_compressor_list_lock);
358 return 0;
359 }
360 }
361 spin_unlock(&jffs2_compressor_list_lock);
362 printk(KERN_WARNING "JFFS2: compressor %s not found.\n",name);
363 return 1;
364}
365
366int jffs2_enable_compressor_name(const char *name)
367{
368 return jffs2_compressor_Xable(name, 0);
369}
370
371int jffs2_disable_compressor_name(const char *name)
372{
373 return jffs2_compressor_Xable(name, 1);
374}
375
376int jffs2_set_compressor_priority(const char *name, int priority)
377{
378 struct jffs2_compressor *this,*comp;
379 spin_lock(&jffs2_compressor_list_lock);
380 list_for_each_entry(this, &jffs2_compressor_list, list) {
381 if (!strcmp(this->name, name)) {
382 this->priority = priority;
383 comp = this;
384 goto reinsert;
385 }
386 }
387 spin_unlock(&jffs2_compressor_list_lock);
388 printk(KERN_WARNING "JFFS2: compressor %s not found.\n",name);
389 return 1;
390reinsert:
391 /* list is sorted in the order of priority, so if
392 we change it we have to reinsert it into the
393 good place */
394 list_del(&comp->list);
395 list_for_each_entry(this, &jffs2_compressor_list, list) {
396 if (this->priority < comp->priority) {
397 list_add(&comp->list, this->list.prev);
398 spin_unlock(&jffs2_compressor_list_lock);
399 return 0;
400 }
401 }
402 list_add_tail(&comp->list, &jffs2_compressor_list);
403 spin_unlock(&jffs2_compressor_list_lock);
404 return 0;
405}
406
407#endif
408
409void jffs2_free_comprbuf(unsigned char *comprbuf, unsigned char *orig) 271void jffs2_free_comprbuf(unsigned char *comprbuf, unsigned char *orig)
410{ 272{
411 if (orig != comprbuf) 273 if (orig != comprbuf)
diff --git a/fs/jffs2/compr.h b/fs/jffs2/compr.h
index 509b8b1c0811..aee2de0ca69b 100644
--- a/fs/jffs2/compr.h
+++ b/fs/jffs2/compr.h
@@ -76,16 +76,6 @@ int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
76 76
77void jffs2_free_comprbuf(unsigned char *comprbuf, unsigned char *orig); 77void jffs2_free_comprbuf(unsigned char *comprbuf, unsigned char *orig);
78 78
79#ifdef CONFIG_JFFS2_PROC
80int jffs2_enable_compressor_name(const char *name);
81int jffs2_disable_compressor_name(const char *name);
82int jffs2_set_compression_mode_name(const char *mode_name);
83char *jffs2_get_compression_mode_name(void);
84int jffs2_set_compressor_priority(const char *mode_name, int priority);
85char *jffs2_list_compressors(void);
86char *jffs2_stats(void);
87#endif
88
89/* Compressor modules */ 79/* Compressor modules */
90/* These functions will be called by jffs2_compressors_init/exit */ 80/* These functions will be called by jffs2_compressors_init/exit */
91 81