Commit Graph

281 Commits (205593f65b2f78c2cc8116a7827c241ebc8387fc)

Author SHA1 Message Date
Theodore Ts'o b697f9d01c blkid: Make sure a device returned by blkid_find_dev_with_tag exists
There could be stale entries in blkid file, so if the device does not
exist, skip it.

Addresses-Debian-Bug: #487758, #487783

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-06-28 22:17:43 -04:00
Eric Sandeen 772b89d342 blkid: use list_for_each_safe in garbage collection
We need to use list_for_each_safe in case a device gets removed from
the list during garbage collection.

Also make the manpage slightly more informative about
what the -g garbage collection option does.

Addresses-Debian-Bug: #487758, #487783

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-06-28 22:17:20 -04:00
Theodore Ts'o 8d45e2104c blkid: Fix cc portability problem in probe_lvm2()
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-06-21 14:04:36 -04:00
Eric Sandeen 7f6a74b6d6 blkid: fix swap tests (again)
Some architectures (ppc ...) need a bigger swapfile than is shipped,
in the test image so the current re-make of swap was failing.

We could either ship a bigger image or just dd a bigger file...

There is one more minor problem with the tests; older mkswap does not
support the -U uuid specification.  I'm not sure offhand what to do
about that problem, or if it really needs fixing.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-06-19 14:30:23 -04:00
Theodore Ts'o 71ff129e9f Merge branch 'maint'
Conflicts:

	README
	resize/online.c
	version.h
2008-06-17 23:54:51 -04:00
Theodore Ts'o cc19b95860 libblkid: Fix marginal C code in probe_lvm2()
Modern gcc accepted what was there previously, but it's clearly not
correct C code, and this may have been the explanation for why a user
trying to compile a recent version of e2fsprogs failed to do so on Red
Hat 7.3.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-06-17 13:03:47 -04:00
Theodore Ts'o 8aa53bfa69 Merge branch 'maint' into next 2008-06-02 21:40:02 -04:00
Ricardo M. Correia c9bad3ce1a Add ZFS detection to libblkid
This patch adds ZFS filesystem detection to libblkid.

It probes for VDEV_BOOT_MAGIC in the first 2 ZFS labels in big-endian
and little-endian formats.
Unfortunately the probe table doesn't support probing from the end of
the device, otherwise we could also probe in the 3rd and 4th labels (in
case the first 2 labels were accidentally overwritten)..

Eventually we would set the UUID from the ZFS pool GUID and the LABEL tag
from the pool name, but that requires parsing an XDR encoding of the pool
configuration which is not trivial.

Signed-off-by: Ricardo M. Correia <Ricardo.M.Correia@Sun.COM>
Signed-off-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-06-02 21:09:08 -04:00
Theodore Ts'o 168b6b53be Remove bashism in test script for libblkid
Thanks to Christian Kujau for pointing this out.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-05-25 19:45:29 -04:00
Theodore Ts'o c0af709e52 Merge branch 'maint'
Conflicts:

	README
	version.h
2008-05-21 16:56:42 -04:00
Theodore Ts'o 492ea6556e blkid: If the device mtime is newer that the cache time, force a revalidation
This fixes problems turned up by a test case written by Erez Zadok's
group which constantly reformats filesystems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-05-20 17:28:54 -04:00
Eric Sandeen 22269b8b60 - fix swap sanity tests in blkid, and blkid tests
Swap is actually native-endian on disk, and with the latest
swapspace sanity checks I added we need to have native swapspace
examples in the blkid tests, so re-mkswap them during testing.

One one other required change, though; mkswap requires at least
10 pages of swap, so the image needs to be increased to 10x64k
if mkswap is to succeed...

Maybe it'd be better to just dd it out on the fly?

Addresses-redhat-bugzilla: 445786

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-05-12 16:17:11 -04:00
Theodore Ts'o 4476105bf3 Merge branch 'maint'
Conflicts:

	configure
2008-04-21 21:35:44 -04:00
Theodore Ts'o 8bcaaabb1a blkid: Keep cached filesystem information on EACCES and ENOENT errors
When a nonprivileged user uses the blkid command, we want to keep the
cached filesystem information, and opening a device file could result
in an EACCESS or ENOENT (if an intervening directory is mode 700).  We
were previously testing for EPERM, which was really the wrong error
code to be testing against.

