tools: kmod: bundle depmod together with the others

This commit is contained in:
Lucas De Marchi 2011-12-27 19:56:33 -02:00
parent bcb812275e
commit f6cf14ce13
4 changed files with 26 additions and 4 deletions

View File

@ -109,9 +109,12 @@ tools_kmod_depmod_LDFLAGS = $(AM_LDFLAGS)
tools_kmod_SOURCES = tools/kmod.c tools/kmod.h tools/kmod-lsmod.c \
tools/kmod-rmmod.c tools/kmod-insmod.c \
tools/kmod-modinfo.c tools/kmod-modprobe.c
tools/kmod-modinfo.c tools/kmod-modprobe.c \
tools/kmod-depmod.c
tools_kmod_CPPFLAGS = $(AM_CPPFLAGS) -DKMOD_BUNDLE_TOOL=1
tools_kmod_LDADD = libkmod/libkmod.la
tools_kmod_CFLAGS = $(AM_CFLAGS)
tools_kmod_LDADD = libkmod/libkmod-util.la \
libkmod/libkmod.la
endif
TESTS = test/test-init test/test-loaded

View File

@ -184,7 +184,7 @@ static inline void _log(int prio, const char *fmt, ...)
/* binary index write *************************************************/
#include <arpa/inet.h>
#define NOFAIL(x) x
#include "macro.h"
/* BEGIN: code from module-init-tools/index.c just modified to compile here.
*
* Original copyright:
@ -2667,7 +2667,7 @@ static int is_version_number(const char *version)
return (sscanf(version, "%u.%u", &d1, &d2) == 2);
}
int main(int argc, char *argv[])
static int do_depmod(int argc, char *argv[])
{
FILE *out = NULL;
int i, err = 0, all = 0, maybe_all = 0, n_config_paths = 0;
@ -2893,3 +2893,20 @@ cmdline_failed:
free(config_paths);
return EXIT_FAILURE;
}
#ifndef KMOD_BUNDLE_TOOL
int main(int argc, char *argv[])
{
return do_depmod(argc, argv);
}
#else
#include "kmod.h"
const struct kmod_cmd kmod_cmd_compat_depmod = {
.name = "depmod",
.cmd = do_depmod,
.help = "compat depmod command",
};
#endif

View File

@ -45,6 +45,7 @@ static const struct kmod_cmd *kmod_compat_cmds[] = {
&kmod_cmd_compat_insmod,
&kmod_cmd_compat_modinfo,
&kmod_cmd_compat_modprobe,
&kmod_cmd_compat_depmod,
};
static int kmod_help(int argc, char *argv[])

View File

@ -33,6 +33,7 @@ extern const struct kmod_cmd kmod_cmd_compat_rmmod;
extern const struct kmod_cmd kmod_cmd_compat_insmod;
extern const struct kmod_cmd kmod_cmd_compat_modinfo;
extern const struct kmod_cmd kmod_cmd_compat_modprobe;
extern const struct kmod_cmd kmod_cmd_compat_depmod;
extern const struct kmod_cmd kmod_cmd_list;
#endif