Tags and Spec evaluation

Tags and Spec evaluation — top-level API for LABEL and UUID evaluation.

Synopsis

char *              blkid_evaluate_tag                  (const char *token,
                                                         const char *value,
                                                         blkid_cache *cache);
char *              blkid_evaluate_spec                 (const char *spec,
                                                         blkid_cache *cache);

Description

This API provides very simple and portable way how evaluate LABEL and UUID tags. The blkid_evaluate_tag() and blkid_evaluate_spec() work on 2.4 and 2.6 systems and on systems with or without udev. Currently, the libblkid library supports "udev" and "scan" methods. The "udev" method uses udev /dev/disk/by-* symlinks and the "scan" method scans all block devices from the /proc/partitions file. The evaluation could be controlled by the /etc/blkid.conf config file. The default is to try "udev" and then "scan" method.

The blkid_evaluate_tag() also automatically informs udevd when an obsolete /dev/disk/by-* symlink is detected.

If you are not sure how translate LABEL or UUID to the device name use this API.

Details

blkid_evaluate_tag ()

char *              blkid_evaluate_tag                  (const char *token,
                                                         const char *value,
                                                         blkid_cache *cache);

token :

token name (e.g "LABEL" or "UUID") or unparsed tag (e.g. "LABEL=foo")

value :

token data (e.g. "foo")

cache :

pointer to cache (or NULL when you don't want to re-use the cache)

Returns :

allocated string with a device name.

blkid_evaluate_spec ()

char *              blkid_evaluate_spec                 (const char *spec,
                                                         blkid_cache *cache);

All returned paths are canonicalized, device-mapper paths are converted to the /dev/mapper/name format.

spec :

unparsed tag (e.g. "LABEL=foo") or path (e.g. /dev/dm-0)

cache :

pointer to cache (or NULL when you don't want to re-use the cache)

Returns :

allocated string with a device name.