summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-03-27 20:08:20 +0200
committerFelix Fietkau <nbd@openwrt.org>2011-03-27 20:08:20 +0200
commit856b9f1c3794b96738e89b4d7655b3acdb16d9a9 (patch)
treea88c7bd245bb75edb5fb4172bc241e3ef5c351e4
parente8e8798a3292a9801a01357c967e55c62dc83a33 (diff)
adjust for ubus api changes
-rw-r--r--ubus.c38
1 files changed, 9 insertions, 29 deletions
diff --git a/ubus.c b/ubus.c
index 1331d72..cdd1ff0 100644
--- a/ubus.c
+++ b/ubus.c
@@ -8,19 +8,6 @@ static struct blob_buf b;
/* global object */
-static const struct ubus_signature main_object_sig[] = {
- UBUS_METHOD_START("add_device"),
- UBUS_FIELD(STRING, "name"),
- UBUS_METHOD_END(),
-
- UBUS_METHOD_START("del_device"),
- UBUS_FIELD(STRING, "name"),
- UBUS_METHOD_END(),
-};
-
-static struct ubus_object_type main_object_type =
- UBUS_OBJECT_TYPE("netifd", main_object_sig);
-
enum {
DEV_NAME,
DEV_FORCE,
@@ -58,10 +45,13 @@ static int netifd_handle_device(struct ubus_context *ctx, struct ubus_object *ob
}
static struct ubus_method main_object_methods[] = {
- { .name = "add_device", .handler = netifd_handle_device },
- { .name = "del_device", .handler = netifd_handle_device },
+ UBUS_METHOD("add_device", netifd_handle_device, dev_policy),
+ UBUS_METHOD("del_device", netifd_handle_device, dev_policy),
};
+static struct ubus_object_type main_object_type =
+ UBUS_OBJECT_TYPE("netifd", main_object_methods);
+
static struct ubus_object main_object = {
.name = "network.interface",
.type = &main_object_type,
@@ -95,20 +85,6 @@ void netifd_ubus_done(void)
/* per-interface object */
-static const struct ubus_signature iface_object_sig[] = {
- UBUS_METHOD_START("up"),
- UBUS_METHOD_END(),
-
- UBUS_METHOD_START("down"),
- UBUS_METHOD_END(),
-
- UBUS_METHOD_START("status"),
- UBUS_METHOD_END(),
-};
-
-static struct ubus_object_type iface_object_type =
- UBUS_OBJECT_TYPE("netifd_iface", iface_object_sig);
-
static int netifd_handle_up(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
@@ -171,12 +147,16 @@ static int netifd_handle_status(struct ubus_context *ctx, struct ubus_object *ob
return 0;
}
+
static struct ubus_method iface_object_methods[] = {
{ .name = "up", .handler = netifd_handle_up },
{ .name = "down", .handler = netifd_handle_down },
{ .name = "status", .handler = netifd_handle_status },
};
+static struct ubus_object_type iface_object_type =
+ UBUS_OBJECT_TYPE("netifd_iface", iface_object_methods);
+
void netifd_ubus_add_interface(struct interface *iface)
{