Lines Matching full:cache
2 * cache.c - allocation/initialization/free routines for cache
59 static blkid_debug_dump_cache(int mask, blkid_cache cache)
63 if (!cache) {
64 printf("cache: NULL\n");
68 printf("cache: time = %lu\n", cache->bic_time);
69 printf("cache: flags = 0x%08X\n", cache->bic_flags);
71 list_for_each(p, &cache->bic_devs) {
80 blkid_cache cache;
92 DBG(DEBUG_CACHE, printf("creating blkid cache (using %s)\n",
93 filename ? filename : "default cache"));
95 if (!(cache = (blkid_cache) calloc(1, sizeof(struct blkid_struct_cache))))
98 INIT_LIST_HEAD(&cache->bic_devs);
99 INIT_LIST_HEAD(&cache->bic_tags);
107 cache->bic_filename = blkid_strdup(filename);
109 blkid_read_cache(cache);
111 *ret_cache = cache;
115 void blkid_put_cache(blkid_cache cache)
117 if (!cache)
120 (void) blkid_flush_cache(cache);
122 DBG(DEBUG_CACHE, printf("freeing cache struct\n"));
124 /* DBG(DEBUG_CACHE, blkid_debug_dump_cache(cache)); */
126 while (!list_empty(&cache->bic_devs)) {
127 blkid_dev dev = list_entry(cache->bic_devs.next,
133 while (!list_empty(&cache->bic_tags)) {
134 blkid_tag tag = list_entry(cache->bic_tags.next,
149 if (cache->bic_filename)
150 free(cache->bic_filename);
152 free(cache);
155 void blkid_gc_cache(blkid_cache cache)
160 if (!cache)
163 list_for_each(p, &cache->bic_devs) {
171 cache->bic_flags |= BLKID_BIC_FL_CHANGED;
183 blkid_cache cache = NULL;
192 if ((ret = blkid_get_cache(&cache, argv[1])) < 0) {
193 fprintf(stderr, "error %d parsing cache file %s\n", ret,
197 if ((ret = blkid_get_cache(&cache, "/dev/null")) != 0) {
198 fprintf(stderr, "%s: error creating cache (%d)\n",
202 if ((ret = blkid_probe_all(cache) < 0))
205 blkid_put_cache(cache);