From bc100538d3883639a948f4158015f6a0b255bcd7 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 2 Sep 2013 14:52:22 +0200 Subject: [PATCH] iwinfo: convert to plugin library --- iwinfo.c | 11 +++++++---- iwinfo.h | 4 ++-- main.c | 2 -- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/iwinfo.c b/iwinfo.c index d3866cb..893da01 100644 --- a/iwinfo.c +++ b/iwinfo.c @@ -16,10 +16,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include -#include - #include "iwinfo.h" +#include "plugin.h" static struct blob_buf buf; static const struct iwinfo_ops *iw; @@ -622,7 +620,8 @@ rpc_iwinfo_devices(struct ubus_context *ctx, struct ubus_object *obj, } -int rpc_iwinfo_api_init(struct ubus_context *ctx) +static int +rpc_iwinfo_api_init(const struct rpc_daemon_ops *o, struct ubus_context *ctx) { static const struct ubus_method iwinfo_methods[] = { { .name = "devices", .handler = rpc_iwinfo_devices }, @@ -646,3 +645,7 @@ int rpc_iwinfo_api_init(struct ubus_context *ctx) return ubus_add_object(ctx, &obj); } + +const struct rpc_plugin rpc_plugin = { + .init = rpc_iwinfo_api_init +}; diff --git a/iwinfo.h b/iwinfo.h index 0464815..bc1a8bb 100644 --- a/iwinfo.h +++ b/iwinfo.h @@ -19,10 +19,10 @@ #ifndef __RPC_IWINFO_H #define __RPC_IWINFO_H +#include +#include #include #include #include -int rpc_iwinfo_api_init(struct ubus_context *ctx); - #endif diff --git a/main.c b/main.c index c8b6d41..4b8956f 100644 --- a/main.c +++ b/main.c @@ -26,7 +26,6 @@ #include "session.h" #include "file.h" #include "uci.h" -#include "iwinfo.h" #include "luci2.h" #include "plugin.h" @@ -65,7 +64,6 @@ int main(int argc, char **argv) rpc_session_api_init(ctx); rpc_file_api_init(ctx); rpc_uci_api_init(ctx); - rpc_iwinfo_api_init(ctx); rpc_luci2_api_init(ctx); rpc_plugin_api_init(ctx);