summaryrefslogtreecommitdiffstats
path: root/cpukit/libfs/src/jffs2/src/compr_rtime.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/libfs/src/jffs2/src/compr_rtime.c')
-rw-r--r--cpukit/libfs/src/jffs2/src/compr_rtime.c57
1 files changed, 25 insertions, 32 deletions
diff --git a/cpukit/libfs/src/jffs2/src/compr_rtime.c b/cpukit/libfs/src/jffs2/src/compr_rtime.c
index 16a5047903..3386d1e1da 100644
--- a/cpukit/libfs/src/jffs2/src/compr_rtime.c
+++ b/cpukit/libfs/src/jffs2/src/compr_rtime.c
@@ -28,15 +28,20 @@
#include <linux/jffs2.h>
#include "compr.h"
-/* _compress returns the compressed size, -1 if bigger */
-static int jffs2_rtime_compress(unsigned char *data_in,
- unsigned char *cpage_out,
- uint32_t *sourcelen, uint32_t *dstlen)
+uint16_t rtems_jffs2_compressor_rtime_compress(
+ rtems_jffs2_compressor_control *self,
+ unsigned char *data_in,
+ unsigned char *cpage_out,
+ uint32_t *sourcelen,
+ uint32_t *dstlen
+)
{
short positions[256];
int outpos = 0;
int pos=0;
+ (void) self;
+
memset(positions,0,sizeof(positions));
while (pos < (*sourcelen) && outpos <= (*dstlen)-2) {
@@ -60,24 +65,35 @@ static int jffs2_rtime_compress(unsigned char *data_in,
if (outpos >= pos) {
/* We failed */
- return -1;
+ return JFFS2_COMPR_NONE;
}
/* Tell the caller how much we managed to compress, and how much space it took */
*sourcelen = pos;
*dstlen = outpos;
- return 0;
+ return JFFS2_COMPR_RTIME;
}
-static int jffs2_rtime_decompress(unsigned char *data_in,
- unsigned char *cpage_out,
- uint32_t srclen, uint32_t destlen)
+int rtems_jffs2_compressor_rtime_decompress(
+ rtems_jffs2_compressor_control *self,
+ uint16_t comprtype,
+ unsigned char *data_in,
+ unsigned char *cpage_out,
+ uint32_t srclen,
+ uint32_t destlen
+)
{
short positions[256];
int outpos = 0;
int pos=0;
+ (void) self;
+
+ if (comprtype != JFFS2_COMPR_RTIME) {
+ return -EIO;
+ }
+
memset(positions,0,sizeof(positions));
while (outpos<destlen) {
@@ -105,26 +121,3 @@ static int jffs2_rtime_decompress(unsigned char *data_in,
}
return 0;
}
-
-static struct jffs2_compressor jffs2_rtime_comp = {
- .priority = JFFS2_RTIME_PRIORITY,
- .name = "rtime",
- .compr = JFFS2_COMPR_RTIME,
- .compress = &jffs2_rtime_compress,
- .decompress = &jffs2_rtime_decompress,
-#ifdef JFFS2_RTIME_DISABLED
- .disabled = 1,
-#else
- .disabled = 0,
-#endif
-};
-
-int jffs2_rtime_init(void)
-{
- return jffs2_register_compressor(&jffs2_rtime_comp);
-}
-
-void jffs2_rtime_exit(void)
-{
- jffs2_unregister_compressor(&jffs2_rtime_comp);
-}