[WIP] [PATCH 06/12] erofs-utils: fuse: drop ofs_out

Gao Xiang hsiangkao at aol.com
Sat Oct 17 16:16:15 AEDT 2020


[ 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 | 7 +++----
 fuse/decompress.h | 2 +-
 fuse/read.c       | 3 +--
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/fuse/decompress.c b/fuse/decompress.c
index e2df3cea78f7..4b7cf3211319 100644
--- a/fuse/decompress.c
+++ b/fuse/decompress.c
@@ -15,7 +15,7 @@
 
 static int z_erofs_shifted_transform(struct z_erofs_decompress_req *rq)
 {
-	char *dest = rq->out + rq->ofs_out;
+	char *dest = rq->out;
 	char *src = rq->in + rq->ofs_head;
 
 	memcpy(dest, src, rq->outputsize - rq->ofs_head);
@@ -26,7 +26,7 @@ static int z_erofs_shifted_transform(struct z_erofs_decompress_req *rq)
 static int z_erofs_decompress_generic(struct z_erofs_decompress_req *rq)
 {
 	int ret = 0;
-	char *dest = rq->out + rq->ofs_out;
+	char *dest = rq->out;
 	char *src = rq->in;
 	char *buff = NULL;
 	bool support_0padding = false;
@@ -66,8 +66,7 @@ static int z_erofs_decompress_generic(struct z_erofs_decompress_req *rq)
 
 	if (rq->ofs_head) {
 		src = dest + rq->ofs_head;
-		dest = rq->out + rq->ofs_out;
-		memcpy(dest, src, rq->outputsize - rq->ofs_head);
+		memcpy(rq->out, src, rq->outputsize - rq->ofs_head);
 	}
 
 out:
diff --git a/fuse/decompress.h b/fuse/decompress.h
index cd395c3d6b3f..5a3e2356dc1b 100644
--- a/fuse/decompress.h
+++ b/fuse/decompress.h
@@ -17,7 +17,7 @@ enum {
 struct z_erofs_decompress_req {
 	char *in, *out;
 
-	size_t ofs_out, ofs_head;
+	size_t ofs_head;
 	unsigned int inputsize, outputsize;
 
 	/* indicate the algorithm will be used for decompression */
diff --git a/fuse/read.c b/fuse/read.c
index 3f2e49c390de..06ca08587e7c 100644
--- a/fuse/read.c
+++ b/fuse/read.c
@@ -135,8 +135,7 @@ size_t erofs_read_data_compression(struct erofs_vnode *vnode, char *buffer,
 
 		ret = z_erofs_decompress(&(struct z_erofs_decompress_req) {
 					.in = raw,
-					.out = buffer,
-					.ofs_out = sum,
+					.out = buffer + sum,
 					.ofs_head = ofs,
 					.inputsize = EROFS_BLKSIZ,
 					.outputsize = count,
-- 
2.24.0



More information about the Linux-erofs mailing list