| Top |
| struct libmnt_cache * | mnt_new_cache () |
| void | mnt_free_cache () |
| void | mnt_ref_cache () |
| void | mnt_unref_cache () |
| int | mnt_cache_device_has_tag () |
| char * | mnt_cache_find_tag_value () |
| int | mnt_cache_read_tags () |
| int | mnt_cache_set_targets () |
| char * | mnt_get_fstype () |
| char * | mnt_pretty_path () |
| char * | mnt_resolve_path () |
| char * | mnt_resolve_spec () |
| char * | mnt_resolve_tag () |
| char * | mnt_resolve_target () |
The cache is a very simple API for working with tags (LABEL, UUID, ...) and paths. The cache uses libblkid as a backend for TAGs resolution.
All returned paths are always canonicalized.
void
mnt_free_cache (struct libmnt_cache *cache);
Deallocates the cache. This function does not care about reference count. Don't
use this function directly -- it's better to use mnt_unref_cache().
void
mnt_unref_cache (struct libmnt_cache *cache);
De-increments reference counter, on zero the cache is automatically
deallocated by mnt_free_cache().
int mnt_cache_device_has_tag (struct libmnt_cache *cache,const char *devname,const char *token,const char *value);
Look up cache
to check if tag
+value
are associated with devname
.
char * mnt_cache_find_tag_value (struct libmnt_cache *cache,const char *devname,const char *token);
int mnt_cache_read_tags (struct libmnt_cache *cache,const char *devname);
Reads devname
LABEL and UUID to the cache
.
int mnt_cache_set_targets (struct libmnt_cache *cache,struct libmnt_table *mtab);
Add to cache
reference to mtab
. This allows to avoid unnecessary paths
canonicalization in mnt_resolve_target().
char * mnt_get_fstype (const char *devname,int *ambi,struct libmnt_cache *cache);
char * mnt_pretty_path (const char *path,struct libmnt_cache *cache);
Converts path:
to the absolute path
/dev/dm-N to /dev/mapper/name
/dev/loopN to the loop backing filename
empty path (NULL) to 'none'
char * mnt_resolve_path (const char *path,struct libmnt_cache *cache);
Converts path:
to the absolute path
/dev/dm-N to /dev/mapper/name
char * mnt_resolve_tag (const char *token,const char *value,struct libmnt_cache *cache);
char * mnt_resolve_target (const char *path,struct libmnt_cache *cache);
Like mnt_resolve_path(), unless cache
is not NULL and
mnt_cache_set_targets(cache, mtab) was called: if path
is found in the
cached mtab
and the matching entry was provided by the kernel, assume that
path
is already canonicalized. By avoiding a call to realpath(2) on
known mount points, there is a lower risk of stepping on a stale mount
point, which can result in an application freeze. This is also faster in
general, as stat(2) on a mount point is slower than on a regular file.