Message ID | 20240212-decompression-fixes-v1-11-06f92ad07985@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Load compressed modules with compression-less kmod | expand |
On Mon, Feb 12, 2024 at 05:23:12PM GMT, Emil Velikov via B4 Relay wrote: >From: Emil Velikov <emil.l.velikov@gmail.com> > >We're about to reference it in comp_types with next commit. > >Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> thanks Lucas De Marchi >--- > libkmod/libkmod-file.c | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > >diff --git a/libkmod/libkmod-file.c b/libkmod/libkmod-file.c >index c4893fd..db775a6 100644 >--- a/libkmod/libkmod-file.c >+++ b/libkmod/libkmod-file.c >@@ -358,18 +358,6 @@ static int load_zlib(struct kmod_file *file) > > static const char magic_zlib[] = {0x1f, 0x8b}; > >-static const struct comp_type { >- size_t magic_size; >- enum kmod_file_compression_type compression; >- const char *magic_bytes; >- int (*load)(struct kmod_file *file); >-} comp_types[] = { >- {sizeof(magic_zstd), KMOD_FILE_COMPRESSION_ZSTD, magic_zstd, load_zstd}, >- {sizeof(magic_xz), KMOD_FILE_COMPRESSION_XZ, magic_xz, load_xz}, >- {sizeof(magic_zlib), KMOD_FILE_COMPRESSION_ZLIB, magic_zlib, load_zlib}, >- {0, KMOD_FILE_COMPRESSION_NONE, NULL, NULL} >-}; >- > static int load_reg(struct kmod_file *file) > { > struct stat st; >@@ -388,6 +376,18 @@ static int load_reg(struct kmod_file *file) > return 0; > } > >+static const struct comp_type { >+ size_t magic_size; >+ enum kmod_file_compression_type compression; >+ const char *magic_bytes; >+ int (*load)(struct kmod_file *file); >+} comp_types[] = { >+ {sizeof(magic_zstd), KMOD_FILE_COMPRESSION_ZSTD, magic_zstd, load_zstd}, >+ {sizeof(magic_xz), KMOD_FILE_COMPRESSION_XZ, magic_xz, load_xz}, >+ {sizeof(magic_zlib), KMOD_FILE_COMPRESSION_ZLIB, magic_zlib, load_zlib}, >+ {0, KMOD_FILE_COMPRESSION_NONE, NULL, NULL} >+}; >+ > struct kmod_elf *kmod_file_get_elf(struct kmod_file *file) > { > int err; > >-- >2.43.0 >
diff --git a/libkmod/libkmod-file.c b/libkmod/libkmod-file.c index c4893fd..db775a6 100644 --- a/libkmod/libkmod-file.c +++ b/libkmod/libkmod-file.c @@ -358,18 +358,6 @@ static int load_zlib(struct kmod_file *file) static const char magic_zlib[] = {0x1f, 0x8b}; -static const struct comp_type { - size_t magic_size; - enum kmod_file_compression_type compression; - const char *magic_bytes; - int (*load)(struct kmod_file *file); -} comp_types[] = { - {sizeof(magic_zstd), KMOD_FILE_COMPRESSION_ZSTD, magic_zstd, load_zstd}, - {sizeof(magic_xz), KMOD_FILE_COMPRESSION_XZ, magic_xz, load_xz}, - {sizeof(magic_zlib), KMOD_FILE_COMPRESSION_ZLIB, magic_zlib, load_zlib}, - {0, KMOD_FILE_COMPRESSION_NONE, NULL, NULL} -}; - static int load_reg(struct kmod_file *file) { struct stat st; @@ -388,6 +376,18 @@ static int load_reg(struct kmod_file *file) return 0; } +static const struct comp_type { + size_t magic_size; + enum kmod_file_compression_type compression; + const char *magic_bytes; + int (*load)(struct kmod_file *file); +} comp_types[] = { + {sizeof(magic_zstd), KMOD_FILE_COMPRESSION_ZSTD, magic_zstd, load_zstd}, + {sizeof(magic_xz), KMOD_FILE_COMPRESSION_XZ, magic_xz, load_xz}, + {sizeof(magic_zlib), KMOD_FILE_COMPRESSION_ZLIB, magic_zlib, load_zlib}, + {0, KMOD_FILE_COMPRESSION_NONE, NULL, NULL} +}; + struct kmod_elf *kmod_file_get_elf(struct kmod_file *file) { int err;