Lines Matching refs:cache

2  * cache.c - allocation/initialization/free routines for cache
64 static blkid_debug_dump_cache(int mask, blkid_cache cache)
68 if (!cache) {
69 printf("cache: NULL\n");
73 printf("cache: time = %lu\n", cache->bic_time);
74 printf("cache: flags = 0x%08X\n", cache->bic_flags);
76 list_for_each(p, &cache->bic_devs) {
85 blkid_cache cache;
97 DBG(DEBUG_CACHE, printf("creating blkid cache (using %s)\n",
98 filename ? filename : "default cache"));
100 if (!(cache = (blkid_cache) calloc(1, sizeof(struct blkid_struct_cache))))
103 INIT_LIST_HEAD(&cache->bic_devs);
104 INIT_LIST_HEAD(&cache->bic_tags);
112 cache->bic_filename = blkid_strdup(filename);
114 blkid_read_cache(cache);
116 *ret_cache = cache;
120 void blkid_put_cache(blkid_cache cache)
122 if (!cache)
125 (void) blkid_flush_cache(cache);
127 DBG(DEBUG_CACHE, printf("freeing cache struct\n"));
129 /* DBG(DEBUG_CACHE, blkid_debug_dump_cache(cache)); */
131 while (!list_empty(&cache->bic_devs)) {
132 blkid_dev dev = list_entry(cache->bic_devs.next,
138 while (!list_empty(&cache->bic_tags)) {
139 blkid_tag tag = list_entry(cache->bic_tags.next,
154 free(cache->bic_filename);
156 free(cache);
159 void blkid_gc_cache(blkid_cache cache)
164 if (!cache)
167 list_for_each_safe(p, pnext, &cache->bic_devs) {
175 cache->bic_flags |= BLKID_BIC_FL_CHANGED;
187 blkid_cache cache = NULL;
196 if ((ret = blkid_get_cache(&cache, argv[1])) < 0) {
197 fprintf(stderr, "error %d parsing cache file %s\n", ret,
201 if ((ret = blkid_get_cache(&cache, "/dev/null")) != 0) {
202 fprintf(stderr, "%s: error creating cache (%d)\n",
206 if ((ret = blkid_probe_all(cache) < 0))
209 blkid_put_cache(cache);