From 9ec29d3648904002f92b7d2b0732a820e44c5f4b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 25 Jun 2012 00:55:17 +0200 Subject: add netdev ifindex support --- utils.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'utils.h') diff --git a/utils.h b/utils.h index e20169a..360f9f1 100644 --- a/utils.h +++ b/utils.h @@ -5,27 +5,31 @@ #include #include +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); -- cgit v1.2.3