From: Lucas De Marchi Date: Thu, 22 Dec 2011 05:39:11 +0000 (-0200) Subject: tools: kmod: Add handling of compat rmmod X-Git-Tag: v3~97 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f712ebc4296336c552742d47df4bf1df1db4bdc1;p=platform%2Fupstream%2Fkmod.git tools: kmod: Add handling of compat rmmod --- diff --git a/Makefile.am b/Makefile.am index cde1415..184ecc8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/tools/kmod-rmmod.c b/tools/kmod-rmmod.c index c365bd6..2593128 100644 --- a/tools/kmod-rmmod.c +++ b/tools/kmod-rmmod.c @@ -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 diff --git a/tools/kmod.c b/tools/kmod.c index c5230f8..4c8dc10 100644 --- a/tools/kmod.c +++ b/tools/kmod.c @@ -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[]) diff --git a/tools/kmod.h b/tools/kmod.h index 54c6b36..290d32e 100644 --- a/tools/kmod.h +++ b/tools/kmod.h @@ -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