mirror of
https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git
synced 2024-12-03 00:33:43 +08:00
tools: kmod: Add handling of compat rmmod
This commit is contained in:
parent
6fcf69e62b
commit
f712ebc429
@ -90,7 +90,8 @@ tools_kmod_lsmod_LDADD = libkmod/libkmod.la
|
||||
tools_kmod_modprobe_LDADD = libkmod/libkmod.la
|
||||
tools_kmod_modinfo_LDADD = libkmod/libkmod.la
|
||||
|
||||
tools_kmod_SOURCES = tools/kmod.c tools/kmod.h tools/kmod-lsmod.c
|
||||
tools_kmod_SOURCES = tools/kmod.c tools/kmod.h tools/kmod-lsmod.c \
|
||||
tools/kmod-rmmod.c
|
||||
tools_kmod_CPPFLAGS = $(AM_CPPFLAGS) -DKMOD_BUNDLE_TOOL=1
|
||||
tools_kmod_LDADD = libkmod/libkmod.la
|
||||
endif
|
||||
|
@ -100,7 +100,7 @@ static void log_syslog(void *data, int priority, const char *file, int line,
|
||||
(void)data;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
static int do_rmmod(int argc, char *argv[])
|
||||
{
|
||||
struct kmod_ctx *ctx;
|
||||
const char *null_config = NULL;
|
||||
@ -193,3 +193,20 @@ int main(int argc, char *argv[])
|
||||
|
||||
return err >= 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
#ifndef KMOD_BUNDLE_TOOL
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
return do_rmmod(argc, argv);
|
||||
}
|
||||
|
||||
#else
|
||||
#include "kmod.h"
|
||||
|
||||
const struct kmod_cmd kmod_cmd_compat_rmmod = {
|
||||
.name = "rmmod",
|
||||
.cmd = do_rmmod,
|
||||
.help = "compat rmmod command",
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -40,6 +40,7 @@ static const struct kmod_cmd *kmod_cmds[] = {
|
||||
|
||||
static const struct kmod_cmd *kmod_compat_cmds[] = {
|
||||
&kmod_cmd_compat_lsmod,
|
||||
&kmod_cmd_compat_rmmod,
|
||||
};
|
||||
|
||||
static int kmod_help(int argc, char *argv[])
|
||||
|
@ -28,5 +28,6 @@ struct kmod_cmd {
|
||||
};
|
||||
|
||||
extern const struct kmod_cmd kmod_cmd_compat_lsmod;
|
||||
extern const struct kmod_cmd kmod_cmd_compat_rmmod;
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user