summaryrefslogtreecommitdiff
path: root/lib/blkid/devname.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2003-02-22 17:15:20 -0500
committerTheodore Ts'o <tytso@mit.edu>2003-02-22 17:15:20 -0500
commit79dd234a799434b6dc8365c49e743f00eb09d2fd (patch)
treeda3334d22ef252158be7b0b6be01b8bcd36dd301 /lib/blkid/devname.c
parentf0a22d0fd3ec3f45b562af5afba8811f72b94a28 (diff)
downloade2fsprogs-79dd234a799434b6dc8365c49e743f00eb09d2fd.tar.gz
Internal changes to the blkid library:
1) Only one tag with a particular name can be attached to a device at a time. This significantly simplifies the library, and was needed to allow the cache file to be re-read and changes integrated into the in-core version of the data structure in a simpler fashion than earlier versions of the library. 2) To accomodate this, the ext2/ext3 filesystems are now always tagged as "ext2" type filesystems. Ext3 filesystems are tagged with a SEC_TYPE tag with the value ext3. 3) The new blkid_read_cache() function checks the mod time of the cache file, and if the file has been changed since the last time the cache file was read into memory, it is re-read. This function is now called before probing all of the devices in the system or searching all devices in the cache for a specific tag value. 4) After probing all devices, blkid_flush_cache() is called to write out the cache file. This assures that all of the hard work involved in doing a blkid_probe_all() is saved to disk.
Diffstat (limited to 'lib/blkid/devname.c')
-rw-r--r--lib/blkid/devname.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/blkid/devname.c b/lib/blkid/devname.c
index 7d885515..27a9d0c0 100644
--- a/lib/blkid/devname.c
+++ b/lib/blkid/devname.c
@@ -280,6 +280,7 @@ int blkid_probe_all(blkid_cache cache)
time(0) - cache->bic_time < BLKID_PROBE_INTERVAL)
return 0;
+ blkid_read_cache(cache);
evms_probe_all(cache);
#ifdef VG_DIR
lvm_probe_all(cache);
@@ -340,6 +341,7 @@ int blkid_probe_all(blkid_cache cache)
cache->bic_time = time(0);
cache->bic_flags |= BLKID_BIC_FL_PROBED;
+ blkid_flush_cache(cache);
return 0;
}
@@ -347,6 +349,7 @@ int blkid_probe_all(blkid_cache cache)
int main(int argc, char **argv)
{
blkid_cache cache = NULL;
+ int ret;
blkid_debug_mask = DEBUG_ALL;
if (argc != 1) {
@@ -354,8 +357,9 @@ int main(int argc, char **argv)
"Probe all devices and exit\n", argv[0]);
exit(1);
}
- if ((cache = blkid_new_cache()) == NULL) {
- fprintf(stderr, "%s: error creating cache\n", argv[0]);
+ if ((ret = blkid_get_cache(&cache, "/dev/null")) != 0) {
+ fprintf(stderr, "%s: error creating cache (%d)\n",
+ argv[0], ret);
exit(1);
}
if (blkid_probe_all(cache) < 0)