Lines Matching full:cache

2  * cache.c - allocation/initialization/free routines for cache
62 static blkid_debug_dump_cache(int mask, blkid_cache cache)
66 if (!cache) {
67 printf("cache: NULL\n");
71 printf("cache: time = %lu\n", cache->bic_time);
72 printf("cache: flags = 0x%08X\n", cache->bic_flags);
74 list_for_each(p, &cache->bic_devs) {
83 blkid_cache cache; in blkid_get_cache() local
95 DBG(DEBUG_CACHE, printf("creating blkid cache (using %s)\n", in blkid_get_cache()
96 filename ? filename : "default cache")); in blkid_get_cache()
98 if (!(cache = (blkid_cache) calloc(1, sizeof(struct blkid_struct_cache)))) in blkid_get_cache()
101 INIT_LIST_HEAD(&cache->bic_devs); in blkid_get_cache()
102 INIT_LIST_HEAD(&cache->bic_tags); in blkid_get_cache()
110 cache->bic_filename = blkid_strdup(filename); in blkid_get_cache()
112 blkid_read_cache(cache); in blkid_get_cache()
114 *ret_cache = cache; in blkid_get_cache()
118 void blkid_put_cache(blkid_cache cache) in blkid_put_cache() argument
120 if (!cache) in blkid_put_cache()
123 (void) blkid_flush_cache(cache); in blkid_put_cache()
125 DBG(DEBUG_CACHE, printf("freeing cache struct\n")); in blkid_put_cache()
127 /* DBG(DEBUG_CACHE, blkid_debug_dump_cache(cache)); */ in blkid_put_cache()
129 while (!list_empty(&cache->bic_devs)) { in blkid_put_cache()
130 blkid_dev dev = list_entry(cache->bic_devs.next, in blkid_put_cache()
136 while (!list_empty(&cache->bic_tags)) { in blkid_put_cache()
137 blkid_tag tag = list_entry(cache->bic_tags.next, in blkid_put_cache()
152 free(cache->bic_filename); in blkid_put_cache()
154 free(cache); in blkid_put_cache()
157 void blkid_gc_cache(blkid_cache cache) in blkid_gc_cache() argument
162 if (!cache) in blkid_gc_cache()
165 list_for_each_safe(p, pnext, &cache->bic_devs) { in blkid_gc_cache()
171 cache->bic_flags |= BLKID_BIC_FL_CHANGED; in blkid_gc_cache()
183 blkid_cache cache = NULL; in main() local
192 if ((ret = blkid_get_cache(&cache, argv[1])) < 0) { in main()
193 fprintf(stderr, "error %d parsing cache file %s\n", ret, in main()
197 if ((ret = blkid_get_cache(&cache, "/dev/null")) != 0) { in main()
198 fprintf(stderr, "%s: error creating cache (%d)\n", in main()
202 if ((ret = blkid_probe_all(cache) < 0)) in main()
205 blkid_put_cache(cache); in main()