Addresses-Launchpad-Bug: #220275

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-04-21 19:22:49 -04:00
Eric Sandeen 6360d129d0 blkid: more sanity checks for swap v1
mkswap followed by pvcreate on a block device
will still turn up as "swap" in blkid, because
pvcreate isn't particularly careful about zeroing
old signatures.  (neither is mkswap, for that matter).

Testing for appropriate version and page counts
gives us a bit more confidence that we have a
real swap (v1) partition.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-04-18 14:31:27 -04:00
Theodore Ts'o a040a99b6c Merge branch 'maint'
Conflicts:

	lib/ext2fs/ext2_err.et.in
2008-03-13 10:53:26 -04:00
Theodore Ts'o dd232049d1 blkid: Fix portability problem caused by using uint instead of unsigned int
This is needed to fix compilation with DJGPP; thanks to Cristophe
Grenier for pointing this out.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-08 20:01:05 -05:00
Theodore Ts'o a49670e64e Merge branch 'maint'
Conflicts:

	lib/blkid/devname.c
	lib/blkid/probe.c
	misc/mke2fs.c
	misc/tune2fs.c
2008-02-27 18:53:34 -05:00
Theodore Ts'o 3a538e4244 Fix gcc -Wall warnings for lib/blkid/probe.c
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-27 02:06:08 -05:00
Theodore Ts'o 1f1ee19485 libblkid: Add error checking to devicemapper code to avoid segfaults
If a device mapper volume disappears while libblkid code is running,
it is possible for the devicemapper code to return errors, and since
libblkid wasn't checking for error returns, it would dereference a
null pointer and crash.  Add error checking to prevent this.

Addresses-RedHat-Bugzilla: #433857

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-26 22:24:42 -05:00
Eric Sandeen a451d92f38 blkid: detect LVM2 physical volumes
Bits liberally stolen from lvm2 userspace.

Addresses-Red-Hat-Bugzilla: #409321

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-02-19 08:40:15 -05:00
Theodore Ts'o ef80fdc8ad Merge branch 'maint' into next 2008-02-10 08:03:54 -05:00
Theodore Ts'o 5010f295ca Document the BLKID_FILE environment variable in the libblkid man page
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-09 23:35:03 -05:00
Theodore Ts'o a4045c21a3 blkid: Add support for returning labels for UDF filesystems
Addresses-Sourceforge-Bug: #1886394

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-09 23:12:56 -05:00
Theodore Ts'o 838f133c72 blkid: Flush cached filesystem information on any error other than EPERM
USB devices can return ENOMEDIUM, and when the filesystem cached
information wasn't flushed, it resulted in the wrong location of a
filesystem to be returned to the caller.  The only justification for
using cached information when the open fails is in the case of a
permission denied error.

Addresses-Debian-Bug: #463787
2008-02-09 22:30:20 -05:00
Theodore Ts'o cfc1931194 blkid: Automatically chose between ext4 and ext4dev as appropriate
Add logic that on Linux systems will check for the presence of the
ext4dev filesystem; if it isn't present, fall back to ext4 for
filesystems that are marked as being "OK for use on test filesystem
code".  If they are OK for use for in-development filesystem code, it
should also be fine to use stable filesystem code if there is no test
filesystem code (ext4dev) available.

The reverse is not true, of course.  We don't ever want to mount a
production filesystem using test filesystem code unless the user gives
us explicit permission via "tune2fs -E test_fs".

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-09 07:45:21 -05:00
Theodore Ts'o 428f6b32a9 Merge branch 'maint' into next
Conflicts:

	configure
	lib/ext2fs/ext2_fs.h
	misc/e2image.c
2008-01-27 20:09:05 -05:00
Theodore Ts'o c2dbc18a94 Use lseek() instead of llseek() of sizeof(long) == sizeof(long long)
Previously we used a hard-coded test where for the Alpha and the IA64,
we used lseek instead of llseek().  Generalize this to whenver
sizeof(long) is the same as sizeof(long long).

It turns out this fixes a FTBFS problem on the x86_64 for Debian,
since dietlibc doesn't provide llseek() on that architecture.

