diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-10-18 18:18:24 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-10-18 18:18:24 +0200 |
commit | 39b97d17479a1767fefdf693bb41141260d9740c (patch) | |
tree | 5485a8231ddc0d3379d0f6e0464f31b1d8ff144c /bridge.c | |
parent | f876254b373a883499a3b15733e26c777d6f3665 (diff) |
directly pass the device name to the device create function
Diffstat (limited to 'bridge.c')
-rw-r--r-- | bridge.c | 10 |
1 files changed, 2 insertions, 8 deletions
@@ -41,7 +41,7 @@ static const struct config_param_list bridge_attr_list = { .next = { &device_attr_list }, }; -static struct device *bridge_create(struct blob_attr *attr); +static struct device *bridge_create(const char *name, struct blob_attr *attr); static void bridge_config_init(struct device *dev); static void bridge_free(struct device *dev); static void bridge_dump_info(struct device *dev, struct blob_buf *b); @@ -364,27 +364,21 @@ bridge_apply_settings(struct bridge_state *bst, struct blob_attr **tb) } static struct device * -bridge_create(struct blob_attr *attr) +bridge_create(const char *name, struct blob_attr *attr) { struct blob_attr *tb_dev[__DEV_ATTR_MAX]; struct blob_attr *tb_br[__BRIDGE_ATTR_MAX]; struct bridge_state *bst; struct device *dev = NULL; - const char *name; blobmsg_parse(device_attr_list.params, __DEV_ATTR_MAX, tb_dev, blob_data(attr), blob_len(attr)); blobmsg_parse(bridge_attrs, __BRIDGE_ATTR_MAX, tb_br, blob_data(attr), blob_len(attr)); - if (!tb_dev[DEV_ATTR_NAME]) - return NULL; - if (!tb_br[BRIDGE_ATTR_IFNAME]) return NULL; - name = blobmsg_data(tb_dev[DEV_ATTR_NAME]); - bst = calloc(1, sizeof(*bst)); if (!bst) return NULL; |