]> git.ipfire.org Git - thirdparty/kmod.git/commit
libkmod: Do not inititialize file->memory on open
authorLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 1 Jun 2023 22:39:57 +0000 (15:39 -0700)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Fri, 9 Jun 2023 17:45:51 +0000 (10:45 -0700)
commit7a86f1292051e990507ea48888864ff19626a206
tree14059b9d89a9c4497c3b1a58068059299970756a
parent9c262fdb1c798fd87d91e8c669acbec4d632024b
libkmod: Do not inititialize file->memory on open

Add a separate function to load the file contents when it's needed.
When it's not needed on the path of loading modules via finit_module(),
there is no need to mmap the file. This will help support loading
modules with the in-kernel compression support.

This is done differently than the lazy initialization for
kmod_file_get_elf() because on the contents case there is also the
file->size to be updated. It would be a weird API to return the pointer
and have the size changed as a side-effect.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod-elf.c
libkmod/libkmod-file.c
libkmod/libkmod-internal.h
libkmod/libkmod-module.c