When revalidating a partition where there is obsolete information in
/etc/blkid.tab, we end up freeing a the type tag without clearing
dev->bid_type, causing blkid_verify() to loop forever.
Addresses-Debian-Bug: #432052
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Fortunately bid_type isn't used much, and bid_label and bid_uuid is
only used by debugging code, so the impact of this bug was very
minor.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
blkid_dev_has_tag() will immediately return -1 (an error if value is
NULL. Thus at the test later on value cannot be NULL. There are two
possible ways to go about fixing this. The first would be to remove the
first NULL check for value. The second one would be to remove the
second check (and the deadcode).
I chose the second path because the functionality added is something
which a programmer could reasonably expect given the function name, and
it is highly unlikely any existing code is depending on the fact that
blkid_dev_has_tag() will return an error if value is NULL.
Coverity ID: 3: Deadcode
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
If the filesystem has an external journal, store the UUID of the
external journal in the tag EXT_JOURNAL.
If the filesystem type has changed, clear all the tags on the device,
not just a preset list of LABEL, UUID, TYPE, and SEC_TYPE.
Fix a bug so that blkid_set_tag will work correctly when freeing a tag
when the input name parameter comes from the tag that we are freeing.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
for a single device.
Add a new function to the blkid library, blkid_probe_all_new().
Optimize blkid_find_dev_with_tag() so that extraneous device validation are
skipped. (Makes a difference for system with a large number of disks).
consistently when the blkid cache file is explicitly set
to /dev/null. (Addresses Debian Bug #292425)
Also expose blkid_verify() as a public function to the blkid library.
error, then reflect that error upwards; don't try again
(forever). This prevents an infinite loop when /proc and
the /etc/blkid.tab file are not present.
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.
read.c (parse_tag): Do not return that blkid_tag when parsing
the blkid.tag file.
resolve.c (blkid_get_token, blkid_get_tagname_devname): Fold in
code from removed functions
tag.c (blkid_create_tag): Don't return the newly tag strcture
any more, as it's not needed.
(blkid_find_tag_cache, blkid_get_tag_cache,
blkid_token_to_tag, blkid_find_tv_tags): Remove these
functions, as they are either only used once or have
interfaces that should be deprecated.
(blkid_find_tag_dev, blkid_find_head_cache): Replace use
of blkid_tag with one or two const char * type/value
arguments.
(blkid_find_dev_with_tag): Fold in code from removed functions
probe.h, probe.c: Use a more sophisticated set of byte-swapping
routines which are more compact and efficient. Drop
calculation of bid_free, since it's unnecessary. Avoid
save.c (blkid_save_cache): Set the permissions on the blkid
cache file to 644.