tools: kmod: Add handling of compat rmmod

This commit is contained in:
Lucas De Marchi 2011-12-22 03:39:11 -02:00
parent 6fcf69e62b
commit f712ebc429
4 changed files with 22 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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[])

View File

@ -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