Addresses-Debian-Bug: #459614

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-01-27 00:35:32 -05:00
Theodore Ts'o 69d742284d blkid: Add support for HFS+ detection
From SLES 10 patch: e2fsprogs-blkid_probe_hfsplus.patch

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-01-27 00:21:07 -05:00
Theodore Ts'o 4dc30dac2c blkid: Make sure the blocksize in reiserfs is sane
This avoids a floating point exception for corrupt reiserfs images

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-01-27 00:14:01 -05:00
Theodore Ts'o 2921332fd8 Teach the blkid library about ext4/ext4dev
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-01-26 22:25:50 -05:00
Pixel c40ad3674c blkid: have ntfs's UUID compatible with vol_id
Ensure the length of the UUID is always the same

without the patch:

% blkid /tmp/a /tmp/b
/tmp/a: UUID="7130E4771519577F" TYPE="ntfs"
/tmp/b: UUID="7E9B4A7CCE99CA" TYPE="ntfs"

with the patch:

% blkid /tmp/a /tmp/b
/tmp/a: UUID="7130E4771519577F" TYPE="ntfs"
/tmp/b: UUID="007E9B4A7CCE99CA" TYPE="ntfs"

ie same as:

% vol_id --uuid /tmp/a ; vol_id --uuid /tmp/b
7130E4771519577F
007E9B4A7CCE99CA

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-01-14 10:22:33 -05:00
Theodore Ts'o fef2b38d8e Merge branch 'maint' into next
Conflicts:

	configure
	debian/rules
	e2fsck/swapfs.c
	lib/ext2fs/ext2_fs.h
2008-01-01 12:41:35 -05:00
Theodore Ts'o 9320c6ffcd Fix build error in blkid/tst_types.c when using diet libc
When compiling with diet libc, <sys/types.h> must be included in order
to define the types used in asm/types.h.  Strange choice, but
workable.  This doesn't cause much problems for e2fsprogs except
blkid/tst_types.h, which needed a #include of <sys/types.h>.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-31 22:35:18 -05:00
Theodore Ts'o b689b8dd14 Merge branch 'maint' into next
Conflicts:

	lib/ext2fs/closefs.c
2007-12-17 10:28:01 -05:00
Theodore Ts'o 20c10a7667 blkid: Avoid division by zero error when probing an invalid FAT filesystem
Addresses-Sourceforge-Bug: #1831627

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-15 22:21:31 -05:00
Theodore Ts'o e6a4571eec Merge branch 'maint' into next
Conflicts:

	lib/ext2fs/closefs.c
2007-12-09 17:03:01 -05:00
Eric Sandeen 38361bbbb5 e2fsprogs: fix blkid whole-disk scanning heuristics
The heuristics in blkid/devname.c probe_all() for scanning whole disks
with no partitions assume that a device name with no digit on the end
will always be present as a delineator, i.e.:

sda
sda1
sdb
sdc

In this case, when sdc is seen, it's the clue to go back and scan sdb.
However, for something like:

sda
sda1
sdb
loop0

this falls down, and sdb is never scanned.
(thanks to Karel Zak for pointing this out).

Addresses-Red-Hat-Bugzilla: #400321

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-02 05:25:30 -05:00
Dmitry V. Levin 7b7370bd2e blkid.pc, ss.pc: Move private libs from "Libs:" to "Libs.private:"
According to pkg-config(1) manual page, private libraries should be
defined by "Libs.private:" line.  Private libraries are libraries which
are not exposed through our library, but are needed in the case of
static linking.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2007-11-01 00:32:32 -04:00
Dmitry V. Levin 3b06802bbb blkid/test_probe.in: Fix temporary files handling
Avoid placing files with predictable names in /tmp.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2007-10-29 10:59:01 -04:00
Theodore Ts'o 042a27f823 Merge branch 'maint' into next 2007-10-15 16:24:56 -04:00
Eric Sandeen f493d4e0ac libblkid: recognize squashfs filesystems on BE systems.
squashfs has no uuid or labels, so all we need is the magic
(for big-endian too!)

Addresses-Red-Hat-Bugzilla: #305151

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
2007-10-15 16:23:39 -04:00
Eric Sandeen 5845efd123 libblkid: detect squashfs
libblkid: recognize squashfs filesystems

