diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-06-25 00:55:17 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-06-25 00:55:17 +0200 |
commit | 9ec29d3648904002f92b7d2b0732a820e44c5f4b (patch) | |
tree | d185414e574844c92a984191b58002f40da7d113 /utils.h | |
parent | 4a1bfc6ec5033236742967e548bfac9efe851c91 (diff) | |
download | unitd-9ec29d3648904002f92b7d2b0732a820e44c5f4b.tar unitd-9ec29d3648904002f92b7d2b0732a820e44c5f4b.zip |
add netdev ifindex support
Diffstat (limited to 'utils.h')
-rw-r--r-- | utils.h | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -5,27 +5,31 @@ #include <libubox/blob.h> #include <libubox/blobmsg.h> +struct blobmsg_list_node { + struct avl_node avl; + struct blob_attr *data; +}; + +typedef bool (*blobmsg_list_cmp)(struct blobmsg_list_node *l1, struct blobmsg_list_node *l2); + struct blobmsg_list { struct avl_tree avl; int node_offset; int node_len; -}; -struct blobmsg_list_node { - struct avl_node avl; - struct blob_attr *data; + blobmsg_list_cmp cmp; }; #define blobmsg_list_simple_init(list) \ - __blobmsg_list_init(list, 0, sizeof(struct blobmsg_list_node)) + __blobmsg_list_init(list, 0, sizeof(struct blobmsg_list_node), NULL) -#define blobmsg_list_init(list, type, field) \ - __blobmsg_list_init(list, offsetof(type, field), sizeof(type)) +#define blobmsg_list_init(list, type, field, cmp) \ + __blobmsg_list_init(list, offsetof(type, field), sizeof(type), cmp) #define blobmsg_list_for_each(list, element) \ avl_for_each_element(&(list)->avl, element, avl) -void __blobmsg_list_init(struct blobmsg_list *list, int offset, int len); +void __blobmsg_list_init(struct blobmsg_list *list, int offset, int len, blobmsg_list_cmp cmp); int blobmsg_list_fill(struct blobmsg_list *list, void *data, int len, bool array); void blobmsg_list_free(struct blobmsg_list *list); bool blobmsg_list_equal(struct blobmsg_list *l1, struct blobmsg_list *l2); |