fs/squashfs: Add init and clean-up functions to decompression

Add sqfs_decompressor_init() and sqfs_decompressor_cleanup(). These
functions are called respectively in sqfs_probe() and sqfs_close(). For
now, only ZSTD requires an initialization logic. ZSTD support will be
added in a follow-up commit.

Move squashfs_ctxt definition to sqfs_filesystem.h. This structure is
passed to sqfs_decompressor_init() and sqfs_decompressor_cleanup(), so
it can no longer be local to sqfs.c.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c
index 340e5eb..598b42c 100644
--- a/fs/squashfs/sqfs.c
+++ b/fs/squashfs/sqfs.c
@@ -23,12 +23,6 @@
 #include "sqfs_filesystem.h"
 #include "sqfs_utils.h"
 
-struct squashfs_ctxt {
-	struct disk_partition cur_part_info;
-	struct blk_desc *cur_dev;
-	struct squashfs_super_block *sblk;
-};
-
 static struct squashfs_ctxt ctxt;
 
 static int sqfs_disk_read(__u32 block, __u32 nr_blocks, void *buf)
@@ -1023,6 +1017,14 @@
 
 	ctxt.sblk = sblk;
 
+	ret = sqfs_decompressor_init(&ctxt);
+
+	if (ret) {
+		ctxt.cur_dev = NULL;
+		free(ctxt.sblk);
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
@@ -1525,6 +1527,7 @@
 {
 	free(ctxt.sblk);
 	ctxt.cur_dev = NULL;
+	sqfs_decompressor_cleanup(&ctxt);
 }
 
 void sqfs_closedir(struct fs_dir_stream *dirs)