module: Simple refactor in preparation for split
No functional change. This patch makes it possible to move non-essential code out of core module code. Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Aaron Tomlin <atomlin@redhat.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
This commit is contained in:
parent
cfc1d27789
commit
8ab4ed08a2
@ -7,6 +7,27 @@
|
|||||||
|
|
||||||
#include <linux/elf.h>
|
#include <linux/elf.h>
|
||||||
#include <asm/module.h>
|
#include <asm/module.h>
|
||||||
|
#include <linux/mutex.h>
|
||||||
|
|
||||||
|
#ifndef ARCH_SHF_SMALL
|
||||||
|
#define ARCH_SHF_SMALL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* If this is set, the section belongs in the init part of the module */
|
||||||
|
#define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG - 1))
|
||||||
|
/* Maximum number of characters written by module_flags() */
|
||||||
|
#define MODULE_FLAGS_BUF_SIZE (TAINT_FLAGS_COUNT + 4)
|
||||||
|
|
||||||
|
extern struct mutex module_mutex;
|
||||||
|
extern struct list_head modules;
|
||||||
|
|
||||||
|
/* Provided by the linker */
|
||||||
|
extern const struct kernel_symbol __start___ksymtab[];
|
||||||
|
extern const struct kernel_symbol __stop___ksymtab[];
|
||||||
|
extern const struct kernel_symbol __start___ksymtab_gpl[];
|
||||||
|
extern const struct kernel_symbol __stop___ksymtab_gpl[];
|
||||||
|
extern const s32 __start___kcrctab[];
|
||||||
|
extern const s32 __start___kcrctab_gpl[];
|
||||||
|
|
||||||
struct load_info {
|
struct load_info {
|
||||||
const char *name;
|
const char *name;
|
||||||
|
@ -63,10 +63,6 @@
|
|||||||
#define CREATE_TRACE_POINTS
|
#define CREATE_TRACE_POINTS
|
||||||
#include <trace/events/module.h>
|
#include <trace/events/module.h>
|
||||||
|
|
||||||
#ifndef ARCH_SHF_SMALL
|
|
||||||
#define ARCH_SHF_SMALL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Modules' sections will be aligned on page boundaries
|
* Modules' sections will be aligned on page boundaries
|
||||||
* to ensure complete separation of code and data, but
|
* to ensure complete separation of code and data, but
|
||||||
@ -78,9 +74,6 @@
|
|||||||
# define debug_align(X) (X)
|
# define debug_align(X) (X)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If this is set, the section belongs in the init part of the module */
|
|
||||||
#define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1))
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mutex protects:
|
* Mutex protects:
|
||||||
* 1) List of modules (also safely readable with preempt_disable),
|
* 1) List of modules (also safely readable with preempt_disable),
|
||||||
@ -88,8 +81,8 @@
|
|||||||
* 3) module_addr_min/module_addr_max.
|
* 3) module_addr_min/module_addr_max.
|
||||||
* (delete and add uses RCU list operations).
|
* (delete and add uses RCU list operations).
|
||||||
*/
|
*/
|
||||||
static DEFINE_MUTEX(module_mutex);
|
DEFINE_MUTEX(module_mutex);
|
||||||
static LIST_HEAD(modules);
|
LIST_HEAD(modules);
|
||||||
|
|
||||||
/* Work queue for freeing init sections in success case */
|
/* Work queue for freeing init sections in success case */
|
||||||
static void do_free_init(struct work_struct *w);
|
static void do_free_init(struct work_struct *w);
|
||||||
@ -408,14 +401,6 @@ static __maybe_unused void *any_section_objs(const struct load_info *info,
|
|||||||
return (void *)info->sechdrs[sec].sh_addr;
|
return (void *)info->sechdrs[sec].sh_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Provided by the linker */
|
|
||||||
extern const struct kernel_symbol __start___ksymtab[];
|
|
||||||
extern const struct kernel_symbol __stop___ksymtab[];
|
|
||||||
extern const struct kernel_symbol __start___ksymtab_gpl[];
|
|
||||||
extern const struct kernel_symbol __stop___ksymtab_gpl[];
|
|
||||||
extern const s32 __start___kcrctab[];
|
|
||||||
extern const s32 __start___kcrctab_gpl[];
|
|
||||||
|
|
||||||
#ifndef CONFIG_MODVERSIONS
|
#ifndef CONFIG_MODVERSIONS
|
||||||
#define symversion(base, idx) NULL
|
#define symversion(base, idx) NULL
|
||||||
#else
|
#else
|
||||||
@ -4542,9 +4527,6 @@ static void cfi_cleanup(struct module *mod)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Maximum number of characters written by module_flags() */
|
|
||||||
#define MODULE_FLAGS_BUF_SIZE (TAINT_FLAGS_COUNT + 4)
|
|
||||||
|
|
||||||
/* Keep in sync with MODULE_FLAGS_BUF_SIZE !!! */
|
/* Keep in sync with MODULE_FLAGS_BUF_SIZE !!! */
|
||||||
static char *module_flags(struct module *mod, char *buf)
|
static char *module_flags(struct module *mod, char *buf)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user