Home | History | Annotate | Download | only in blkid

Lines Matching full:cache

2  * read.c - read the blkid cache from disk, to avoid scanning all devices
131 * Start parsing a new line from the cache.
183 static int parse_dev(blkid_cache cache, blkid_dev *dev, char **cp)
227 if (!(*dev = blkid_get_dev(cache, name, BLKID_DEV_CREATE))) {
303 static int parse_tag(blkid_cache cache, blkid_dev dev, char **cp)
309 if (!cache || !dev)
334 * Add the new device to the cache struct, if one was read.
343 static int blkid_parse_line(blkid_cache cache, blkid_dev *dev_p, char *cp)
348 if (!cache || !dev_p)
355 if ((ret = parse_dev(cache, dev_p, &cp)) <= 0)
360 while ((ret = parse_tag(cache, dev, &cp)) > 0) {
377 * a newly allocated cache struct. If the file doesn't exist, return a
378 * new empty cache struct.
380 void blkid_read_cache(blkid_cache cache)
387 if (!cache)
392 * struct so that the cache can be populated.
394 if ((fd = open(cache->bic_filename, O_RDONLY)) < 0)
398 if ((st.st_mtime == cache->bic_ftime) ||
399 (cache->bic_flags & BLKID_BIC_FL_CHANGED)) {
401 cache->bic_filename));
405 DBG(DEBUG_CACHE, printf("reading cache file %s\n",
406 cache->bic_filename));
427 if (blkid_parse_line(cache, &dev, buf) < 0) {
436 * Initially we do not need to write out the cache file.
438 cache->bic_flags &= ~BLKID_BIC_FL_CHANGED;
439 cache->bic_ftime = st.st_mtime;
476 blkid_cache cache = NULL;
482 "Test parsing of the cache (filename)\n", argv[0]);
485 if ((ret = blkid_get_cache(&cache, argv[1])) < 0)
486 fprintf(stderr, "error %d reading cache file %s\n", ret,
489 blkid_put_cache(cache);