lz4: add flags field to comp_opts structure
Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
diff --git a/squashfs-tools/lz4_wrapper.c b/squashfs-tools/lz4_wrapper.c
index aadf07f..e906093 100644
--- a/squashfs-tools/lz4_wrapper.c
+++ b/squashfs-tools/lz4_wrapper.c
@@ -92,6 +92,7 @@
static void *lz4_dump_options(int block_size, int *size)
{
comp_opts.version = LZ4_LEGACY;
+ comp_opts.flags = 0;
SQUASHFS_INSWAP_COMP_OPTS(&comp_opts);
*size = sizeof(comp_opts);
@@ -133,6 +134,14 @@
if(comp_opts->version != LZ4_LEGACY)
goto failed;
+ /*
+ * we currently don't know about any flags, so if the flags field is not
+ * zero we don't know how that affects compression or decompression,
+ * which is a comp_opts read failure
+ */
+ if(comp_opts->flags != 0)
+ goto failed;
+
return 0;
failed:
@@ -157,6 +166,13 @@
if(comp_opts->version != LZ4_LEGACY)
goto failed;
+ /*
+ * we currently don't know about any flags, so if the flags field is not
+ * zero we don't know how to display that, which is a failure
+ */
+ if(comp_opts->flags != 0)
+ goto failed;
+
return;
failed:
diff --git a/squashfs-tools/lz4_wrapper.h b/squashfs-tools/lz4_wrapper.h
index d2b9671..c63024b 100644
--- a/squashfs-tools/lz4_wrapper.h
+++ b/squashfs-tools/lz4_wrapper.h
@@ -37,6 +37,7 @@
#define SQUASHFS_INSWAP_COMP_OPTS(s) { \
(s)->version = inswap_le32((s)->version); \
+ (s)->flags = inswap_le32((s)->flags); \
}
#else
#define SQUASHFS_INSWAP_COMP_OPTS(s)
@@ -51,5 +52,6 @@
struct lz4_comp_opts {
int version;
+ int flags;
};
#endif