summaryrefslogtreecommitdiffstats
path: root/shlibs/blkid
Commit message (Collapse)AuthorAgeFilesLines
* libblkid: add microsecond resolution for cache entriesKarel Zak2010-03-175-16/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The libblkid library uses stat.st_mtine to detect changes on the device. The last update time of of the device in the cache is stored as TIME= tag in the /etc/blkid.tab file. Linux since 2.5.48 supports nanosecond resolution and more precise time is available in the stat.st_mtim timespec struct. This patch add microsecond precision to TIME= tag in the cache file, old format: TIME="<sec>" the new format: TIME="<sec>.<usec>" This change is backwardly compatible. Now, the blkid_verify() function checks stat.st_mtime and stat.st_mtim.tv_nsec/1000. Test: # e2label /dev/sdb1 AAAA old version: # blkid -s LABEL /dev/sdb1; e2label /dev/sdb1 BBBB; blkid -s LABEL /dev/sdb1 /dev/sdb1: LABEL="AAAA" /dev/sdb1: LABEL="AAAA" new version: # blkid -s LABEL /dev/sdb1; e2label /dev/sdb1 BBBB; blkid -s LABEL /dev/sdb1 /dev/sdb1: LABEL="AAAA" /dev/sdb1: LABEL="BBBB" Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix infinite loop when probe chain bails out earlyColin Watson2010-03-142-3/+7
| | | | | | | | | | | | | The superblocks probe bails out early with no results in some cases. If this happens, blkid_do_probe needs to go to the next chain, rather than entering an infinite loop calling superblocks_probe over and over again. [kzak@redhat.com: - print debug message always when leaving superblocks_probe()] Addresses: https://bugs.launchpad.net/bugs/528073 Signed-off-by: Colin Watson <cjwatson@canonical.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: remove "0x" prefix from DRBD UUIDKarel Zak2010-03-111-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: improve ZFS detection and add LABEL and UUID extractionAndreas Dilger2010-03-111-35/+175
| | | | | | | | | | | | | | | | | Improve ZFS uberblock detection to loop over multiple uberblocks, and detect at least 4 magic values, to avoid random collisions. It doesn't yet probe the VDEV LABEL at the end of the device, though it wouldn't be too hard to add it at this point if needed. Add extraction of the pool name (as LABEL), the VDEV (block device) guid as UUID_SUB, and pool_guid (volume) as UUID from the nvlist in the VDEV LABEL. Do simple sanity checking on the nvlist data values to avoid overflowing the buffer if they are corrupt in any way. [kzak@redhat.com: - use %PRIu64 instead %llu] Signed-off-by: Andreas Dilger <adilger@sun.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: prevent overflow in BeFSJeroen Oortwijn2010-03-111-7/+7
| | | | | | | Prevent overflow by casting values to blkid_loff_t before applying block shift. Signed-off-by: Jeroen Oortwijn <oortwijn@gmail.com>
* libblkid: don't use fstat() in blkid_get_dev_size()Karel Zak2010-03-111-4/+0Star
| | | | | | We already use fstat() in blkdev_get_size(). Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add blkid_probe_get_{offset,fd} functionsKarel Zak2010-03-103-2/+31
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* liblkid: move getsize.c code to lib/Karel Zak2010-03-102-187/+27Star
| | | | | | .. and cleanup blkdev_get_size() usage in libblkid. Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: reset BLKID_TINY_DEV flag in blkid_probe_set_devicePascal Terjan2010-03-101-0/+1
| | | | Signed-off-by: Pascal Terjan <pterjan@mandriva.com>
* libblkid: fix display of device sizeKarel Zak2010-03-101-1/+1
| | | | | | | blkid_loff_t is int64 so use %jd not %zd in debug Reported-by: Pascal Terjan <pterjan@mandriva.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: more robust minix probingKarel Zak2010-03-081-0/+10
| | | | | | | | | | | Unfortunately, it's still possible to interpret some parts of ext3 filesystem as minix superblock ;-( So, the most robust is to check for the extN magic string in minix probing function. Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=570606 Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: cleanup usage of empty topology valuesKarel Zak2010-03-033-8/+7Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: support alignment_offset=-1Karel Zak2010-03-037-60/+89
| | | | | | | | | | | | | | Unfortunately, Linux kernel uses "signed int" for alignment_offset and the offset could be -1 for devices with undefined alignment (if no compatible sizes and alignments exist for stacked devices). There is no way how libblkid caller can respond to the value -1, so we are going to hide this corner case... TODO: maybe we can export an extra boolean value 'misaligned' rather then complete hide this problem. We will see... Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: improve Sun VTOCKarel Zak2010-02-191-18/+30
| | | | | | | | | | | It seems that for example GNU Parted is able to generate Sun VTOC with empty sanity, version and nparts fields. But there is still useful info about partition flags in such VTOC. This change makes libblkid Sun PT parser compatible with Sun PT parser in Linux kernel. Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid: encode PART_ENTRY_TYPEKarel Zak2010-02-181-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add PART_ENTRY_{SCHEME,NUMBER}Karel Zak2010-02-182-1/+12
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add support for partition flags/attributesKarel Zak2010-02-1810-1/+42
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add blkid_partition_set_type()Karel Zak2010-02-1811-24/+60
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add support for PART_ENTRY_* valuesKarel Zak2010-02-183-7/+131
| | | | | | | | | | | | blkid(8) will be replacement for devkit-disks-part-id, so we have to be able to found entry in partition table for requested partition. This functionality is enabled by BLKID_PARTS_ENTRY_DETAILS flag (see blkid_probe_set_partitions_flags() for more details). This patch also add a new public function blkid_partlist_devno_to_partition(). Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: don't probe for nested PT on tiny disks (<=1.44MiB)Karel Zak2010-02-181-14/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add generic functions for sysfs attributesKarel Zak2010-02-183-33/+55
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix ZSF detectionAndreas Dilger2010-02-171-8/+18
| | | | | | | | | | | | | | | Fix the ZFS device detection by looking at multiple uberblocks to see if any are present, rather than looking for the ZFS boot block which is not always present. There may be up to 128 uberblocks, but the first 4 are not written to disk on a newly-formatted filesystem so check several of them at different offsets within the uberblock array. [kzak@redhat.com: - port e2fsprogs patch to util-linux-ng] Signed-off-by: Andreas Dilger <adilger@sun.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: remove duplicate #includesKarel Zak2010-02-123-3/+0Star
| | | | | | | | | | | $ make checkincludes fsck/fsck.c: errno.h is included more than once. lib/canonicalize.c: string.h is included more than once. shlibs/blkid/src/blkidP.h: stdio.h is included more than once. shlibs/blkid/src/devname.c: string.h is included more than once. shlibs/blkid/src/devno.c: string.h is included more than once. Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: don't return error on empty filesKarel Zak2010-02-043-5/+10
| | | | | | | | | | | | | | Currently, the library does not allow to initialize blkid_probe if the file (or block device) is empty. The empty file is reported as an error. That's wrong. The empty file should be interpreted as a file without any FS or PT. It means that blkid_do_{probe,safeprobe,fullprobe}() have to return 1 ("nothing"). Reported-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: minor fixes in befs.cKarel Zak2010-02-021-8/+16
| | | | | | | | | The library does not reset the probing result (e.g. LABEL, VERSION) when the probing function failed (return value != 0). We have to be absolutely sure that the FS has been properly detected before we set LABEL or VERSION or so. Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: Add probing function for BeFSJeroen Oortwijn2010-02-021-1/+182
| | | | | | | | | | | | Add probing function for the Be File System to libblkid. It sets LABEL, VERSION and UUID. But UUID is only set if the be:volume_id attribute is found in the small_data area of the i-node of the root directory. [kzak@redhat.com: - add .minsz = 1024*1440 to avoid BeFS probing on very small devices] Signed-off-by: Jeroen Oortwijn <oortwijn@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: Add initial support for BeFS detectionJeroen Oortwijn2010-02-024-2/+23
| | | | | | | Add initial support for detection of the Be File System <http://en.wikipedia.org/wiki/Be_File_System> to libblkid. Signed-off-by: Jeroen Oortwijn <oortwijn@gmail.com>
* libblkid: add blkid_probe_all_removable()Karel Zak2010-02-015-8/+114
| | | | | | | | | | | | | | The libblkid probing is based on devices from /proc/partitions by default. This file usually does not contain removable devices (e.g. CDROMs) and this kind of devices are invisible for libblkid. The blkid_probe_all_removable() function adds removable block devices to blkid cache. The probing is based on information from the /sys directory. The devices which were detected by this function won't be written to blkid.tab cache file. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=533874 Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add blkid_openat(), cleanup blkid_fstatat()Karel Zak2010-02-012-4/+22
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: more robust minix probingKarel Zak2010-01-271-3/+67
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix segfault in drdbMatthias König2010-01-221-1/+2
| | | | | | | Check if blkid_probe_get_buffer() returns NULL to avoid dereferencing a zero pointer resulting in a segfault. Signed-off-by: Matthias König <mk@phasorlab.de>
* libblkid: don't probe for GPT and Unixware PT on floppiesKarel Zak2010-01-213-0/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add sanity checks for FAT to DOS PT parserKarel Zak2010-01-214-70/+114
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: rewrite blkid_probe_get_buffer()Karel Zak2010-01-203-146/+68Star
| | | | | | | The library does not use any buffer with fixed size any more. The new version calls read() for necessary data only. Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add minimal sizes for OCFS and GFSKarel Zak2010-01-192-0/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: don't call read() per FAT dir-entry on large disksKarel Zak2010-01-191-9/+36
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: read whole SB buffer (69kB) on large disksKarel Zak2010-01-192-8/+21
| | | | | | | - on large disks read whole SB buffer - new blkid_probe_is_tiny() version based on flags Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: set minimal size for jfs, reiser, swap and zfsKarel Zak2010-01-196-2/+14
| | | | | | .. and don't probe for swap or ext. journal on tiny disks. Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: disable read-ahead when probing device filesLinus Torvalds2010-01-191-0/+4
| | | | | | | | | | | Read-ahead doesn't work very well on device probing, and can hurt a lot when we do essentially random accesses on very slow devices. So disable it if possible. [kzak@redhat.com: - add posix_fadvise() configure test] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: call read() per FAT root dir entryKarel Zak2010-01-191-23/+27
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: read() optimization for small devicesKarel Zak2010-01-183-55/+106
| | | | | | | | | | | | | | | | | | | | | | | - don't read the begin (69kB) of the device by one large read() - fill in the SB buffer dynamically - use extra buffer for FATs root dir entries (FAT FS label) on small devices to avoid large reads Detect FAT12 on 1.4MB device (number of bytes): Old version: $ strace -e read blkid -p floppy.img 2>&1 | \ awk -F ' = ' 'BEGIN {x=0} /read/ && !/.*ELF/ {x += $2} END { print x }' 73292 New version: $ strace -e read blkid -p floppy.img 2>&1 | \ awk -F ' = ' 'BEGIN {x=0} /read/ && !/.*ELF/ {x += $2} END { print x }' 8192 Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: restrict RAID/FS proving for small devices (1.4MiB)Karel Zak2010-01-183-10/+58
| | | | | | | | | - don't ignore @size in blkid_probe_set_device() - ignore extremely small devices (<= 1024 bytes, e.g. extended partitions) - don't use safe probing for small devices - don't probe for RAIDs on small devices Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: DRBD support for blkidBastian Friedrich2010-01-044-0/+109
| | | | | | | | | | | | | | | | DRBD is the Distributed Replicated Block Device, a replication service for low level block devices. The attached patch provides libblkid detection for v08 type drbd devices (v08 is the current one). [kzak@redhat.com: - port to libblkid 2.17 - use BLKID_USAGE_RAID flag - remove BLKID_IDINFO_TOLERANT flag - note that DRBD is supported since kernel v2.6.33-rc1] Signed-off-by: Bastian Friedrich <bastian.friedrich@collax.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: rename highpoint RAIDs to hpt{37,45}x_raid_memberKarel Zak2009-12-151-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix highpoint37x detectionKarel Zak2009-12-151-2/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix Adaptec RAID detectionKarel Zak2009-12-151-3/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix blkid_fstatat() codeKarel Zak2009-12-041-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix UFS detectionKarel Zak2009-11-261-3/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix NTFS non-ASCII labelsKarel Zak2009-11-131-15/+3Star
| | | | | Addresses-Red-Hat-Bug: #536797 Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: remove duplicate debug messageKarel Zak2009-11-111-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>