summaryrefslogtreecommitdiffstats
path: root/libblkid
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge branch 'master' of https://github.com/pali/util-linuxKarel Zak2017-11-131-0/+2
|\ \ | |/ |/| | | | | * 'master' of https://github.com/pali/util-linux: libblkid: vfat: Fix reading labels which starts with byte 0x05
| * libblkid: vfat: Fix reading labels which starts with byte 0x05Pali Rohár2017-11-091-0/+2
| | | | | | | | | | | | | | | | When FAT directory entry has leading byte 0x05 it is interpreted as byte 0xE5. This is how FAT stores file name which starts with byte 0xE5 as leading byte in 0xE5 in FAT directory entry means that file slot is empty. Fixes: #533
* | libblkid: improve FreeBSD partitions parsingKarel Zak2017-11-101-1/+10
|/ | | | | | | FreeBSD since version 10 uses relative offsets for nested partitions. Based on Richard Narron changes in kernel:block/partitions/msdos.c. Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid: Add support for LUKS2 and new LABEL attributes.Milan Broz2017-10-231-4/+38
| | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for detection of a LUKS2 superblock. LUKS2 is new version of Linux Unified Key Setup for encrypted block devices. LUKS2 contains a binary header and then JSON area for metadata. Blkid should only parse the binary part, including newly available optional LABEL and SUBSYSTEM fields. LABEL is similar to filesystem label. The SUBSYSTEM field is in principle, just a second label and can be used for specific udev rules (for example if you have some 3rd party system that activates volumes automatically, you can mark devices using this attribute). Both labels are optional. The magic string and UUID location are intentionally on the same offset as LUKS v1, so even unpatched blkid now recognizes LUKS2. Anyway, the code should not parse other versions of the header, so we now explicitly check for header version and support only version 1 and 2. Signed-off-by: Milan Broz <gmazyland@gmail.com>
* libfdisk: (sun) make math more robust [coverity scan]Karel Zak2017-10-111-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: cleanup UUID_STR_LEN definitionsKarel Zak2017-09-154-12/+6Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: replace magic number 37 with UUID_STR_LENPhilip Prindeville2017-09-055-6/+14
| | | | Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
* libblkid: udf: Define magic constantsPali Rohár2017-08-201-4/+9
|
* libblkid: fix compiler warning [-Wformat-truncation=]Karel Zak2017-08-161-1/+1
| | | | | | | | | The MBR partition pseudo-UUID is generated from table ID and partition partno. The final UUID size limit is 37 bytes. The table ID has to be restricted to keep compiler happy (for MBR the table ID is 8 bytes as string). Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: mark UBI as RAIDKarel Zak2017-08-032-2/+2
| | | | | | | | | UBI is volume manager rather than filesystem. Note that libblkid has optimized RAIDs probing (don't search for another filesystems is RAID detected). We also don't search for RAIDs on very small devices, but this optimization is ignored for UBI char devices (size=1byte). Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add support for UBI superblockRafał Miłecki2017-08-034-0/+54
| | | | | | | | | | | | | | | | | | UBI is a volume management system that can be used on a raw flash partition for providing multiple logical volumes. Detecting UBI superblock may be useful for tools wanting to simplify or automate attaching UBI. Please note it's not directly related to the ubifs support which is just a filesystem working on top of UBI volume. In other words: UBI can be used on MTD partition (e.g. /dev/mtdblock0) while ubifs can be used on UBI volume (e.g. /dev/ubi0_0). This patch adds simple code reading UBI version and unique number and setting it in the blkid_probe. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* libblkid: add HPE extended-XFS to known filesystemsMark Tinguely2017-07-204-0/+190
| | | | | | | | | | | | | | The HPE (formerly SGI) enhanced XFS has changed its magic version number to allow the use of EXFS and community XFS filesystems at the same time. This patch adds HPE EXFS support to libblkid. [kzak@redhat.com: - removed EXFS log prober, it uses the same magic string as XFS log] Signed-off-by: Mark Tinguely <mark.tinguely@hpe.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid: Add dm-integrity superblock signatureMilan Broz2017-07-183-0/+40
| | | | | | | | | | Since the kernel version 4.12 there is a new dm-integrity module that provides an emulated per-sector metadata format for storing data integrity. This patch adds dm-integrity magic signature to blkid to recognize such a block device. Signed-off-by: Milan Broz <gmazyland@gmail.com>
* build-sys: don't use non-existing UUID_LIBSRuediger Meier2017-07-181-1/+1
| | | | | | | We've added UUID_LIBS in f77a4d1087 but I don't see what it was good for. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libblkid: don't use CDROM_GET_CAPABILITY ioctl for DM devicesKarel Zak2017-07-122-2/+6
| | | | | | | | | For some reason kernel commit e980f62353c697cbf0c4325e43df6e44399aeb64 add extra warning when the ioctl is used for DM devices. It seems we can avoid this ioctl when the device has dm/uuid. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1469532 Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'master' of https://github.com/pali/util-linuxKarel Zak2017-07-111-45/+90
|\ | | | | | | | | | | | | | | * 'master' of https://github.com/pali/util-linux: tests: update UDF test, add ID_FS_VERSION libblkid: udf: Add support for ID_FS_VERSION libblkid: udf: Fix types libblkid: udf: De-duplicate code for dstring decoding
| * libblkid: udf: Add support for ID_FS_VERSIONPali Rohár2017-07-051-1/+66
| | | | | | | | Set ID_FS_VERSION to Minimum UDF Read Revision.
| * libblkid: udf: Fix typesPali Rohár2017-07-051-8/+8
| |
| * libblkid: udf: De-duplicate code for dstring decodingPali Rohár2017-07-051-36/+16Star
| |
* | libblkid: don't check for size on UBI (char dev)Karel Zak2017-07-111-1/+1
|/ | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: allow to hide already detected signaturesKarel Zak2017-06-285-25/+133
| | | | | | | | | | | | | | | | | | | | The libblkid probing functions returns the first successful result of the filesystem/RAID/PT. Unfortunately, some signatures is possible to detect by more ways or device may contains more copies (e.g. GPT). This is no problem when we wipe signatures from the device. In this case we zeroize on-device signature and re-scan for the signature (by blkid_probe_step_back()). The problem is if we want to read all permutations without the device modification (for example wipefs(8) dry run). This patch add blkid_probe_hide_range(). The function remove (zeroize) specified signature from in-memory cached buffers. If the buffer is later re-used by probing functions then the signature is invisible and we can try detect another variant of the magic string. Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: remove dead code and blkid_probe_new_value()Karel Zak2017-06-271-34/+2Star
| | | | | | The function blkid_probe_new_value() is unnecessary. Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: udf: Fix parsing of UDF dstring structuresPali Rohár2017-06-221-21/+45
| | | | | | First byte of dstring is OSTA Compression ID and the last byte is length of recorded bytes (including first byte). Last byte is not a part of recorded characters, therefore it should not be treated as data to decode.
* libblkid: udf: Fix detection of UDF images with block size 1024 and 4096Pali Rohár2017-06-141-6/+7
| | | | | | | | | | | When detecting block size of UDF filesystem, try to use also block size 512, 1024, 2048 and 4096. This would allow blkid to detect UDF filesystem in image file created from 4K hard disk (which should have UDF block size 4096). Before this patch only UDF images with block size of 512 and 2048 were detected as only block size from blkid_probe_get_sectorsize() and 2048 were used (blkid_probe_get_sectorsize() returns for disk images 512).
* misc: remove stray semicolonsSami Kerola2017-06-141-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: fix reassigned values before old ones has been used [cppcheck]Sami Kerola2017-06-142-2/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libblkid: fix gcc-7 warning -Wint-in-bool-contextRuediger Meier2017-06-141-1/+1
| | | | | | | | | | | | | | | | BLOCK_SIZE(sb) should be unsigned so that the left shift is defined. This was the warning: ../libblkid/src/superblocks/exfat.c: In function 'probe_exfat': ../libblkid/src/superblocks/exfat.c:40:42: warning: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context] #define CLUSTER_SIZE(sb) (BLOCK_SIZE(sb) << (sb)->bpc_bits) ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ ../libblkid/src/superblocks/exfat.c:122:14: note: in expansion of macro 'CLUSTER_SIZE' if (!sb || !CLUSTER_SIZE(sb)) ^~~~~~~~~~~~ Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: fix gcc-7 sprintf warnings -Wformat-overflowRuediger Meier2017-06-141-1/+1
| | | | | | | | | | | | | | | | | | | ../login-utils/last.c: In function ‘main’: ../login-utils/last.c:624:23: warning: ‘%s’ directive writing up to 31 bytes into a region of size 27 [-Wformat-overflow=] sprintf(path, "/dev/%s", ut->ut_line); ^~ ~~ ../login-utils/last.c:624:3: note: ‘sprintf’ output between 6 and 37 bytes into a destination of size 32 sprintf(path, "/dev/%s", ut->ut_line); ../libblkid/src/devname.c: In function 'probe_one': ../libblkid/src/devname.c:166:29: warning: '%s' directive writing up to 255 bytes into a region of size 245 [-Wformat-overflow=] sprintf(path, "/sys/block/%s/slaves", de->d_name); ^~ ../libblkid/src/devname.c:166:3: note: 'sprintf' output between 19 and 274 bytes into a destination of size 256 sprintf(path, "/sys/block/%s/slaves", de->d_name); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libblkid: (vfat) add more debug messagesKarel Zak2017-06-091-2/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: fix library order when linkingRuediger Meier2017-06-011-4/+4
| | | | | | | | | | We got some errors on Alpine Linux where $LTLIBINTL is non-empty: ./.libs/libcommon.a(libcommon_la-blkdev.o): In function `open_blkdev_or_file': lib/blkdev.c:282: undefined reference to `libintl_gettext collect2: error: ld returned 1 exit status Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libblkid: (docs) add missing 'since' tagsKarel Zak2017-05-233-1/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: udf: Change algorithm for reporting UUIDPali Rohár2017-05-171-26/+25Star
| | | | | | | | | | | | Ensure that reported UUID always contains only lowercase hexadecimal digits and is always 16 characters length, padded with zero digits. Volume Set Identifier is converted to UTF-8 before generating UUID from it. As it could potentially contain any Unicode character. So correctly handle both 8bit and 16bit OSTA Compressed Unicode encodings. Disks which have only lowercase hexadecimal digits in Volume Set Identifier would have same UUID as before this patch.
* libblkid: udf: Correctly handle UDF strings encoded in 8bit OSTA Compressed ↵Pali Rohár2017-05-161-8/+12
| | | | | | | | | | | | | | Unicode String encoded in 8bit OSTA Compressed Unicode contains one Unicode codepoint per 8bits. Maximal Unicode codepoint is U+FF. Which effectively means that it is equivalent to Latin1 encoding. Before this patch libblkid copied raw 8bit OSTA Compressed Unicode from disk and treated it as UTF-8. It worked fine just for UTF-8 invariants, other characters were incorrectly encoded. This patch fixes this problem. Note that processing UUID is not fixed in this patch.
* libblkid: Add support for Latin1 encoding in blkid_encode_to_utf8()Pali Rohár2017-05-162-3/+15
|
* Merge branch 'master' of https://github.com/pali/util-linuxKarel Zak2017-05-115-40/+3Star
|\ | | | | | | | | | | | | * 'master' of https://github.com/pali/util-linux: tests: Add UDF CD-ROM hybrid image (ISO+Joliet+UDF) created by Nero 6 tests: Fix test output for low-probe-udf to contain UDF data Revert "libblkid: Probe UDF volumes for ISO9660 info as well"
| * Revert "libblkid: Probe UDF volumes for ISO9660 info as well"Pali Rohár2017-05-055-40/+3Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 8053b51c7601c4a7e5f2eca45610b8228f53d408. Reporting meaningless ID_FS_LABEL=UDF_Volume written in that commit was caused by reading wrong value for UDF label and it was fixed in commit 2f2730bc77c972d613cfec421468c84f15749708. So after this revert blkid reports for UDF filesystems label of UDF filesystem and not label of ISO (if present) like other systems. In most cases UDF and ISO labels are same (sometimes just one is upper case). Commit 8053b51c7601c4a7e5f2eca45610b8228f53d408 just fixed result, not reason why blkid reported different UDF Label as Windows. Real reason was fixed in 2f2730bc77c972d613cfec421468c84f15749708.
* | libblkid: add blkid_partitions_get_name()Sami Kerola2017-05-034-0/+19
|/ | | | | | | | This new function can be use to enquiry what partition names libblkid is aware of. First use of this information will be in partx(8) to make bash completion to work without a magic list. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libblkid: udf: For better readibility use one snprintf call instead multiple ↵Pali Rohár2017-05-011-4/+5
| | | | in loop
* misc: fix some printf format stringsRuediger Meier2017-04-101-1/+2
| | | | | | | | | | | Fix compiler warnings seen on Linux/i586 and OSX/travis. #type #format #cast unsigned long %lu - uint64_t PRIu64 - fdisk_sector_t %ju (uintmax_t) Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libblkid: fix typoKarel Zak2017-03-241-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: prevent OOB access while probing HFS+Tobias Stoeckmann2017-03-231-2/+4
| | | | | | | | | | | | | It is possible to perform out of boundary read accesses due to insufficient boundary checks in probe_hfsplus. The first issue occurs if the leaf count in a B-node is too small. The second happens while parsing a unicode description which is longer than 255 UTF-8 characters. The length is stored in a 16 bit integer, but the array in the struct is limited to 255 * 2, which is in sync with Apple's Open Source HFS+ implementation (HFSUniStr255). Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
* libblkid: ensure uninitialized variable is not used [clang]Sami Kerola2017-03-131-5/+10
| | | | | | | | | | | | | | | | | Following condition can be true if minix file system is corrupt, and versio number is found to be greater than 3. It is fair to say described scenario is unlikely. libblkid/src/superblocks/minix.c:107:13: warning: variable 'zone_size' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] } else if (version == 3) { ^~~~~~~~~~~~ libblkid/src/superblocks/minix.c:121:6: note: uninitialized use occurs here if (zone_size != 0 || ninodes == 0 || ninodes == UINT32_MAX) ^~~~~~~~~ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libblkid: avoid overflow when initializing arraySami Kerola2017-03-131-1/+1
| | | | | | | libblkid/src/superblocks/drbdmanage.c:38:42: warning: too long initializer-string for array of char(no space for nul char) Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: stop mixing declarations and codeSami Kerola2017-03-131-4/+3Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libblkid: Fix blkid.conf parsingTobias Stoeckmann2017-03-131-1/+1
| | | | | | | | | The SEND_UEVENT=yes|no line is not properly parsed, because the offset jumps one byte too far behind the equal sign. Therefore, every configuration that contains the line "SEND_UEVENT=yes" still does not send an uevent. The fix is simple: adjust the offset to be "12" instead of "13".
* libblkid: remove unnecessary 'static' keywordKarel Zak2017-02-201-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: declare across file variables in blkidP.h [smatch scan]Sami Kerola2017-02-202-5/+5
| | | | | | | | | Else these variables will cause following warning: libblkid/src/superblocks/superblocks.c:165:29: warning: symbol 'superblocks_drv' was not declared. Should it be static? Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: add static keyword to where needed [smatch scan]Sami Kerola2017-02-202-2/+2
| | | | | | | text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be static? Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: do not use plain 0 as NULL [smatch scan]Sami Kerola2017-02-207-22/+22
| | | | | | | | | | text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer Since many 'struct option' has used zero as NULL make them more readable in same go by reindenting, and using named argument requirements. Reference: https://lwn.net/Articles/93577/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libblkid: (gpt) fix force flagKarel Zak2017-02-151-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>