From 65963f0ad2207b55dc7715015839b59b58855a67 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 19 Oct 2013 17:30:04 +0200 Subject: [PATCH] interface: remove "dynamic" argument for interface_init, add the interface_set_dynamic function instead Signed-off-by: Felix Fietkau --- config.c | 2 +- interface.c | 10 ++++++---- interface.h | 4 +++- ubus.c | 3 ++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/config.c b/config.c index f589a4b..682db54 100644 --- a/config.c +++ b/config.c @@ -75,7 +75,7 @@ config_parse_interface(struct uci_section *s, bool alias) if (!iface) return; - interface_init(iface, s->e.name, b.head, false); + interface_init(iface, s->e.name, b.head); if (iface->proto_handler && iface->proto_handler->config_params) uci_to_blob(&b, s, iface->proto_handler->config_params); diff --git a/interface.c b/interface.c index 698fedb..18322d7 100644 --- a/interface.c +++ b/interface.c @@ -538,7 +538,7 @@ void interface_set_proto_state(struct interface *iface, struct interface_proto_s void interface_init(struct interface *iface, const char *name, - struct blob_attr *config, bool dynamic) + struct blob_attr *config) { struct blob_attr *tb[IFACE_ATTR_MAX]; struct blob_attr *cur; @@ -610,10 +610,12 @@ interface_init(struct interface *iface, const char *name, iface->proto_ip.no_delegation = !blobmsg_get_bool_default(tb[IFACE_ATTR_DELEGATE], true); iface->config_autostart = iface->autostart; - iface->dynamic = dynamic; +} - if (iface->dynamic) - iface->node.version = -1; // Don't delete on reload +void interface_set_dynamic(struct interface *iface) +{ + iface->dynamic = true; + iface->node.version = -1; // Don't delete on reload } static bool __interface_add(struct interface *iface, struct blob_attr *config, bool alias) diff --git a/interface.h b/interface.h index ca5d376..5b04102 100644 --- a/interface.h +++ b/interface.h @@ -146,7 +146,9 @@ extern struct vlist_tree interfaces; extern const struct uci_blob_param_list interface_attr_list; void interface_init(struct interface *iface, const char *name, - struct blob_attr *config, bool dynamic); + struct blob_attr *config); + +void interface_set_dynamic(struct interface *iface); void interface_add(struct interface *iface, struct blob_attr *config); bool interface_add_alias(struct interface *iface, struct blob_attr *config); diff --git a/ubus.c b/ubus.c index 513b40c..cfdfcf3 100644 --- a/ubus.c +++ b/ubus.c @@ -139,7 +139,8 @@ netifd_add_dynamic(struct ubus_context *ctx, struct ubus_object *obj, if (!iface) return UBUS_STATUS_UNKNOWN_ERROR; - interface_init(iface, name, msg, true); + interface_init(iface, name, msg); + interface_set_dynamic(iface); iface->device_config = true; config = blob_memdup(msg); -- 2.25.1