[OpenWrt-Devel] [netifd][PATCH v2 1/2] Changes for more readability.

Yousong Zhou yszhou4tech at gmail.com
Thu Aug 20 22:11:56 EDT 2015


Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
 device.h    |    3 +++
 interface.c |    4 ++--
 interface.h |    1 +
 ubus.c      |    2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/device.h b/device.h
index ce135ba..798e19e 100644
--- a/device.h
+++ b/device.h
@@ -160,8 +160,11 @@ struct device {
 	struct blob_attr *config;
 	bool config_pending;
 	bool sys_present;
+	/* DEV_EVENT_ADD */
 	bool present;
+	/* DEV_EVENT_UP */
 	int active;
+	/* DEV_EVENT_LINK_UP */
 	bool link_active;
 
 	bool external;
diff --git a/interface.c b/interface.c
index 848990e..ffe7988 100644
--- a/interface.c
+++ b/interface.c
@@ -649,7 +649,7 @@ interface_handle_config_change(struct interface *iface)
 }
 
 static void
-interface_proto_cb(struct interface_proto_state *state, enum interface_proto_event ev)
+interface_proto_event_cb(struct interface_proto_state *state, enum interface_proto_event ev)
 {
 	struct interface *iface = state->iface;
 
@@ -708,7 +708,7 @@ void interface_set_proto_state(struct interface *iface, struct interface_proto_s
 	if (!state)
 		return;
 
-	state->proto_event = interface_proto_cb;
+	state->proto_event = interface_proto_event_cb;
 	state->iface = iface;
 }
 
diff --git a/interface.h b/interface.h
index 8eeb7db..6f9112c 100644
--- a/interface.h
+++ b/interface.h
@@ -120,6 +120,7 @@ struct interface {
 
 	struct list_head users;
 
+	/* for alias interface */
 	const char *parent_ifname;
 	struct interface_user parent_iface;
 
diff --git a/ubus.c b/ubus.c
index 56f7bdd..c834d11 100644
--- a/ubus.c
+++ b/ubus.c
@@ -817,7 +817,7 @@ netifd_iface_handle_device(struct ubus_context *ctx, struct ubus_object *obj,
 
 	cur = tb[DEV_LINK_EXT];
 	if (cur)
-		link_ext = !!blobmsg_get_u8(cur);
+		link_ext = blobmsg_get_bool(cur);
 
 	return interface_handle_link(iface, blobmsg_data(tb[DEV_LINK_NAME]), add, link_ext);
 }
-- 
1.7.10.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list