[WIP] [PATCH 08/12] erofs-utils: fuse: drop z_erofs_shifted_transform()
Gao Xiang
hsiangkao at aol.com
Sat Oct 17 16:16:17 AEDT 2020
clean up as well.
[ let's fold in to the original patch. ]
Cc: Huang Jianan <huangjianan at oppo.com>
Signed-off-by: Gao Xiang <hsiangkao at aol.com>
---
fuse/decompress.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/fuse/decompress.c b/fuse/decompress.c
index 4a9f8e7995c1..d3ee3677e9a3 100644
--- a/fuse/decompress.c
+++ b/fuse/decompress.c
@@ -13,19 +13,6 @@
#include "logging.h"
#include "init.h"
-static int z_erofs_shifted_transform(struct z_erofs_decompress_req *rq)
-{
- char *dest = rq->out;
- char *src = rq->in + rq->ofs_head;
-
- if (rq->inputsize != EROFS_BLKSIZ)
- return -EFSCORRUPTED;
-
- DBG_BUGON(rq->outputsize > EROFS_BLKSIZ);
- memcpy(dest, src, rq->outputsize - rq->ofs_head);
- return 0;
-}
-
static int z_erofs_decompress_generic(struct z_erofs_decompress_req *rq)
{
int ret = 0;
@@ -81,8 +68,17 @@ out:
int z_erofs_decompress(struct z_erofs_decompress_req *rq)
{
- if (rq->alg == Z_EROFS_COMPRESSION_SHIFTED)
- return z_erofs_shifted_transform(rq);
+ if (rq->alg == Z_EROFS_COMPRESSION_SHIFTED) {
+ if (rq->inputsize != EROFS_BLKSIZ)
+ return -EFSCORRUPTED;
+
+ DBG_BUGON(rq->outputsize > EROFS_BLKSIZ);
+ DBG_BUGON(rq->outputsize < rq->ofs_head);
+
+ memcpy(rq->out, rq->in + rq->ofs_head,
+ rq->outputsize - rq->ofs_head);
+ return 0;
+ }
return z_erofs_decompress_generic(rq);
}
--
2.24.0
More information about the Linux-erofs
mailing list