linux/fs/jffs2/compr.h

/*
 * JFFS2 -- Journalling Flash File System, Version 2.
 *
 * Copyright © 2004   Ferenc Havasi <[email protected]>,
 *		      University of Szeged, Hungary
 * Copyright © 2004-2010 David Woodhouse <[email protected]>
 *
 * For licensing information, see the file 'LICENCE' in this directory.
 *
 */

#ifndef __JFFS2_COMPR_H__
#define __JFFS2_COMPR_H__

#include <linux/kernel.h>
#include <linux/vmalloc.h>
#include <linux/list.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/jffs2.h>
#include "jffs2_fs_i.h"
#include "jffs2_fs_sb.h"
#include "nodelist.h"

#define JFFS2_RUBINMIPS_PRIORITY
#define JFFS2_DYNRUBIN_PRIORITY
#define JFFS2_LZARI_PRIORITY
#define JFFS2_RTIME_PRIORITY
#define JFFS2_ZLIB_PRIORITY
#define JFFS2_LZO_PRIORITY


#define JFFS2_RUBINMIPS_DISABLED
#define JFFS2_DYNRUBIN_DISABLED

#define JFFS2_COMPR_MODE_NONE
#define JFFS2_COMPR_MODE_PRIORITY
#define JFFS2_COMPR_MODE_SIZE
#define JFFS2_COMPR_MODE_FAVOURLZO
#define JFFS2_COMPR_MODE_FORCELZO
#define JFFS2_COMPR_MODE_FORCEZLIB

#define FAVOUR_LZO_PERCENT

struct jffs2_compressor {};

int jffs2_register_compressor(struct jffs2_compressor *comp);
int jffs2_unregister_compressor(struct jffs2_compressor *comp);

int jffs2_compressors_init(void);
int jffs2_compressors_exit(void);

uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
			unsigned char *data_in, unsigned char **cpage_out,
			uint32_t *datalen, uint32_t *cdatalen);

int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
		     uint16_t comprtype, unsigned char *cdata_in,
		     unsigned char *data_out, uint32_t cdatalen, uint32_t datalen);

void jffs2_free_comprbuf(unsigned char *comprbuf, unsigned char *orig);

/* Compressor modules */
/* These functions will be called by jffs2_compressors_init/exit */

#ifdef CONFIG_JFFS2_RUBIN
int jffs2_rubinmips_init(void);
void jffs2_rubinmips_exit(void);
int jffs2_dynrubin_init(void);
void jffs2_dynrubin_exit(void);
#else
static inline int jffs2_rubinmips_init(void) { return 0; }
static inline void jffs2_rubinmips_exit(void) {}
static inline int jffs2_dynrubin_init(void) { return 0; }
static inline void jffs2_dynrubin_exit(void) {}
#endif
#ifdef CONFIG_JFFS2_RTIME
extern int jffs2_rtime_init(void);
extern void jffs2_rtime_exit(void);
#else
static inline int jffs2_rtime_init(void) { return 0; }
static inline void jffs2_rtime_exit(void) {}
#endif
#ifdef CONFIG_JFFS2_ZLIB
extern int jffs2_zlib_init(void);
extern void jffs2_zlib_exit(void);
#else
static inline int jffs2_zlib_init(void) { return 0; }
static inline void jffs2_zlib_exit(void) {}
#endif
#ifdef CONFIG_JFFS2_LZO
extern int jffs2_lzo_init(void);
extern void jffs2_lzo_exit(void);
#else
static inline int jffs2_lzo_init(void) { return 0; }
static inline void jffs2_lzo_exit(void) {}
#endif

#endif /* __JFFS2_COMPR_H__ */