squashfs has no uuid or labels, so all we need is the magic.

Addresses-Red-Hat-Bugzilla: #305151

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
2007-10-14 10:11:52 -04:00
Theodore Ts'o 2628a1d3e1 Merge branch 'maint' 2007-10-06 12:41:26 -04:00
Theodore Ts'o 846be6db81 libblkid: Add more magic numbers that might mean there is a FAT filesystem
The FAT filesystem doesn't have its superblock with a set of magic
strings in a fixed location.  Therefore, we must also check for the
FAT filesystem if it looks like we have an MBR at the beginning of the
partition.  We previously checked if the first byte was a jump
instruction but that missed some USB disks with only one bootable
partition.  Now we check for the MBR signature (0x55AA at offset 510)
as well as any partition where byte 0 is \351 or \353.

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-23 09:50:11 -04:00
Theodore Ts'o a98b51e9dd Miscellaneous Cleanups
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: Girish Shilamkar <girish@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-03 20:10:46 -04:00
Theodore Ts'o d4e0b1c6f5 Fix gcc -Wall warnings
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-03 18:56:01 -04:00
Theodore Ts'o 0225face1b Add debugging printf to blkid's probe routine when original fs type failed
This particular bit of code has caused problems before, so make it
easier to debug problems caused by the probe verification looping
forever here.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-08 20:17:31 -04:00
Theodore Ts'o 424a3e4a23 Remove Changelog files since they're not used after the git migration
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-08 08:50:41 -04:00
Theodore Ts'o ac7dd696d6 Fix bug which could cause libblkid to loop forever
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>
2007-07-08 08:50:41 -04:00
Theodore Ts'o d7b64725ee Update Release Notes, Changelogs, version.h, etc. for 1.40 release
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-06-24 17:32:47 -04:00
Theodore Ts'o 30dd262235 Fix divide by zero error in blkid's NTFS probing logic
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-06-24 17:17:24 -04:00
Karsten Hopp e382a7eade Add support for LUKS encrypted partitions
This patch adds support for cryptsetup-luks (http://luks.endorphin.org)
UUIDs to libblkid.  This is required p.e. to avoid hardcoding device
names for encrypted partitions.  Could you please take a look at it and
consider inclusion in the next e2fsprogs release ?

Signed-off-by: Karsten Hopp <karsten@redhat.com>
2007-06-21 13:43:33 -04:00
Theodore Ts'o cb0c5d701a Add more paranoid NTFS probing and fetch UUID and LABEL information
Hopefully this addresses false positives by the blkid library when
detecting NTFS partitions.

Addresses Launchpad Bug: #110138

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-06-19 03:29:47 -04:00
Andreas Dilger de8f3a7621 Fix gcc -Wall warnings, especially on 64-bit systems
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-05-25 11:18:11 -04:00
Theodore Ts'o 6fb57a92d1 libblkid: Fix bug which could cuase bid_type to be corrupted
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>
2007-05-18 21:44:29 -04:00
Theodore Ts'o 7292355283 Add new function blkid_gc_cache()
New function which performs a garbage collection pass on the
/etc/blkid.tab file.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-05-18 00:02:35 -04:00
Sergey Vlasov c9105ffbe5 blkid: Report correct UUID from MD superblocks
The second part of UUID was copied to a wrong place in the buffer.
Now the UUID shown by blkid is the same as shown by /lib/udev/vol_id
(at least with udev-108), but is not in the same form as used by mdadm
(which prints UUID as 4 32-bit words and uses different endiannes).

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2007-04-10 12:00:38 -04:00
Sergey Vlasov 6b8be16e3a blkid: Fix MD 0.90 superblock detection on little endian systems
MD 0.90 superblock format is host endian - need to check for bith big
endian and little endian magic.  Without this change MD components
created on little endian systems were not detected as such, which
could then lead to false positives when detecting filesystems.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2007-04-10 11:59:46 -04:00
Brian Behlendorf e0a700d45d [COVERITY] Fix (error case) memory leak in blkid library (parse_dev)
Coverity ID: 29: Resource Leak

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-23 22:55:59 -04:00
Theodore Ts'o 5f7fe7fe0e [VALGRIND] Fix memory leak in libblkid (blkid_get_devname)
Nyah, nyah, Coverity didn't find this one.  :-)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-21 17:15:36 -04:00
Theodore Ts'o d90be5b143 [COVERITY] Allow blkid_dev_has_tag to check if a tag exists when value==NULL
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>
2007-03-18 11:21:44 -04:00
Theodore Ts'o 257ace82b7 Fix memory leak in blkid library
Addresses Debian Bug: #413661

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-06 19:56:18 -05:00
Theodore Ts'o 5b984ab51f blkid_devno_to_devname(): Avoid recursive loops due to symlinks in /dev
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-09-24 22:33:38 -04:00
Karel Zak 633f453db1 Fix blkid bug with correctly reporting FAT filesystem labels that are empty
Signed-off-by: Karel Zak <kzak@redhat.com>
2006-09-17 21:23:46 -04:00
Karel Zak b5517ca667 Add GFS/GFS2 support to the blkid library.
Signed-off-by: Karel Zak <kzak@redhat.com>
2006-09-17 21:10:58 -04:00
Theodore Ts'o a02fa9beb8 Fix bug in device mapper scanning; probe_one() doesn't want a leading /dev
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-09-12 01:30:53 -04:00
Andreas Dilger f776a2354d blkid.8.in: Fix description of the -l option to be more accurate
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>
2006-08-19 21:12:15 -04:00
Andreas Dilger cc6d1a9ef7 This patch fixes up an error in the lib/blkid/Makefile.in which was causing
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>
2006-08-19 20:05:28 -04:00
Andreas Dilger 9a519c0284 fix comment for blkid_get_dev_size()
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
2006-06-21 00:04:08 -04:00
Matthias Andree aadac9b7bb Add parentheses and casts to make GCC happy.
Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
2006-05-30 16:29:49 +02:00
Matthias Andree 94fa1108ee Fix SIGBUS through unaligned access to FAT superblocks.
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>
2006-05-30 15:47:12 +02:00
Matthias Andree 0ac93a00c9 Change more "echo -n" to "printf" to avoid screen clutter.
Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
2006-05-30 15:47:05 +02:00
Matthias Andree bdc3514af4 Switch endian detection from Linuxism to AC_C_BIGENDIAN.
This fixes all blkid test failures on FreeBSD 4.11 i386.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
2006-05-30 14:42:47 +02:00
Matthias Andree a0dfc6ea8c Revise DIOCGDINFO (sys/disklabel.h) related FreeBSD comment.
Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
2006-05-30 05:08:02 +02:00
Matthias Andree 5beaabb0f8 Enable sys/disklabel.h and DIOCGDINFO based getsize code.
Tested on FreeBSD 4.11-RELEASE i386.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
2006-05-30 04:26:13 +02:00
Matthias Andree 12a829dcdc Add a bunch of type fixes for debug/"make check" code paths.
Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
2006-05-30 01:48:51 +02:00
Matthias Andree 21261a0ea2 Cast time_t variable to long for fprintf to match %ld.
Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
2006-05-30 01:20:46 +02:00
Matthias Andree 66352fe200 Drop unused vector uuid[].
Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
2006-05-30 01:20:17 +02:00
Matthias Andree f72b8ff098 Implement DIOCGMEDIASIZE for FreeBSD's GEOM.
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>
2006-05-30 00:54:49 +02:00
Theodore Ts'o 49487b79da Fixed signed vs. unsigned comparison warning in strncmp().
It's better to use memcmp() anyway given the code in question.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-05-14 17:29:00 -04:00
Theodore Ts'o 4ea7ea007b Fix asm_types.h type conflicts
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>
2006-04-09 08:41:55 -04:00
Theodore Ts'o 292811f2aa Fix typo bug in previous commit (6ae1ed49c8c6)
"fd" should have been "probe.fd" so blkid/probe.c can compile without
errors.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-25 01:42:02 -05:00
Theodore Ts'o 2858c94e35 Fix file descriptor leak in blkid library in error paths
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-23 22:14:54 -05:00
Theodore Ts'o f4f425b20b Prevent error messages to stderr caused by libblkid calling libdevmapper
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>
2006-03-19 15:26:26 -05:00
Theodore Ts'o e324b25059 Fix blkid's last verification logic to work when the system clock is insane
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>
2006-03-12 23:25:15 -05:00
Theodore Ts'o ba5e38494e Add EXT_JOURNAL to the blkid tag of ext3 filesystems.
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>
2006-03-10 18:11:35 -05:00
Karel Zak 4db2f59a71 Add device-mapper support to the blkid library
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>
2006-03-08 14:17:28 -05:00
Theodore Ts'o 438961210d Add missing parameter to error printf in blkid test program.
The blkid tag.c's test driver program had  a missing parameter to an 
error message printf.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-29 14:07:45 -05:00
Theodore Ts'o 3ded50b37c Address parallel build problem in the library Makefiles
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>
2005-12-10 22:23:01 -05:00
Theodore Ts'o 2f79e5193f Search the root directory of FAT filesystems for the label information
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-10 21:51:20 -04:00
Theodore Ts'o ca7498596f Generic blkid library cleanup
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>
2005-09-10 21:07:23 -04:00
Theodore Ts'o 1e5630abab Add a regression test suite for the blkid library
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-10 15:55:14 -04:00
Theodore Ts'o 45a3fa8738 Add support to extract basic iso9660 label information to the blkid library
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-10 15:46:57 -04:00
Theodore Ts'o bb626bcd54 Add support for detecting the reiser4 filesystem in the blkid library.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-10 11:48:38 -04:00
Theodore Ts'o 038d2bedaa Improve blkid's VFAT/FAT filesystem probe code
Collapse vfat and fat code and make it more paranoid when probing for
vat/fat filesystems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-07 12:14:53 -04:00
Theodore Ts'o 45d1d889b9 Remove unneeded probe.h header file in lib/blkid/resolve.c
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-07 12:12:21 -04:00
Karel Zak c4c740ff48 Improve VFAT detection to support filesystems w/o a magic string in the superblock
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>
2005-09-06 08:13:35 -04:00
Karel Zak abaa11240a Add support for detecting software suspend partitions to blkid
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-06 06:42:49 -04:00
Karel Zak 05a6edf4fd Fix blkid library so that the cache validation notices ext2 to ext3 conversion
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>
2005-09-06 06:26:45 -04:00
Theodore Ts'o 583d1f8328 Fix false positives from valgrind: prctl(PR_GET_DUMPABLE)
Pass in zero to the unusued arguments of prctl(PR_GET_DUMPABLE) to
avoid false positives from valgrind.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-07-25 11:36:43 -05:00
Andreas Dilger 9b7d811dda This patch adds a check to use fstat or fstat64 in getsize.c if the
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>
2005-07-09 22:06:59 -05:00
Theodore Ts'o 1f965c8d96 Update for e2fsprogs 1.38 release. 2005-06-30 20:06:45 -04:00
Theodore Ts'o 55080a7637 Fix blkid's debugging/TEST_PROGRAM code so that it is sufficiently
standalone that "make check" will compile without errors even  
when configure "--enable-blkid-debug" is not specified.
2005-06-27 13:54:08 -04:00
Theodore Ts'o ed6acfa337 Add a new option to the blkid program, -l, which will more efficiently search
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).
2005-05-07 17:06:27 -04:00
Theodore Ts'o 12b3c8ec1d Fix gcc -Wall nits in the blkid library. 2005-05-07 14:38:10 -04:00
Theodore Ts'o 78c7d0efae Clean up the debugging code in the blkid library so that we don't use
the inline functions DEB_DUMP_* and instead use the private functions 
blkid_debug_dump_*().
2005-05-07 14:22:38 -04:00
Theodore Ts'o c37543df2f Add new two new functions to the blkid library: blkid_dev_set_search(), and
blkid_dev_has_tag(), and change the blkid program to take advantage of these
functions.
2005-05-07 13:32:47 -04:00
Theodore Ts'o 4c4e3f7843 Fix libblkid's magic number recognition for the cramfs filesystem,
and add support to pull out the label for cramfs filesystems.  
Thanks to Karel Zak (kzak at redhat.com) for the patch.
2005-05-05 18:06:04 -04:00
Theodore Ts'o 09f3eba28a Fix typo so that we actually ignore environment variables when gid != egid. 2005-04-16 13:56:03 -04:00
Theodore Ts'o 762c7c6510 Add paranoia checks into the blkid, ext2fs, and ss libraries to ignore
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).
2005-04-06 14:44:16 -04:00
Theodore Ts'o fd4b28efd3 Update for the e2fsprogs 1.37 release. 2005-03-21 22:37:03 -05:00
Theodore Ts'o 65ffef3689 Ignore the BLKID_FILE environment variable if blkid_get_cache() is
called from a setuid program.
2005-03-21 22:13:32 -05:00
Theodore Ts'o b22ea17742 getsize.c (blkid_get_dev_size): Fix compilation problem on
Darwin systems.
2005-03-16 23:38:14 -05:00
Theodore Ts'o 3eee5e9eed Update for release of e2fsprogs 1.36. 2005-02-05 18:26:03 -05:00
Theodore Ts'o b7aa0d653e Remove *.pc files on a "make distclean"
Remove emacs backup files in tests/Makefile on a "make clean"
2005-02-05 15:48:49 -05:00
Theodore Ts'o dbe9c71a17 Use inline instead of __inline__ in the blkid debugging code for
Solaris compatibility.
2005-02-03 22:09:49 -05:00
Theodore Ts'o 18d1296333 blkid.c (main, compare_search_type): Make blkid -t work more
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.
2005-01-27 19:51:47 -05:00
Theodore Ts'o 32923fa402 Add functions which allow an application program to do a run-time query
of the version of the blkid library.
2005-01-26 13:16:06 -05:00
Theodore Ts'o e644186542 Add pkg-config files to e2fsprogs's libraries. 2005-01-26 12:59:25 -05:00
Theodore Ts'o 9d0f46169f probe.c: Windows can perform a "quick format" that doesn't clear
enough of the partition that the blkid probes can get
	confused.  Do the NTFS test first to deal with this
	Windows misfeature.  (Addresses Debian Bug #291990)
2005-01-25 03:26:10 -05:00
Theodore Ts'o 2c92375ea4 Add support to the blkid library to recognize Oracle ASM volumes. 2005-01-21 17:57:56 -05:00
Theodore Ts'o 8800c73835 Makefile.in: Fix the kernel compile-time echo commands to be
consistent and portable
2005-01-19 00:25:25 -05:00
Matthias Andree f892826b8d lib/blkid/getsize.c: Move #include "blkidP.h" before <sys/queues.h>
to avoid a clash with the LIST_HEAD in the latter file that results
in compilation failure.
2005-01-13 04:15:45 +01:00
Matthias Andree d34588265c we're reading unsigned long long, use %llu rather than %lld. 2005-01-12 22:58:33 +01:00
Theodore Ts'o 7369f0ce5f Apply Janos Farkas's patch to support extracting the uuid and label
information from swap partitions.

Also make sure that if a partition has a label removed, that the label is
removed form the blkid cache as well.

Add support for detecting 32k and 64k pagesize swap files.
2005-01-10 23:58:11 -05:00
Theodore Ts'o 2e6a9febb4 Adjust blkid library so that it returns vfat in preference to msdos so
that mount will try to use the vfat filesystem.  (Addresses Debian bug #287455)

Similarly, the blkid library will now return an ext3 type for ext 2/3 
filesystems that have the journal capability set.

We allow files to be probed by the blkid library, to make it easier to
test the library.  However, we also added safety checks to avoid saving
relative pathnames to blkid.tab, and probe_one() will only check block device
files.
2005-01-05 17:45:32 -05:00
Theodore Ts'o 522798d342 Add install-strip and install-shlibs-strip targets
Use Linux-kernel-style makefile output for "make install"

Update intl/Makefile.in to version from gettext 0.14.1
2004-12-15 11:28:55 -05:00
Theodore Ts'o 6d4022786d Use MKINSTALLDIRS macro so that the Makefiles can find the script
correctly.

Update Makefile dependencies.

Update "make depend" production so that it filters out comments
inserted by newer gcc compilers.

Remove sync from e2fsck's "make all" target.
2004-12-14 21:46:26 -05:00
Theodore Ts'o 3838f7df13 Avoid using uint and uchar types when probing for ocfs2 filesystems
in the blkid library, to allow compilation using dietlibc.
2004-11-30 19:05:38 -05:00
Theodore Ts'o 47204ff983 Use Linux-kernel-style makefile output to make it easier to
see errors/warnings.
2004-11-30 10:52:27 -05:00
Theodore Ts'o 2b5901d9c7 Remove the a.out DLL support, since it's been obsolete and unmaintained
for a long time now.
2004-11-19 17:06:47 -05:00
Theodore Ts'o 4b8f81aace probe.c (probe_ocfs): Fix bug where the wrong size for "ocfs1"
was being passed to blkid_set_tag().  Thanks to Andrea
	Dilger for pointing this out.
2004-11-19 14:28:01 -05:00
Theodore Ts'o 414846b126 Add support for ocfs2 detection to the blkid library,
courtesy of manish.singh@oracle.com
2004-09-17 21:37:49 -04:00
Theodore Ts'o 9845cf5dbd Clean up the header file #include's for lib/blkid/getsize.c
and lib/ext2fs/getsize.c

In lib/blkid/getsize.c, include <sys/disk.h> if present since
this is where the DIOCGMEDIASIZE ioctl is defined on FreeBSD.
(Addresses Debian Bug #264630)
2004-09-17 19:07:03 -04:00
Theodore Ts'o 488f3c2dad On non-linux systems, use lseek64() if it is present in
ext2fs_llseek() and blkid_llseek().  (Addresses Debian bug #269044)
2004-09-17 17:47:12 -04:00
Theodore Ts'o 1b510f57f4 read.c (blkid_read_cache): Add missing fclose() which was
causing a memory and file descriptor leak.  Thanks to
	magnus.fromreide at teligent.se.
2004-05-15 17:27:43 -04:00
Theodore Ts'o 7ce0806406 probe.c (blkid_verify_devname): If the time is earlier than the
last modified time of the device, then force a reverify;
	it means the system time may not be trustworthy.
2004-04-19 21:42:18 -04:00
Theodore Ts'o 7a3a386b9e In the blkid library, if the BLKID_FILE environment
variable is set, use it to find the blkid.tab file if the
calling application did not supply a filename.
2004-04-12 07:26:23 -04:00
Theodore Ts'o dd60705665 Refine the build process to avoid re-running subst all the time on
some generated files, by having subst update the modtime on these 
files even when the generated file hasn't changed.  We do this with 
generated files that do not have any downstream dependencies.
2004-04-03 13:53:46 -05:00
Theodore Ts'o 2625803ecf Use C99 stdint.h types instead of custom types in the uuid library. 2004-04-03 10:20:26 -05:00
Theodore Ts'o 1cdb6f7602 Don't close the file descriptor when determining the size.
This bug was introduced in the previous getsize changes, 
and was screwing up the blkid library probe functions.
(Addresses Debian Bug #239191)
2004-03-21 20:16:19 -05:00
Theodore Ts'o 2c5cfbcb99 Only use the BLKGETSIZE64 ioctl on Linux 2.6 since it is
unreliable in Linux 2.4.  (Addresses Debian Bug #236528).  

Fix typo in the ioctl used for Mac OS X.
2004-03-08 14:12:09 -05:00
Theodore Ts'o 9387c281ef probe.c (probe_ocfs), probe.h: Add support for the Oracle
Cluster Filesystem (ocfs).  Patches courtesy of Rusty
	Lynch (rusty@linux.co.intel.com).
2004-03-04 19:59:58 -05:00
Theodore Ts'o 85b8700344 Update getsize functions to use the Apple Darwin and Linux 64-bit
ioctl's.
2004-03-02 10:11:11 -05:00
Theodore Ts'o 434661f8d5 Patch from Brian Bergstrand to use the correct -fPIC flag for
Darwin in order to get rid of the compiler warning.
2004-02-29 22:46:49 -05:00
Theodore Ts'o b70b1167fe Update version number for e2fsprogs 1.35 release. 2004-02-28 10:52:35 -05:00
Theodore Ts'o 544349270e Fix gcc -Wall nitpicks 2003-12-07 01:28:50 -05:00
Theodore Ts'o 9c7ec17809 Update for 1.34 release. 2003-07-26 01:03:34 -04:00
Theodore Ts'o 3de5bf6106 probe.c (probe_udf): Add specific UDF probing code, and probe
UDF before checking for ISO9660 filesystems.
2003-07-22 01:06:36 -04:00