}
The cache parameter is optional; if it is NULL, then the blkid library
-will load the default blkid.tab cache file, and the release the cache
+will load the default blkid.tab cache file, and then release the cache
before function call returns. The return value is an allocated string
which holds the resulting device name (if it is found). If the value
is NULL, then attribute_name is parsed as if it were
"LABEL", and value of "root", if that is more convenient.
Another common usage is to retrieve the value of a specific attribute
-for a particular device. This can be used to used to determine the
-filesystem type, or label, or uuid for a particular device:
+for a particular device. This can be used to determine the filesystem
+type, or label, or uuid for a particular device:
if ((value = blkid_get_tag_value(cache, attribute_name, devname))) {
/* do something with value */
string_free(value);
}
-If a program need to call multiple blkid functions, then passing in a
+If a program needs to call multiple blkid functions, then passing in a
cache value of NULL is not recommended, since the /etc/blkid.tab file
-will be repeatedly parsed over and over again, with a memory allocated
+will be repeatedly parsed over and over again, with memory allocated
and deallocated. To initialize the blkid cache, blkid_get_cache()
function is used:
filename of the blkid cache file (where the default is
/etc/blkid.tab). Normally, programs should just pass in NULL.
-If you have called blkid_get_cache(), you need to clean up by saving
-the cache (assuming you have write access to the cache, this happens
-automatically if you didn't load it directly), and freeing it (this
-will also free all associated devices/tags):
-
- blkid_put_cache(cache);
+If you have called blkid_get_cache(), you should call blkid_put_cache()
+when you are done using the blkid library functions. This will save the
+cache to the blkid.tab file, if you have write access to the file. It
+will also free all associated devices and tags:
+ blkid_put_cache(cache);