Lines Matching defs:_cache
54 } _cache;
56 #define _alloc(x) dm_pool_zalloc(_cache.mem, (x))
57 #define _free(x) dm_pool_free(_cache.mem, (x))
58 #define _strdup(x) dm_pool_strdup(_cache.mem, (x))
147 if (_cache.preferred_names_matcher)
168 if (_cache.preferred_names_matcher) {
169 m0 = dm_regex_match(_cache.preferred_names_matcher, path0);
170 m1 = dm_regex_match(_cache.preferred_names_matcher, path1);
258 if (!(sl->str = dm_pool_strdup(_cache.mem, path)))
290 if (dm_hash_lookup(_cache.names, path))
297 if (!(dev = (struct device *) btree_lookup(_cache.devices,
306 if (!(btree_insert(_cache.devices, (uint32_t) d, dev))) {
318 if (!dm_hash_insert(_cache.names, path, dev)) {
466 if (_cache.has_scanned && !dev_scan)
469 dm_list_iterate_items(dl, &_cache.dirs)
472 dm_list_iterate_items(dl, &_cache.files)
475 _cache.has_scanned = 1;
481 return _cache.has_scanned;
487 _cache.has_scanned = 1;
501 _cache.preferred_names_matcher = NULL;
536 if (!(_cache.preferred_names_matcher =
537 dm_regex_create(_cache.mem,(const char **) regex, count))) {
552 _cache.names = NULL;
553 _cache.has_scanned = 0;
555 if (!(_cache.mem = dm_pool_create("dev_cache", 10 * 1024)))
558 if (!(_cache.names = dm_hash_create(128))) {
559 dm_pool_destroy(_cache.mem);
560 _cache.mem = 0;
564 if (!(_cache.devices = btree_create(_cache.mem))) {
569 dm_list_init(&_cache.dirs);
570 dm_list_init(&_cache.files);
590 dm_hash_iter(_cache.names, (dm_hash_iterate_fn) _check_closed);
595 if (_cache.names)
598 if (_cache.preferred_names_matcher)
599 _cache.preferred_names_matcher = NULL;
601 if (_cache.mem) {
602 dm_pool_destroy(_cache.mem);
603 _cache.mem = NULL;
606 if (_cache.names) {
607 dm_hash_destroy(_cache.names);
608 _cache.names = NULL;
611 _cache.devices = NULL;
612 _cache.has_scanned = 0;
613 dm_list_init(&_cache.dirs);
614 dm_list_init(&_cache.files);
639 dm_list_add(&_cache.dirs, &dl->list);
665 dm_list_add(&_cache.files, &dl->list);
701 dm_hash_remove(_cache.names, name);
725 struct device *d = (struct device *) dm_hash_lookup(_cache.names, name);
732 dm_hash_remove(_cache.names, name);
738 d = (struct device *) dm_hash_lookup(_cache.names, name);
741 d = (struct device *) dm_hash_lookup(_cache.names, name);
765 di->current = btree_first(_cache.devices);