2 * Copyright (C) 2011 Felix Fietkau <nbd@openwrt.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 2.1
6 * as published by the Free Software Foundation
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
17 #include <libubox/avl.h>
25 void ubus_init_id_tree(struct avl_tree
*tree
);
26 void ubus_init_string_tree(struct avl_tree
*tree
, bool dup
);
27 bool ubus_alloc_id(struct avl_tree
*tree
, struct ubus_id
*id
, uint32_t val
);
29 static inline void ubus_free_id(struct avl_tree
*tree
, struct ubus_id
*id
)
31 avl_delete(tree
, &id
->avl
);
34 static inline struct ubus_id
*ubus_find_id(struct avl_tree
*tree
, uint32_t id
)
38 avl
= avl_find(tree
, &id
);
42 return container_of(avl
, struct ubus_id
, avl
);