Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libkmod/libkmod-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <sys/stat.h>
#include <sys/types.h>

#include <shared/missing.h> // For basename
#include <shared/util.h>

#include "libkmod.h"
Expand Down
1 change: 1 addition & 0 deletions libkmod/libkmod-elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <assert.h>
#include <elf.h>
#include <endian.h>
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
Expand Down
1 change: 0 additions & 1 deletion libkmod/libkmod-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <limits.h>

#include <shared/macro.h>
#include <shared/missing.h>

#include "libkmod.h"

Expand Down
11 changes: 11 additions & 0 deletions libkmod/libkmod-module.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <sys/types.h>
#include <sys/wait.h>

#include <shared/missing.h> // For finit_module
#include <shared/strbuf.h>
#include <shared/util.h>

Expand Down Expand Up @@ -620,6 +621,16 @@ KMOD_EXPORT int kmod_module_remove_module(struct kmod_module *mod, unsigned int

extern long init_module(const void *mem, unsigned long len, const char *args);

/*
* (Re-)define some linux/module.h macros.
*
* In practice, most people/distros do not have the relevant package/header during the
* build. The values are UAPI and cannot change, so we might as well have them locally.
*/
#define MODULE_INIT_IGNORE_MODVERSIONS 1
#define MODULE_INIT_IGNORE_VERMAGIC 2
#define MODULE_INIT_COMPRESSED_FILE 4

static int do_finit_module(struct kmod_module *mod, unsigned int flags, const char *args)
{
enum kmod_file_compression_type compression, kernel_compression;
Expand Down
1 change: 0 additions & 1 deletion libkmod/libkmod-signature.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <string.h>

#include <shared/elf-note.h>
#include <shared/missing.h>
#include <shared/util.h>

#include "libkmod-internal.h"
Expand Down
12 changes: 0 additions & 12 deletions shared/missing.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@
#include <unistd.h>
#include <sys/syscall.h>

/*
* Macros pulled from linux/module.h, to avoid pulling the header.
*
* In practice, very few people have it installed and distros do not install the
* relevant package during their build.
*
* Values are UAPI, so they cannot change.
*/
#define MODULE_INIT_IGNORE_MODVERSIONS 1
#define MODULE_INIT_IGNORE_VERMAGIC 2
#define MODULE_INIT_COMPRESSED_FILE 4

#ifndef __NR_finit_module
#warning __NR_finit_module missing - kmod might not work correctly
#define __NR_finit_module -1
Expand Down
2 changes: 1 addition & 1 deletion shared/tmpfile-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <unistd.h>

#include <shared/macro.h>
#include <shared/missing.h>
#include <shared/missing.h> // For basename
#include <shared/tmpfile-util.h>
#include <shared/util.h>

Expand Down
2 changes: 1 addition & 1 deletion shared/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <string.h>
#include <unistd.h>

#include <shared/missing.h>
#include <shared/missing.h> // For basename
#include <shared/util.h>

#define USEC_PER_SEC 1000000ULL
Expand Down
1 change: 1 addition & 0 deletions testsuite/init_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <sys/types.h>
#include <sys/utsname.h>

#include <shared/missing.h> // For finit_module
#include <shared/util.h>

/* kmod_elf_get_section() is not exported, we need the private header */
Expand Down
2 changes: 1 addition & 1 deletion testsuite/testsuite.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <sys/stat.h>
#include <sys/wait.h>

#include <shared/missing.h>
#include <shared/missing.h> // For basename
#include <shared/util.h>

#include "testsuite.h"
Expand Down
1 change: 1 addition & 0 deletions tools/depmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <shared/array.h>
#include <shared/hash.h>
#include <shared/macro.h>
#include <shared/missing.h> // For basename
#include <shared/strbuf.h>
#include <shared/tmpfile-util.h>
#include <shared/util.h>
Expand Down
2 changes: 1 addition & 1 deletion tools/kmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
*/

#include <getopt.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <shared/util.h>
#include <shared/missing.h>

#include <libkmod/libkmod.h>

Expand Down
Loading