compressor: don't overload extract_options

When I added LZ4 support, I realised that Unsquashfs should
check the compression options (if any) to ensure that the decompressor
can decompress the filesystem.

This situation never occurred before because gzip and lzo doesn't
have any options, and I envisaged that xz will always implicitly be able
to *decompress* any filesystem irrespective of any hitherto unimplemented
compression features.  In otherwords I anticipated we should check the
options in mksquashfs (on append), but not on decompression with
unsquashfs.

LZ4 changed that because the kernel is currently using the LZ4
legacy format, and this may change, creating a situation where in
the future there may be a new format, which is *not* currently understood.
Therefore Unsquashfs needs to check the options too.

I initially used extract_options(), but this has thrown up subtle
differences in the handling of compression options between unsquashfs
and mksquashfs.  Specificallyx, in the handling of the presence of
compression options where the compressor hasn't got an extract_options
function.  This is clear indication that the filesystem is newer than
the code because it has compression options whereas the code hasn't
any support for them.

Now in mksquashfs where it is appending to the filesystem, this is a
definate fail because we obviously cannot extract the options and
set the compressor to the appropriate state.  But, this should not
be a fail for Unsquashfs, because in retro-fitting compression
options to a compressor which didn't originally have them (i.e. LZO),
we have to ensure that the new compression options are implicitly
decompressible by the original code, because the original code
doesn't check them.

So for instance with LZO, we cannot allow an old Mksquashfs to append
to an LZO filesystem compressed with the new compression options, but,
it is perfectly possible for an old version of Unsquashfs to decompress
this filesystem.

So don't overload extract_options, and instead introduce a new
check_options specifically for Unsquashfs, and specifically only
for the decompressors (LZ4) which need to check them.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
3 files changed
tree: 5662aba61fa4de8307f2d80f0f47e0873f272dfd
  1. kernel/
  2. kernel-2.4/
  3. squashfs-tools/
  4. README