summaryrefslogtreecommitdiff
path: root/shlibs/blkid/src
AgeCommit message (Collapse)AuthorFilesLines
2010-04-23libblkid: reset superblocks result after errorKarel Zak1-1/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-04-23libblkid: cleanup some docsKarel Zak2-3/+18
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-04-23libblkid: add blkid_partlist_get_table()Karel Zak3-11/+24
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-04-23libblkid: don't gather PART_ENTRY_* values for binary interfaceKarel Zak1-1/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-04-22libblkid: fix collision between RAID and PT probingKarel Zak4-12/+165
The RAID signature is usually at end of the block device. We have to differentiate between: - RAID signature at the end of disk, and - RAID signature at the end of the last partition The position of the signature is same in both cases... It means we have to the parse partition table and check if the area where is RAID signature is covered by any partition. If yes, then the RAID signature belongs to the partition and has to be ignored during whole-disk probing. The second problem are RAID1 underlaying disks (=raid members). The RAID device could be partitioned, in such a case the partition table is visible from underlaying devices. These partition tables has to be ignored. The libblkid ignores partition tables on raid members now. Note that all these changes are implemented for blkid_do_safeprobe() only. The others functions allow to access all detected superblocks or partition tables. Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=543749 Signed-off-by: Karel Zak <kzak@redhat.com>
2010-04-21liblkid: export magic strings from raidsKarel Zak15-15/+82
The library provides detected magic strings by SBMAGIC= and offsets of the magic strings by SBMAGIC_OFFSET= variables. This patch allows to support this feature for RAIDs and filesystems where the magic string is not on fixed position. Signed-off-by: Karel Zak <kzak@redhat.com>
2010-04-21libblkid: add partial support for superblock binary APIKarel Zak2-9/+94
The API is used only internally. Signed-off-by: Karel Zak <kzak@redhat.com>
2010-04-19libblkid: cleanup fstat() usageKarel Zak1-33/+16
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-04-19libblkid: export functions to get whole-disk devnoKarel Zak5-1/+50
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-04-09libblkid: fix some typosMilan Broz6-16/+16
Signed-off-by: Milan Broz <mbroz@redhat.com>
2010-04-07libblkid: add ultrix PT supportKarel Zak4-0/+91
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-04-07libblkid: fix 'partno' usageKarel Zak6-10/+26
Linux kernel ignores empty partitions, but partition number is always allocated for the partition. (This rule is used for primary partitions only.) For example: part 1. size=12345 part 2. size=0 part 3. size=24567 the final list of partitions: sda1 sda3 'sda2' is not defined and partno=2 is not used for any other partitions. The libblkid library has to be compatible with this rule. Signed-off-by: Karel Zak <kzak@redhat.com>
2010-04-06libblkid: fix blkid_partlist_devno_to_partition() for extended partitionsKarel Zak1-0/+6
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-31libblkid: avoid probing CDs for RAIDM.S.Colclough3-0/+23
RAID probing of CD/DVD can yield errors because of well-known problem in reading the end of the disk with some disk/drive combinations. Borrow CD detection method from udev and skip the RAID tests for these devices. [kzak@redhat.com: - check for linux/cdrom.h in ./configure - add #ifdef around the ioctl call - call the ioctl for block devices only] Signed-off-by: Mark Colclough <m.s.colclough@bham.ac.uk> Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-17libblkid: add microsecond resolution for cache entriesKarel Zak5-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>
2010-03-14libblkid: fix infinite loop when probe chain bails out earlyColin Watson2-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>
2010-03-11libblkid: remove "0x" prefix from DRBD UUIDKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-11libblkid: improve ZFS detection and add LABEL and UUID extractionAndreas Dilger1-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>
2010-03-11libblkid: prevent overflow in BeFSJeroen Oortwijn1-7/+7
Prevent overflow by casting values to blkid_loff_t before applying block shift. Signed-off-by: Jeroen Oortwijn <oortwijn@gmail.com>
2010-03-11libblkid: don't use fstat() in blkid_get_dev_size()Karel Zak1-4/+0
We already use fstat() in blkdev_get_size(). Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-10libblkid: add blkid_probe_get_{offset,fd} functionsKarel Zak3-2/+31
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-10liblkid: move getsize.c code to lib/Karel Zak2-187/+27
.. and cleanup blkdev_get_size() usage in libblkid. Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-10libblkid: reset BLKID_TINY_DEV flag in blkid_probe_set_devicePascal Terjan1-0/+1
Signed-off-by: Pascal Terjan <pterjan@mandriva.com>
2010-03-10libblkid: fix display of device sizeKarel Zak1-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>
2010-03-08libblkid: more robust minix probingKarel Zak1-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>
2010-03-03libblkid: cleanup usage of empty topology valuesKarel Zak3-8/+7
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-03libblkid: support alignment_offset=-1Karel Zak7-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>
2010-02-19libblkid: improve Sun VTOCKarel Zak1-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>
2010-02-18blkid: encode PART_ENTRY_TYPEKarel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-18libblkid: add PART_ENTRY_{SCHEME,NUMBER}Karel Zak2-1/+12
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-18libblkid: add support for partition flags/attributesKarel Zak10-1/+42
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-18libblkid: add blkid_partition_set_type()Karel Zak11-24/+60
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-18libblkid: add support for PART_ENTRY_* valuesKarel Zak3-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>
2010-02-18libblkid: don't probe for nested PT on tiny disks (<=1.44MiB)Karel Zak1-14/+15
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-18libblkid: add generic functions for sysfs attributesKarel Zak3-33/+55
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-02-17libblkid: fix ZSF detectionAndreas Dilger1-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>
2010-02-12build-sys: remove duplicate #includesKarel Zak3-3/+0
$ 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>
2010-02-04libblkid: don't return error on empty filesKarel Zak3-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>
2010-02-02libblkid: minor fixes in befs.cKarel Zak1-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>
2010-02-02libblkid: Add probing function for BeFSJeroen Oortwijn1-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>
2010-02-02libblkid: Add initial support for BeFS detectionJeroen Oortwijn4-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>
2010-02-01libblkid: add blkid_probe_all_removable()Karel Zak5-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>
2010-02-01libblkid: add blkid_openat(), cleanup blkid_fstatat()Karel Zak2-4/+22
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-01-27libblkid: more robust minix probingKarel Zak1-3/+67
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-01-22libblkid: fix segfault in drdbMatthias König1-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>
2010-01-21libblkid: don't probe for GPT and Unixware PT on floppiesKarel Zak3-0/+5
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-01-21libblkid: add sanity checks for FAT to DOS PT parserKarel Zak4-70/+114
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-01-20libblkid: rewrite blkid_probe_get_buffer()Karel Zak3-146/+68
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>
2010-01-19libblkid: add minimal sizes for OCFS and GFSKarel Zak2-0/+5
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-01-19libblkid: don't call read() per FAT dir-entry on large disksKarel Zak1-9/+36
Signed-off-by: Karel Zak <kzak@redhat.com>