summaryrefslogtreecommitdiffstats
path: root/fs/logfs/compr.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-09-11 09:04:46 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2016-12-14 23:48:11 -0500
commit1d0fd57a50aa372dd2e84b16711023cbcd826cb8 (patch)
treed80b0315115e733f41fb412dbbb3cba035bbfcff /fs/logfs/compr.c
parent64d2ab32efe39354c29e1ecefea3769586026979 (diff)
logfs: remove from tree
Logfs was introduced to the kernel in 2009, and hasn't seen any non drive-by changes since 2012, while having lots of unsolved issues including the complete lack of error handling, with more and more issues popping up without any fixes. The logfs.org domain has been bouncing from a mail, and the maintainer on the non-logfs.org domain hasn't repsonded to past queries either. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/logfs/compr.c')
-rw-r--r--fs/logfs/compr.c95
1 files changed, 0 insertions, 95 deletions
diff --git a/fs/logfs/compr.c b/fs/logfs/compr.c
deleted file mode 100644
index 961f02b86d97..000000000000
--- a/fs/logfs/compr.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * fs/logfs/compr.c - compression routines
- *
- * As should be obvious for Linux kernel code, license is GPLv2
- *
- * Copyright (c) 2005-2008 Joern Engel <joern@logfs.org>
- */
-#include "logfs.h"
-#include <linux/vmalloc.h>
-#include <linux/zlib.h>
-
-#define COMPR_LEVEL 3
-
-static DEFINE_MUTEX(compr_mutex);
-static struct z_stream_s stream;
-
-int logfs_compress(void *in, void *out, size_t inlen, size_t outlen)
-{
- int err, ret;
-
- ret = -EIO;
- mutex_lock(&compr_mutex);
- err = zlib_deflateInit(&stream, COMPR_LEVEL);
- if (err != Z_OK)
- goto error;
-
- stream.next_in = in;
- stream.avail_in = inlen;
- stream.total_in = 0;
- stream.next_out = out;
- stream.avail_out = outlen;
- stream.total_out = 0;
-
- err = zlib_deflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END)
- goto error;
-
- err = zlib_deflateEnd(&stream);
- if (err != Z_OK)
- goto error;
-
- if (stream.total_out >= stream.total_in)
- goto error;
-
- ret = stream.total_out;
-error:
- mutex_unlock(&compr_mutex);
- return ret;
-}
-
-int logfs_uncompress(void *in, void *out, size_t inlen, size_t outlen)
-{
- int err, ret;
-
- ret = -EIO;
- mutex_lock(&compr_mutex);
- err = zlib_inflateInit(&stream);
- if (err != Z_OK)
- goto error;
-
- stream.next_in = in;
- stream.avail_in = inlen;
- stream.total_in = 0;
- stream.next_out = out;
- stream.avail_out = outlen;
- stream.total_out = 0;
-
- err = zlib_inflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END)
- goto error;
-
- err = zlib_inflateEnd(&stream);
- if (err != Z_OK)
- goto error;
-
- ret = 0;
-error:
- mutex_unlock(&compr_mutex);
- return ret;
-}
-
-int __init logfs_compr_init(void)
-{
- size_t size = max(zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL),
- zlib_inflate_workspacesize());
- stream.workspace = vmalloc(size);
- if (!stream.workspace)
- return -ENOMEM;
- return 0;
-}
-
-void logfs_compr_exit(void)
-{
- vfree(stream.workspace);
-}