}
/* note that the @key could be tha same pointer as @value */
-static int mnt_cache_add_entry(struct libmnt_cache *cache, char *key,
+static int cache_add_entry(struct libmnt_cache *cache, char *key,
char *value, int flag)
{
struct mnt_cache_entry *e;
}
/* add tag to the cache, @devname has to be allocated string */
-static int mnt_cache_add_tag(struct libmnt_cache *cache, const char *tagname,
+static int cache_add_tag(struct libmnt_cache *cache, const char *tagname,
const char *tagval, char *devname, int flag)
{
size_t tksz, vlsz;
memcpy(key, tagname, tksz + 1); /* include '\0' */
memcpy(key + tksz + 1, tagval, vlsz + 1);
- rc = mnt_cache_add_entry(cache, key, devname, flag | MNT_CACHE_ISTAG);
+ rc = cache_add_entry(cache, key, devname, flag | MNT_CACHE_ISTAG);
if (!rc)
return 0;
/*
* Returns cached canonicalized path or NULL.
*/
-static const char *mnt_cache_find_path(struct libmnt_cache *cache, const char *path)
+static const char *cache_find_path(struct libmnt_cache *cache, const char *path)
{
int i;
/*
* Returns cached path or NULL.
*/
-static const char *mnt_cache_find_tag(struct libmnt_cache *cache,
+static const char *cache_find_tag(struct libmnt_cache *cache,
const char *token, const char *value)
{
int i;
/*
* returns (in @res) blkid prober, the @cache argument is optional
*/
-static int mnt_cache_get_probe(struct libmnt_cache *cache, const char *devname,
+static int cache_get_probe(struct libmnt_cache *cache, const char *devname,
blkid_probe *res)
{
blkid_probe pr = cache ? cache->pr : NULL;
return 0;
}
- rc = mnt_cache_get_probe(cache, devname, NULL);
+ rc = cache_get_probe(cache, devname, NULL);
if (rc)
return rc;
if (blkid_probe_lookup_value(cache->pr, tags[i], &data, NULL))
continue;
- if (mnt_cache_find_tag(cache, tags[i], data))
+ if (cache_find_tag(cache, tags[i], data))
continue; /* already cached */
dev = strdup(devname);
if (!dev)
goto error;
- if (mnt_cache_add_tag(cache, tags[i], data, dev,
+ if (cache_add_tag(cache, tags[i], data, dev,
MNT_CACHE_TAGREAD)) {
free(dev);
goto error;
int mnt_cache_device_has_tag(struct libmnt_cache *cache, const char *devname,
const char *token, const char *value)
{
- const char *path = mnt_cache_find_tag(cache, token, value);
+ const char *path = cache_find_tag(cache, token, value);
if (path && strcmp(path, devname) == 0)
return 1;
if (cache)
return mnt_cache_find_tag_value(cache, devname, "TYPE");
- if (mnt_cache_get_probe(NULL, devname, &pr))
+ if (cache_get_probe(NULL, devname, &pr))
return NULL;
blkid_probe_enable_superblocks(pr, 1);
if (!path)
return NULL;
if (cache)
- p = (char *) mnt_cache_find_path(cache, path);
+ p = (char *) cache_find_path(cache, path);
if (!p) {
p = canonicalize_path(path);
if (!key || !value)
goto error;
- if (mnt_cache_add_entry(cache, key, value,
+ if (cache_add_entry(cache, key, value,
MNT_CACHE_ISPATH))
goto error;
}
return NULL;
if (cache)
- p = (char *) mnt_cache_find_tag(cache, token, value);
+ p = (char *) cache_find_tag(cache, token, value);
if (!p) {
/* returns newly allocated string */
p = blkid_evaluate_tag(token, value, cache ? &cache->bc : NULL);
if (p && cache &&
- mnt_cache_add_tag(cache, token, value, p, 0))
+ cache_add_tag(cache, token, value, p, 0))
goto error;
}
const char *cn = NULL;
if (!blkid_parse_tag_string(line, &tag, &val)) {
- cn = mnt_cache_find_tag(cache, tag, val);
+ cn = cache_find_tag(cache, tag, val);
free(tag);
free(val);