summaryrefslogtreecommitdiffstats
path: root/src/device.c
blob: a773036fc00f9d49b2038b25b1063aac6abd8968 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "device.h"
#include "util.h"

#include <libubox/avl-cmp.h>

AVL_TREE(device_types, avl_strcmp, false, NULL);

void register_device_type(const char *name, device_type_t *device_type) {
	NODE_NAME(device_type) = (char *)name;
	avl_insert(&device_types, &device_type->node);
}

const device_type_t * get_device_type(const char *name) {
	return avl_find_element(&device_types, name, (device_type_t *)NULL, node);
}