This patch fixes the blkid.8.in description of the "-l" option. The man
page gives the impression that the first match is the one that is returned.
However, the blkid_find_dev_with_tag() function returns the device with
the highest priority (which is good, because that is what people really want).
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
all lib/blkid/tst* files to be removed with "make clean", in particular
tst_types.c. That was causing a failure of "make check" in an RPM source
tree. Fix is to explicitly list the test binaries, as lib/ext2fs/Makefile.in
does.
As "make check" was only calling test_probe and tst_types (and none
of the other tst_* tests) it was not clear what was going on, and an
"hg update" would always return the old tst_types.c file back so the
problem was only being seen intermittently... It isn't clear whether
you want the other tst_* programs to be run as part of "make check".
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
SPARCs do not like unaligned halfword access and throw SIGBUS.
Read data "manually" instead.
Tested on Solaris 8/SPARC with gcc 2.95.3.
Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Try DIOCGMEDIASIZE ioctl() if defined, to obtain
the media size on FreeBSD 5.0 and newer.
The binary search fallback doesn't work, as FreeBSD
block devices are unbuffered and refuse reads below
the block size.
Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
This caused FTBFS bugs on AMD64 platforms, since it uses a different
64-bit type when compared with IA64, so we need to make our
autoconfiguration system more intelligent.
Addresses Debian Bugs: #360661, #360317
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Make the libdevmapper fail quietly if blkid is called without root
privileges or the kernel does not include device mapper support.
(What is the device mapper _library_ doing writing to stderr, anyway?)
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Users have reported problems on newly installed systems when the
Macintosh's system clock battery is dead and the hardware clock is
returning a date of 1904. Turns out there were some bugs in handling
dates before the Unix epoch.
Addresses Red Hat Bug: #182188
probe.c (blkid_verify): Fix the bid_time sanity checking logic,
so that if last verification time is more recent than the
current time, or the comparison between the last
verification time and the current time causes an overflow,
a device verification will take place.
devname.c (blkid_get_dev): Set the initial bid_time to be
INT_MIN, to guarantee that blkid_verify will always be run
even when the system clock is insane.
dev.c (blkid_debug_dump_dev), read.c (debug_dump_dev),
save.c (save_dev): Fix the printf format for dev->bid_time
to match the fact that it is an signed type.
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>
On systems where is multi-path storage device is problem with duplicated
filesystems. The solution is select "the best" device. This is possible
by device-mapper library.
Short quotation from RH bugzilla:
With my patch, all dm devices remains in libblkid cache.
Only the top level dm devices are given high priority
and more appropriate node names (i.e. /dev/mapper/*) are used.
For example, if we have linear mapped dm device "ov1" over
dm device "disk1p3" which is multipath mapped to /dev/sdd3 and /dev/sdh3:
# dmsetup.static ls --tree
ov1 (253:5) <-- /dev/mapper/ov1 or /dev/dm-5
`-disk1p3 (253:4) <-- /dev/mapper/disk1p3 or /dev/dm-4
`-disk1 (253:0)
|- (8:112) <-- /dev/sdh
`- (8:48) <-- /dev/sdd
Original version of blkid will show:
# ./orig/blkid -t LABEL=mpdisk1p3 -l
/dev/sdd3: LABEL="mpdisk1p3" ... TYPE="ext3"
With my patch, blkid will show:
# ./deptree/blkid -t LABEL=mpdisk1p3 -l
/dev/mapper/ov1: LABEL="mpdisk1p3" ... TYPE="ext3"
In blkid cache, all devices are listed:
# ./orig/blkid -t LABEL=mpdisk1p3
/dev/sdd3: LABEL="mpdisk1p3" ... TYPE="ext3"
/dev/sdh3: LABEL="mpdisk1p3" ... TYPE="ext3"
/dev/dm-4: LABEL="mpdisk1p3" ... TYPE="ext3"
/dev/dm-5: LABEL="mpdisk1p3" ... TYPE="ext3"
# ./deptree/blkid -t LABEL=mpdisk1p3
/dev/mapper/ov1: LABEL="mpdisk1p3" ... TYPE="ext3"
/dev/sdd3: LABEL="mpdisk1p3" ... TYPE="ext3"
/dev/sdh3: LABEL="mpdisk1p3" ... TYPE="ext3"
/dev/dm-4: LABEL="mpdisk1p3" ... TYPE="ext3"
For more details see discussion on:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=156324
Addresses Red Hat Bug: #156324
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Add a dependency to make sure that the subdirectories are created before
creating all of the object files.
Addresses Sourceforge Bug: #1261553
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Change superblock and generic i/o functions to be more generic. Clean
up interface to the probe function. Fix memory leak.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
The current libblkid code expects that there's magic string in FAT super
block (like "FAT12", "FAT16", ...). It's very often right, but valid FAT
super block may be without magic string too :-(
The patch from attachment fix this problem. It's inspired by HAL and
Linux kernel.
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
There's mistake in blkid ext2 detection code. The libblkid doesn't
check for journal when revalidate the cache information about an ext2
device.
# rm -f /etc/blkid.tab
# mkfs.ext2 /dev/loop0 &> /dev/null
# blkid -s TYPE /dev/loop0
/dev/loop0: TYPE="ext2"
# mkfs.ext3 /dev/loop0 &> /dev/null
# blkid -s TYPE /dev/loop0
/dev/loop0: TYPE="ext2"
That bug doesn't appear when libblkid creates new cache and checks for
all possible filesystems, because it tries ext3 before ext2. BUT when
the library only revalidate the cache it first probes for old cached
filesystem (e.g. ext2).
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
target is a regular file, instead of doing binary searching. It also
fixes a couple of cases where a file descriptor is leaked in the
ext2fs_getsize() routine on error.
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
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).
environment variables if the libraries are called from setuid or setguid
programs, or if kernel believes that the process is not eligible to create
a core dump. In addition, if the libc has __secure_getenv(), use it so that
the libc can also do any additional limitations regarding when libraries can
trust environment variables (i.e., to integrate with systems like SELinux
and Posix capabilities).