Commit Graph

590 Commits

Author SHA1 Message Date
Pali Rohár c748335382 libblkid: udf: Define magic constants 2017-08-20 14:50:02 +02:00
Karel Zak feeeaca967 libblkid: fix compiler warning [-Wformat-truncation=]
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>
2017-08-16 11:55:57 +02:00
Karel Zak 1266fcf9cf libblkid: mark UBI as RAID
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>
2017-08-03 15:31:54 +02:00
Rafał Miłecki a6b1ec864a libblkid: add support for UBI superblock
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>
2017-08-03 14:11:21 +02:00
Mark Tinguely aaf133265f libblkid: add HPE extended-XFS to known filesystems
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>
2017-07-20 10:12:21 +02:00
Milan Broz 78f9ecb990 blkid: Add dm-integrity superblock signature
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>
2017-07-18 14:43:21 +02:00
Ruediger Meier 21be08ac8c build-sys: don't use non-existing UUID_LIBS
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>
2017-07-18 11:06:53 +02:00
Karel Zak 884659b32a libblkid: don't use CDROM_GET_CAPABILITY ioctl for DM devices
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>
2017-07-12 14:35:53 +02:00
Karel Zak 10bba184bb Merge branch 'master' of https://github.com/pali/util-linux
* '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
2017-07-11 14:31:23 +02:00
Karel Zak 4360f56cf6 libblkid: don't check for size on UBI (char dev)
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-07-11 12:17:40 +02:00
Pali Rohár db31676743 libblkid: udf: Add support for ID_FS_VERSION
Set ID_FS_VERSION to Minimum UDF Read Revision.
2017-07-05 13:50:52 +02:00
Pali Rohár 35b1ec3c4b libblkid: udf: Fix types 2017-07-05 13:46:12 +02:00
Pali Rohár 7afa432a07 libblkid: udf: De-duplicate code for dstring decoding 2017-07-05 12:15:00 +02:00
Karel Zak d2b0c6587d libblkid: allow to hide already detected signatures
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>
2017-06-28 10:28:41 +02:00
Karel Zak 08029093b0 libblkid: remove dead code and blkid_probe_new_value()
The function blkid_probe_new_value() is unnecessary.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-27 11:26:41 +02:00
Pali Rohár f0fcfdc30f libblkid: udf: Fix parsing of UDF dstring structures
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.
2017-06-22 10:38:08 +02:00
Pali Rohár 501aeb60a4 libblkid: udf: Fix detection of UDF images with block size 1024 and 4096
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).
2017-06-14 23:15:14 +02:00
Sami Kerola f4d3783867 misc: remove stray semicolons
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-06-14 12:21:29 +02:00
Sami Kerola 1b5042636f misc: fix reassigned values before old ones has been used [cppcheck]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-06-14 12:19:20 +02:00
Ruediger Meier 11e904f02c libblkid: fix gcc-7 warning -Wint-in-bool-context
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>
2017-06-14 11:48:22 +02:00
Ruediger Meier f64ddc95f3 misc: fix gcc-7 sprintf warnings -Wformat-overflow
../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>
2017-06-14 11:48:22 +02:00
Karel Zak bff78d701d libblkid: (vfat) add more debug messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-09 11:11:38 +02:00
Ruediger Meier c0d7b11a3f build-sys: fix library order when linking
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>
2017-06-01 03:16:48 +02:00
Karel Zak ae4e2abcb1 libblkid: (docs) add missing 'since' tags
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-23 14:27:36 +02:00
Pali Rohár d8ba647d0d libblkid: udf: Change algorithm for reporting UUID
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.
2017-05-17 20:36:40 +02:00
Pali Rohár 22acc2681d libblkid: udf: Correctly handle UDF strings encoded in 8bit OSTA Compressed 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.
2017-05-16 23:52:05 +02:00
Pali Rohár 98bc12ab48 libblkid: Add support for Latin1 encoding in blkid_encode_to_utf8() 2017-05-16 23:51:50 +02:00
Karel Zak ce59d8bfa5 Merge branch 'master' of https://github.com/pali/util-linux
* '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"
2017-05-11 10:59:14 +02:00
Pali Rohár ccfb5b0a1d Revert "libblkid: Probe UDF volumes for ISO9660 info as well"
This reverts commit 8053b51c76.

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
2f2730bc77.

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 8053b51c76 just fixed result, not
reason why blkid reported different UDF Label as Windows. Real reason was
fixed in 2f2730bc77.
2017-05-05 18:38:15 +02:00
Sami Kerola 635d9aa5db
libblkid: add blkid_partitions_get_name()
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>
2017-05-02 23:22:04 +01:00
Pali Rohár 49d84dbedc libblkid: udf: For better readibility use one snprintf call instead multiple in loop 2017-05-01 09:28:22 +02:00
Ruediger Meier c8df4b17d4 misc: fix some printf format strings
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>
2017-04-10 15:40:58 +02:00
Karel Zak 044d6e5565 libblkid: fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-03-24 11:46:33 +01:00
Tobias Stoeckmann 62ab1ebb12 libblkid: prevent OOB access while probing HFS+
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>
2017-03-23 15:46:36 +01:00
Sami Kerola 57f1539592 libblkid: ensure uninitialized variable is not used [clang]
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>
2017-03-13 14:48:12 +01:00
Sami Kerola c88f7aee8f libblkid: avoid overflow when initializing array
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>
2017-03-13 14:48:10 +01:00
Sami Kerola c308e2050f misc: stop mixing declarations and code
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-03-13 14:48:04 +01:00
Tobias Stoeckmann 55a5fbbc33 libblkid: Fix blkid.conf parsing
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".
2017-03-13 12:46:47 +01:00
Karel Zak bf3e7a40ab libblkid: remove unnecessary 'static' keyword
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-20 13:08:30 +01:00
Sami Kerola c5e3ebcedc libblkid: declare across file variables in blkidP.h [smatch scan]
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>
2017-02-20 13:00:58 +01:00
Sami Kerola 2ba641e5f3 misc: add static keyword to where needed [smatch scan]
text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be
static?

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-02-20 12:58:49 +01:00
Sami Kerola 8791804065 misc: do not use plain 0 as NULL [smatch scan]
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>
2017-02-20 12:58:49 +01:00
Karel Zak e9e88bb8e9 libblkid: (gpt) fix force flag
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-15 11:30:58 +01:00
Karel Zak 74493d48d8 libblkid: fix BLKID_PARTS_FORCE_GPT usage
Now wipefs always inform about MBR as about PMBR. That's bug.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-14 14:57:24 +01:00
Alden Tondettar a157a23f6d libblkid: Fix out of bounds reads in BEFS handling
The BEFS prober is quite trusting of whatever data is fed to it and
performs almost no bounds checks. There don't seem to be any
out-of-bounds writes as far as I can tell, but there are many ways a
corrupted image could cause libblkid to read OOB and segfault, or hang
in an infinite loop.

This fix makes a few sanity-checks of the superblock, add bounds checks
wherever they seem needed, and crudely checks for cycles in the B+ tree.

Signed-off-by: Alden Tondettar <alden.tondettar@gmail.com>
2017-01-25 11:43:06 +01:00
Alden Tondettar dfb8d4ba92 libblkid: Fix out of bounds reads on bad GPT header
If a GUID Partition Table claims to have more than 2**25 entries, or if the
size of each entry is not exactly 128 bytes, libblkid can read out of bounds
and segfault. Perform the appropriate checks.

[kzak@redhat.com: - fix typo]

Signed-off-by: Alden Tondettar <alden.tondettar@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-01-25 11:41:22 +01:00
Alden Tondettar 999a2ffec9 libblkid: Fix out of bounds reads on bad NTFS Master File Table
The NTFS prober does not validate certain fields in struct file_attribute,
and could attempt to read the disk label from outside the space allocated
for the Master File Table.  Perform the appropriate checks.

Note that one variable (attr_off) is now 64-bit, so a check for integer
overflow has been removed as unneeded/confusing.

Signed-off-by: Alden Tondettar <alden.tondettar@gmail.com>
2017-01-25 11:39:10 +01:00
Alden Tondettar a7caeabadf libblkid: Fix out of bounds byte swaps in ZFS handling
A corrupted ZFS filesystem can trigger 32-bit endian-conversions of
unintended memory locations in zfs_extract_guid_name(), in several ways:

* The variable "left" (number of bytes remaining in the buffer) does not
  account for the 12 bytes of the nvlist header.

* The field nvp->nvp_namelen (name length in name/value pair) is rounded
  up to the nearest multiple of 4, but only the unrounded size is checked.

* The fields nvs->nvs_type, nvs_strlen, etc. are modified _before_ checking
  if they are within bounds.

* A negative value of nvp->nvp_namelen will bypass the check that
  nvp->nvp_namelen fits into nvp->nvp_size (size of name/value pair).

This allows for mangling of locations up to 12 + 3 + 8 == 23
bytes beyond the end of stack-based buff[4096], and up to 2**31 bytes
before its beginning.

Furthermore some debugging messages are printed from unchecked memory
locations, possibly resulting in OOB reads or setuid programs leaking
sensitive data when LIBBLKID_DEBUG is set.

This fix attempts to correct all of these problems. It also eliminates the
stack-based buffer (in case anything else was missed) and refactors things
a bit to (hopefully) make it easier to spot any mistakes.

Signed-off-by: Alden Tondettar <alden.tondettar@gmail.com>
2017-01-25 11:39:10 +01:00
Karel Zak 76fab513b8 libblkid: add blkid_probe_set_sectorsize()
The usual way is to use ioctl to ask block device for sector size, but
this is useless for disk images (regular files). And the default
(512-bytes) may be pretty wrong for disk images from 4K disks. Let's
support a way how to specify proper sector size.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-01-13 13:26:37 +01:00
Nate Clark 892553b1a4 libblkid/minix: Sanity check superblock s_state for v 1 and 2
Swap devices with specific values in the uuid can look like minix
devices to blkid. Add an extra check to make sure the state of the
filesystem has valid state flags.

A couple of offending swap uuids include:
35f1f264-137f-471a-bc85-acc9f4bc04a3
35f1f264-7f13-471a-bc85-acc9f4bc04a3
35f1f264-138f-471a-bc85-acc9f4bc04a3
35f1f264-8f13-471a-bc85-acc9f4bc04a3

Without this change a swap device with any of those uuids would be
detected as minix and swap by blkid.

Signed-off-by: Nate Clark <nate@neworld.us>
2017-01-04 15:24:40 -05:00
Nate Clark f82c804869 libblkid/minix: Use same checks for version 3
fsck.minix performs the same sanity checks on all versions of the
superblock. Update the probe to perform the same sanity checks so it is
less likely a different type of filesystem will be identified as minix.

Signed-off-by: Nate Clark <nate@neworld.us>
2017-01-04 15:24:32 -05:00
Nate Clark a9975c1072 libblkid/minix: Match minix superblock types
All of the types in the minix super block are unsigned but in
probe_minix they were being treated as signed. This would cause some of
the extra sanity checks to pass on a non minix device. The types were
updated to match the return types of the helper functions in
disk-utils/minix_programs.h

This can be checked by creating a swap partition with one of these UUIDs
35f1f264-2468-471a-bc85-acc9f4bc04a3
35f1f264-6824-471a-bc85-acc9f4bc04a3
35f1f264-2478-471a-bc85-acc9f4bc04a3
35f1f264-7824-471a-bc85-acc9f4bc04a3

Prior to this change they would all be considered minix and swap by
blkid.

Signed-off-by: Nate Clark <nate@neworld.us>
2017-01-04 15:24:22 -05:00
Sébastien Helleu d673b74e9d docs: replace FTP by HTTPS in kernel.org URLs
The links to ftp://ftp.kernel.org/ are replaced by
https://www.kernel.org/.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-12-19 11:22:26 +01:00
Ruediger Meier 223939d95b misc: spelling, always use "cannot" instead of "can not"
Just to be consistent ...

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-11-30 14:56:50 +01:00
Ruediger Meier eaaf0e7e37 misc: once again some printf format strings
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-10-27 11:03:27 +02:00
Ruediger Meier 332123f2b6 misc: fix some compiler warnings
libsmartcols/samples/fromfile.c:59:2: warning: passing argument 3 of 'string_to_bitmask' from incompatible pointer type
  text-utils/pg.c:79:0: warning: "TABSIZE" redefined
  libblkid/src/read.c:455:13: warning: 'debug_dump_dev' defined but not used [-Wunused-function]
  libblkid/src/probe.c:769:13: warning: unused function 'cdrom_size_correction' [-Wunused-function]
  /usr/include/sys/termios.h:3:2: warning: "this file includes <sys/termios.h> which is deprecated, use <termios.h> instead" [-W#warnings]

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-10-27 11:03:24 +02:00
Gustavo Zacarias 7f0d4d56a2 lib/crc32: prefix public functions
Make the publicly-visible crc32 library functions prefixed by ul_, such
as crc32() -> ul_crc32().
This is because it clashes with the crc32() function from zlib.
For newer versions of glib (2.50+) zlib and libblkid are required
dependencies and otherwise results in build failure when building
statically.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
2016-10-19 12:11:59 +02:00
Tobias Stoeckmann e8c20678f3 libblkid: Avoid strlen if only first char is checked
A strlen() call can lead to out of boundary read access if the
superblock in question has no nul-bytes after the string. This
could be avoided by using strnlen() but the calls in question
merely existed to check if the string length is not 0.

By changing the calls as proposed with this diff, these files are
in sync with other superblock files, which do exactly the same.
2016-10-06 14:56:39 +02:00
Karel Zak e12e917bad libblkid: check blkid_parse_tag_string() return code [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-10-04 16:23:52 +02:00
Rostislav Skudnov f98b563268 libblkid: [exfat] Limit maximum number of iterations in find_label
Do not hang if there is a cluster chain loop in rootdir

[kzak@redhat.com: - add return NULL]

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-30 13:50:51 +02:00
Karel Zak 4db236f7e4 libblkid: ignore empty MBR on LVM device
It's possible to use boot sector and empty MBR on LVM physical volume
to make LVM disk bootable. In this case MBR should be ignored and disk
reported as LVM.

Just for the record, this is ugly non-default LVM setup maintained for
backward compatibility (yes, LVM guys don't like it too).

Unfortunately people still use it. The proper way is to use regular
partitioned disk.

Reported-by: Xen <list@xenhideout.nl>
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-30 12:07:40 +02:00
Karel Zak a1df9c9d4e libblkid: remove unused function
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-30 11:22:30 +02:00
Tobias Stoeckmann 8fa57ab0b5 libblkid: Avoid OOB access on illegal ZFS superblocks
64 bit systems can trigger an out of boundary access while performing
a ZFS superblock probe.

This happens due to a possible integer overflow while calculating
the remaining available bytes. The variable is of type "int" and the
string length is allowed to be larger than INT_MAX, which means that
avail calculation can overflow, circumventing the "avail < 0" check and
therefore accessing memory outside the "buff" array later on.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2016-08-29 13:22:24 +02:00
Rostislav Skudnov 9d89a95e88 libblkid: Check that cluster size is nonzero when probing exFAT
This should prevent division by zero in find_label()

Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
2016-08-16 12:08:46 +02:00
Karel Zak 38f6945d63 liblkid: fix probe_nilfs2 I/O error backup
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-02 15:54:13 +02:00
Sami Kerola 6b95f11c06
libblkid: fix debugging macro [oclint]
The oclint was complaining 'empty do/while statement' that turned out to be
true and I started to think it is best to use the same DBG() macro as in
other source files for this library.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-07-21 21:14:33 +01:00
Sami Kerola 92a4d098ce
libblkid: simplify if clause [oclint]
Move negative and positive testing of 'has' variable to top level, and test
flag bit mask on second level.  This way the 'has' needs to be checked only
once.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-07-21 21:14:33 +01:00
Karel Zak 50d1594c2e libblkid: avoid non-empty recursion in EBR
This is extension to the patch 7164a1c34d.

We also need to detect non-empty recursion in the EBR chain. It's
possible to create standard valid logical partitions and in the last one
points back to the EBR chain. In this case all offsets will be non-empty.

Unfortunately, it's valid to create logical partitions that are not in
the "disk order" (sorted by start offset). So link somewhere back is
valid, but this link cannot points to already existing partition
(otherwise we will see recursion).

This patch forces libblkid to ignore duplicate logical partitions, the
duplicate chain segment is interpreted as non-data segment, after 100
iterations with non-data segments it will break the loop -- no memory
is allocated in this case by the loop.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1349536
References: http://seclists.org/oss-sec/2016/q3/40
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-07-12 13:34:54 +02:00
Karel Zak 7164a1c34d libblkid: ignore extended partition at zero offset
If the extended partition starts at zero LBA then MBR is interpreted
as EBR and all is recursively parsed... result is out-of-memory.

 MBR --extended-partition--> EBR --> MBR --> ENB --> MBR ...

Note that such PT is not possible to create by standard partitioning
tools.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1349536
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-07-07 14:22:41 +02:00
Alexey Obitotskiy 6c448f452e libblkid: Add metadata signature check for IMSM on 4Kn drives
Drives with 512 and 4K sectors have different offset for
metadata signature. Without signature detected on 4Kn drives
those drives will not be recognized as raid member. This
patch adds checking for IMSM signature for 4Kn drives.

Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
2016-07-01 13:40:11 +02:00
Torsten Hilbrich ac681a310c liblkid: Add length check in probe_nilfs2 before crc32
The bytes variable is read from the file system to probe and must be
checked before used as length parameter in the crc32 call.

The following problems may occur here:

- bytes smaller than sumoff + 4: underflow in length calculation
- bytes larger than remaining space in sb: overflow of buffer

This fixes a problem where an encrypted volume had the correct magic
values 0x3434 at offset 0x406 and the following uint16_t (which is
read into the nilfs_super_block.s_bytes struct) was parsed as 1.

Then crc32 was called with the length value 18446744073709551597
causing a segmentation fault.

[kzak@redhat.com: - fix probe_nilfs2() return code]

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-06-24 11:13:24 +02:00
Karel Zak 7f787ced5d libblkid: don't check nonnull attributes for NULL [-Wnonnull-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-06-14 14:39:16 +02:00
Sebastian Rasmussen 9e93004171 misc: Fix various typos
Fix various typos in error messages, warnings, debug strings,
comments and names of static functions.

Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
2016-05-31 23:40:21 +02:00
Sebastian Rasmussen d35df4db5b docs: Fix various typos
Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
2016-05-31 23:40:21 +02:00
Karel Zak 924c93d9df libblkid: store only canonical devnames to the cache
Let's try to use symlink:

 # ls -la /dev/block/8\:1
 # lrwxrwxrwx 1 root root 7 May 25 16:42 /dev/block/8:1 -> ../sda1

 # blkid /dev/block/8:1
 /dev/block/8:3: LABEL="HOME" UUID="196972ad-3b13-4bba-ac54-4cb3f7b409a4" TYPE="ext4" PARTUUID="6073277f-87bc-43ff-bcfd-724c4484a63a"

unfortunately the symlink is stored to the cache:

 <device DEVNO="0x0803" TIME="1464253300.715279" LABEL="HOME" UUID="196972ad-3b13-4bba-ac54-4cb3f7b409a4" TYPE="ext4" PARTUUID="6073277f-87bc-43ff-bcfd-724c4484a63a">/dev/block/8:3</device>

next time if you ask for LABEL=HOME the answer will be /dev/block/8:3
rather than /dev/sda3.

It seems better to canonicalize the paths we store to the cache.

Unfortunately if you ask for /dev/block/8:3 then you probably expect
that blkid_dev_devname() returns the same path. This patch introduces
dev->bid_xname, this is the path used by application (and never stored
in the cache).

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1332779
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-05-26 12:15:26 +02:00
Karel Zak 14308bc3f2 libblkid: improve debug messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-05-25 15:06:22 +02:00
Karel Zak 55ad13c26f libblkid: make I/O errors on CDROMs non-fatal
It seems too tricky to get a real size of the data track on hybrid
disks with audio+data. It seems overkill to analyze all header in
libblkid and on some disks it's probably possible to get I/O error
almost everywhere due to crazy copy protection etc.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-04-28 13:54:01 +02:00
Karel Zak 6548ac6aa7 Revert "libblkid: check for multi-session CDROMs"
This reverts commit a14cc9a504.

We need a better way (probably analyze track ioctls CDROMREADTOCHDR
and CDROMREADTOCENTRY) to get also proper track size.

The original patch works only if data track is the last track.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-04-27 18:49:36 +02:00
Karel Zak a14cc9a504 libblkid: check for multi-session CDROMs
.. and read last session if probing offset is not specified.

udev uses cdrom_id to get last session offset, so people don't see a
problem with hybrid media (audio+data), but if you execute blkid on
command line (without -O <offset>) then you get I/O errors.

It seems that we can use the same way as kernel filesystem iso9960
driver when session= mount option is not specified ... just use
CDROMMULTISESSION ioctl to get last session offset and probe this last
session rather than all medium.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-04-27 14:18:41 +02:00
Karel Zak 1bd62f72d8 libblkid: fix mistake in debug message
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-04-19 12:45:00 +02:00
Karel Zak bfebe74e3b libblkid: reduce probing area for crazy CDROMs
Linux kernel reports devices greater than area readable by read(2).
The readable area is usually 2-3 CD blocks smaller (CD block is
2048-bytes) than size returned by BLKGETSIZE. This patch checks for
this issues to avoid I/O errors in probing functions.

Reported-by: Thomas Schmitt <scdbackup@gmx.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-04-19 12:39:05 +02:00
Petr Uzel 445e6b1ec8 libblkid: make blkid_do_wipe() work with probes with offset
When a probe is created with an offset, e.g. via
blkid_probe_set_device(), this offset is correctly used when looking for
the signatures, but is not respected by blkid_do_wipe() function.
Therefore the signature is removed from an invalid location.

Usecase: Wiping signatures from an area on the block device where
partition is to be created (but as it does not exist yet, there's no
device node for it and probe on the whole block device has to be used
with correct offset and length).

Reproducer:
======================== wiper.c ===========================

const char *dev;
unsigned long offset;
unsigned long size;

int main(int argc, char** argv) {

        if (argc != 4) {
                printf("usage: wiper dev offset size\n");
                exit(1);
        }

        dev = argv[1];
        offset = strtoull(argv[2], NULL, 10);
        size = strtoull(argv[3], NULL, 10);

        printf("dev=%s, off=%llu, size=%llu\n", dev, offset, size);

        int fd = open (dev, O_RDWR);
        if (fd == -1) {
                perror("open");
                exit(1);
        }

        blkid_loff_t wipe_offset = offset * SECTOR_SIZE;
        blkid_loff_t wipe_size = size * SECTOR_SIZE;

        int ret;

        blkid_probe pr;
        pr = blkid_new_probe();
        if (!pr)
                return 0;
        ret = blkid_probe_set_device(pr, fd, wipe_offset, wipe_size);
        ret = blkid_probe_enable_superblocks(pr, 1);
        ret = blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_MAGIC);

        while (blkid_do_probe(pr) == 0) {
                ret = blkid_do_wipe(pr, 0);
        }

        blkid_free_probe(pr);
        close(fd);
}
======================== wiper.c ===========================

Steps to reproduce:
modprobe scsi_debug
parted -s /dev/sdX mklabel gpt
parted -s /dev/sdX mkpart first 2048s 4095s
mkfs.ext2 /dev/sdX1

wipefs -np /dev/sdX1

./wiper /dev/sdX1 2048 2048

Actual result: wiper gets into endless loop, because
blkid_do_wipe() wipes at wrong location (1080), leaving the signature
on /dev/sdc1. So it is again found by blkid_do_probe(), and so on.

Expected result: wiper clears the ext2 signature at offset 1049656(=1080+2048*512).

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2016-04-18 19:53:51 +02:00
Karel Zak e04f386084 libblkid: revert mmap usage
The implementation has not been ready for I/O errors and it seems that
there is no elegant way how to resolve this issue. Linux returns
SIGBUS on mmap errors and play with signals (or longjumps) in shared
library is really bad idea.

It also seems that mmaped devices have some unexpected side-effects
with page-cache where for example dd returns old data for already
modified device etc.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-03-30 14:53:33 +02:00
Kent Overstreet 7ce27dc517 libblkid: Update for newer bcache superblocks
Later version of bcache add different checksum types, and allow for superblocks
greater than 4k - skipping the checksum check (as in most other probes) is the
easiest solution.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2016-03-23 10:52:38 +01:00
Ruediger Meier 18336d16d9 build-sys: use AC_PROG_MKDIR_P and remove a few gnuisms
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-13 21:48:09 +01:00
Karel Zak 5bb1d22e8a build-sys: fix if..endif for *_la_LDFLAGS
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-03-10 13:54:15 +01:00
Karel Zak 8f6a58efde misc: avoid shadowing
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-03-09 12:00:52 +01:00
Karel Zak 3fe3f560b7 Revert "include sysmacros.h where used"
This reverts commit 46a40c0184.
2016-03-08 14:26:33 +01:00
Mike Frysinger 46a40c0184 include sysmacros.h where used
BSD/Linux systems stick major/minor/makedev in sysmacros.h.  Newer Linux
libraries have been moving away from including sysmacros.h implicitly via
sys/types.h, so include it directly.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2016-03-08 14:21:55 +01:00
Ruediger Meier fea1cbf748 misc: never cast void* from malloc(3) and friends
Such cast could hide serious compiler warnings in case we are
missing includes (e.g. <stdlib.h> or "xalloc.h").

See
http://stackoverflow.com/questions/605845/do-i-cast-the-result-of-malloc

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-07 23:29:27 +01:00
Ruediger Meier fdbd7bb940 misc: again fixing many printf format strings
This is again a huge patch regarding printf format strings to
fix compiler warnings seen on clang/OSX.

I'm trying to follow these rules strictly:

 #type      #format   #cast
 uintmax_t   %ju      -
 intmax_t    %jd      -
 uint64_t    PRIu64   -
 int64_t     PRId64   -
 size_t      %zu      -
 ssize_t     %zd      -
 ino_t       %ju      (uintmax_t)
 off_t       %jd      (intmax_t)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-07 23:16:04 +01:00
Ruediger Meier 2208b3ccb2 lib: remove openat fallback functions (include/at.h)
I have validated that we are still compatible at least back to
  - openSUSE 11.4
  - SLE 11
  - RHEL/CentOS 6
  - OSX 10.10.x, (Xcode 6.3)
  - FreeBSD 10.2

Confirmed incompatibility:
  - OSX 10.9.x, (Xcode 6.2)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-07 15:33:56 +01:00
Ruediger Meier 4d751c008e lib: provide fallback if mkostemp(3) missing
It's missing on OSX.

CC: Yuriy M. Kaminskiy <yumkam@gmail.com>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-29 13:05:18 +01:00
Ruediger Meier b9710f1f08 misc: fix compiler warnungs (unsigned/signed)
These ones should be fixed:
libblkid/src/probe.c:393:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/probe.c:907:25: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libblkid/src/probe.c:1221:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:540:47: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:1043:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:1056:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:1057:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:1061:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/partitions/partitions.c:1199:27: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libblkid/src/partitions/partitions.c:1410:26: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libblkid/src/partitions/partitions.c:1431:25: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libblkid/src/superblocks/linux_raid.c:151:8: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
libblkid/src/superblocks/linux_raid.c:155:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
libblkid/src/superblocks/superblocks.c:375:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libblkid/src/superblocks/xfs.c:141:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libsmartcols/src/table.c:333:24: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libsmartcols/src/table.c:344:25: warning: signed and unsigned type in conditional expression [-Wsign-compare]
libsmartcols/src/table_print.c:753:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/ask.c:364:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/utils.c:33:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/context.c:435:56: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/context.c:730:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/script.c:557:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/dos.c:1791:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libfdisk/src/gpt.c:813:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
disk-utils/partx.c:140:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
disk-utils/partx.c:551:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
disk-utils/partx.c:640:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 03:18:27 +01:00
Ruediger Meier 71177ab8f9 misc: fix warnings "unused parameter" [-Wunused-parameter]
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 03:18:24 +01:00
Ruediger Meier 5fde1d9f06 tests: fix compiler warnings [-Wmissing-prototypes]
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 03:18:09 +01:00
Ruediger Meier b55b9fccf6 libblkid: fix compiler warnings [-Wmissing-prototypes]
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 01:25:07 +01:00
Ruediger Meier b0b54cc582 build-sys: always add AM_CFLAGS
We were missing our nice compliler warnings for many programs
and libs. See next commits how many trivial and non-trival
warnings have to be fixed.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 01:17:29 +01:00
Ruediger Meier b201f1d86c build-sys: always use global LDADD
This was a major showstopper when building on a system where
LTLIBINTL libs are needed (e.g. OSX). Maybe there are a few test
programs which wouldn't need LDADD ... never mind.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 01:16:58 +01:00
Ruediger Meier a8d4e707e2 libblkid: don't include endian.h
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 16:54:35 +01:00
Ruediger Meier 3719bf8de9 build-sys: check linker support for version scripts
The macro AX_CHECK_VSCRIPT was taken from gnu autoconf archive.
http://www.gnu.org/software/autoconf-archive/

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 12:53:48 +01:00
Ruediger Meier 3fd1f7711e docs: fix typos found by codespell
Using "codespell" from https://github.com/lucasdemarchi/codespell

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-03 15:10:08 +01:00
Boris Egorov 0cd7ecefc5 libblkid: check limits before indexing array [cppcheck]
[libblkid/src/encode.c:165]: (style) Array index 'i' is used before limits check.
2016-01-19 12:59:12 +06:00
Boris Egorov fef0063119 libblkid,libmount: Do not use void* in calculations [cppcheck]
[libblkid/src/superblocks/zfs.c:179]: (portability) 'label' is of type 'const void *'. When using void pointers in calculations, the behaviour is undefined.
[libblkid/src/superblocks/zfs.c:237]: (portability) 'label' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.
[libblkid/src/topology/topology.c:221]: (portability) 'chn.data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.
[libmount/src/fs.c:153]: (portability) 'old' is of type 'const void *'. When using void pointers in calculations, the behaviour is undefined.
[libmount/src/fs.c:154]: (portability) 'new' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.
2016-01-19 12:59:12 +06:00
Boris Egorov 18b76be61c libblkid: (zfs) add cast to fix UB [cppcheck]
[libblkid/src/superblocks/zfs.c:173]: (error) Shifting 32-bit value by 56 bits is undefined behaviour
[libblkid/src/superblocks/zfs.c:173]: (error) Shifting 32-bit value by 40 bits is undefined behaviour
2016-01-19 11:41:37 +06:00
Karel Zak 7675d69d01 libblkid: make minix prober more robust
It seems that the current minix probing code is not robust enough and
it returns false positive for Fedora f24 install images. The crazy thing
is that the image pass also all Linux kernel minix_fill_super() checks
and mount(2) fails later when it tries to read filesystem root
directory.

The fsck.minix requires sb->s_log_zone_size to be zero (Linux kernel
does not care about it), let's use the same requirement for libblkid.

Note, it would be possible to check minix root directory inode in
libblkid, but this solution requires minix prober specific seek &
read. We want to avoid extra read operations...

References: https://bugzilla.redhat.com/show_bug.cgi?id=1299255
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-18 14:47:40 +01:00
Karel Zak f12cd8d1e9 libblkid: use internally uint64_t for offsets and sizes
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-12 18:42:10 +01:00
Karel Zak 28a2df8dc0 libblkid: fix buffers mapping on 32bit archs
Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-12-03 12:24:22 +01:00
Karel Zak 710dd49239 blkid: don't mark zfs as RAID
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-11-18 11:55:35 +01:00
Karel Zak 4546fd398f Revert "libblkid: support LSI RAID on partition too"
This reverts commit bc9007c372.

We need a better way, it seems that the original report is mostly
about udev rules disadvantages than about libblkid bug. See RH
bugzilla (#1172510) for more details.
2015-10-15 12:04:35 +02:00
Karel Zak d5b7d2912a libblkid: make XFS Log visible for wipefs
Reported-by: Peter Rajnoha <prajnoha@redhat.com>
Signed-off-by: root <root@ws.net.home>
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-10-13 12:02:17 +02:00
Karel Zak bc9007c372 libblkid: support LSI RAID on partition too
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1172510
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-10-13 10:55:47 +02:00
Karel Zak 2355dd6a49 libblkid: add read() based fallback for char (UBI) devs
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-09-24 11:10:09 +02:00
Karel Zak a674a0ab03 libblkid: use mmap() rather than read()
diff between
	perf stat -e 'syscalls:sys_enter_*'
for old and new version:

-                35      syscalls:sys_enter_lseek
-                38      syscalls:sys_enter_read
+                 3      syscalls:sys_enter_read
...
-                19      syscalls:sys_enter_mmap
+                17      syscalls:sys_enter_mmap

-       0.001083084 seconds time elapsed
+       0.000751722 seconds time elapsed

The patch dramatically reduces malloc()+seek()+read() operations in
libblkid. The code mmaps ~2MiB of the begin and the end of the device
and it moves buffers management to kernel.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-09-24 11:10:09 +02:00
Karel Zak 9325a8be9e libblkid: (zfs) keep bufferes read-only
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-09-24 11:10:09 +02:00
Karel Zak 6b86ef4a6a libblkid: (promise raid) cleanup code
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-09-24 11:10:09 +02:00
Karel Zak 7020de0be8 lib/crc32: don't require to modify GPT header
This patch introduces smart crc32 function that is able to exclude
specified. The advantage is that we does not have to modify GPT header
(set the current in-header crc field to zero) when we count crc32.

This allows to keep GPT header in read-only buffers and simplify code.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-09-24 09:26:42 +02:00
Karel Zak 7caa6b37be libblkid: use 'VERSION' rather than 'PERSISTENCE_VERSION'
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-08-31 13:23:55 +02:00
Karel Zak 7430affdd9 libblkid: (drbdmanage) improve version setting code
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-08-31 11:49:45 +02:00
Karel Zak 1198e39051 libblkid: (drbdmanage) add magic strings array terminator
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-08-27 11:07:39 +02:00
Philipp Marek 2dc8cfb9a8 libblkid: added drbdmanage control volume detection.
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-08-24 11:01:34 +02:00
Karel Zak 2bf68c9334 libblkid: fix inconsistent indenting [smatch scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-08-05 12:48:54 +02:00
Karel Zak e97c021472 libblkid: remove dead code [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-08-04 12:31:39 +02:00
Boris Egorov 7508d991c5 libblkid/whereis: simplify some conditions [cppcheck]
[misc-utils/whereis.c:466]: (style) Redundant condition: uflag.
'A && (!A || B)' is equivalent to 'A || B'
[libblkid/src/tag.c:373]: (style) Redundant condition: dev.
'A && (!A || B)' is equivalent to 'A || B'

Signed-off-by: Boris Egorov <egorov@linux.com>
2015-06-25 12:08:50 +02:00
Karel Zak 85ccc1d425 libblkid: (nilfs2) check size for backup superblock only
The size of the device seems irrelevant for the primary superblock.
The primary superblock is stored on fixed offset, possible collision
between last partition and whole-disk is possible only for backup
superblock only.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-09 16:01:16 +02:00
Karel Zak 00817742ce libblkid: (nilfs2) check devise size
Unfortunately, nilfs2 have the same problem like many RAIDs. It uses
the end of the device to store (backup) superblock. The end of the
last partition is the same location as the end of the whole-disk. It
means that the superblock seems valid for the last partitions as well
as for whole-device.

Fortunately, nilfs2 superblock contains size of the device, so we can
distinguish between whole-disk and partition device.

Reported-by: Heinz Diehl <htd+ml@fritha.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-06-09 10:37:11 +02:00
Karel Zak d5dbd57b22 docs: fix gtk-docs related warnings
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-05-28 12:28:23 +02:00
Karel Zak 6c62abc42b lib/sysfs: rename devname functions, cleanup
Well, I don't have mental power to use function names like

 sysfs_devname_to_dev_name()

so this patch renames to

 sysfs_devname_sys_to_dev()
 sysfs_devname_dev_to_sys()

It also cleanups usage of the functions. We have to be sure that
sysfs.c code returns regular devnames. The existence of the sysfs
devnames (with '!') should be completely hidden in sysfs specific
code.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-05-28 12:09:41 +02:00
Stanislav Brabec d0dc6c17c5 Fix /sys to /dev node name translation
linux/drivers/base/core.c: device_get_devnode() defines a translation of
'!' in sysfs nodes to '/' in /dev nodes. The same translation has to be
done to properly support device nodes with slash (e. g. device nodes of
cciss driver and several other drivers).

Introduce new helper sysfs_devname_to_devno() and use it where
appropriate.

Fixes for example lsblk -f on devices using cciss driver.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2015-05-26 11:42:38 +02:00
Sami Kerola cf92286084 libblkid: fix compiler warnings
warning: extra ';' outside of a function [-Wextra-semi]

warning: embedding a directive within macro arguments has undefined
behavior [-Wembedded-directive]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-03-16 23:43:24 +00:00
Karel Zak 0487bcb1a3 libblkid: fix compiler warning [-Wunused-variable]
libblkid/src/superblocks/zfs.c: In function 'probe_zfs':
libblkid/src/superblocks/zfs.c:199:11: warning: unused variable 'swab_magic' [-Wunused-variable]

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-03-06 10:57:12 +01:00
Michal Humpula e44a4c7ac9 zfs: make less syscalls 2015-02-28 21:19:42 +01:00
Michal Humpula 5dd705ba65 blkid: make zfs detection more robust
Try to use all the possible uberblock locations.
2015-02-25 20:25:07 +01:00
Karel Zak af17d349fc libblkid: cleanup names, don't copy probing results
* cleanup function and variable names (s/vals/values/)
* in "safe probe" mode libblkid copies probing result from the first
  attempt, this is unnecessary, with values list we can just move
  values to another list rather than copy all.
* add new debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-02-24 10:24:15 +01:00
Ondrej Oprala 6c4a7811f8 libblkid: make probing data structures more dynamic
* replace static probing result array with list
* use allocated buffers for probing result variables

[kzak@redhat.com: - rename some functions
                  - clean up \0 terminator usage in variables
                  - remove never used code to convert UUID to lower-case
                  - remove possible memory leaks on errors]

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-02-24 10:22:37 +01:00
Karel Zak 703bf3535d libblkid: set SBMAGIC for nilfs2
Reported-by: Mike Fleetwood <mike.fleetwood@googlemail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-02-19 11:33:39 +01:00
Karel Zak 6a7857d247 libblkid: (hfs) avoid overflow [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-28 15:02:41 +01:00
Karel Zak d655ceac78 libblkid: fix macro redefinition [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-28 14:57:53 +01:00
Karel Zak aaa0ba88b4 libblkid: improve MBR vs. FAT + boot sector detection
It seems that some systems are able to produce boot sector + MBR with
almost valid FAT superblock. The libblkid already checks for FAT magic
string, media, correct sector and dir size, etc. -- but all this is
not enough.

The patch add to FAT prober also MBR detection to make sure that there
is no MBR with usable first partition. All this is enabled for
whole-disk devices only.

first sector (and this is no FAT baby ;-)

$ hexdump -C -n 512 /dev/nbd0
00000000  eb 58 90 4d 53 44 4f 53  35 2e 30 00 02 10 16 10  |.X.MSDOS5.0.....|
00000010  02 00 00 00 00 f8 00 00  3f 00 ff 00 00 00 00 00  |........?.......|
00000020  00 00 40 01 f5 27 00 00  00 00 00 00 02 00 00 00  |..@..'..........|
00000030  01 00 06 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000040  80 01 29 c5 a3 06 1a 4e  4f 20 4e 41 4d 45 20 20  |..)....NO NAME  |
00000050  20 20 46 41 54 33 32 20  20 20 33 c9 8e d1 bc f4  |  FAT32   3.....|
00000060  7b 8e c1 8e d9 bd 00 7c  88 56 40 88 4e 02 8a 56  |{......|.V@.N..V|
00000070  40 b4 41 bb aa 55 cd 13  72 10 81 fb 55 aa 75 0a  |@.A..U..r...U.u.|
00000080  f6 c1 01 74 05 fe 46 02  eb 2d 8a 56 40 b4 08 cd  |...t..F..-.V@...|
00000090  13 73 05 b9 ff ff 8a f1  66 0f b6 c6 40 66 0f b6  |.s......f...@f..|
000000a0  d1 80 e2 3f f7 e2 86 cd  c0 ed 06 41 66 0f b7 c9  |...?.......Af...|
000000b0  66 f7 e1 66 89 46 f8 83  7e 16 00 75 39 83 7e 2a  |f..f.F..~..u9.~*|
000000c0  00 77 33 66 8b 46 1c 66  83 c0 0c bb 00 80 b9 01  |.w3f.F.f........|
000000d0  00 e8 2c 00 e9 a8 03 a1  f8 7d 80 c4 7c 8b f0 ac  |..,......}..|...|
000000e0  84 c0 74 17 3c ff 74 09  b4 0e bb 07 00 cd 10 eb  |..t.<.t.........|
000000f0  ee a1 fa 7d eb e4 a1 7d  80 eb df 98 cd 16 cd 19  |...}...}........|
00000100  66 60 80 7e 02 00 0f 84  20 00 66 6a 00 66 50 06  |f`.~.... .fj.fP.|
00000110  53 66 68 10 00 01 00 b4  42 8a 56 40 8b f4 cd 13  |Sfh.....B.V@....|
00000120  66 58 66 58 66 58 66 58  eb 33 66 3b 46 f8 72 03  |fXfXfXfX.3f;F.r.|
00000130  f9 eb 2a 66 33 d2 66 0f  b7 4e 18 66 f7 f1 fe c2  |..*f3.f..N.f....|
00000140  8a ca 66 8b d0 66 c1 ea  10 f7 76 1a 86 d6 8a 56  |..f..f....v....V|
00000150  40 8a e8 c0 e4 06 0a cc  b8 01 02 cd 13 66 61 0f  |@............fa.|
00000160  82 74 ff 81 c3 00 02 66  40 49 75 94 c3 42 4f 4f  |.t.....f@Iu..BOO|
00000170  54 4d 47 52 20 20 20 20  00 00 00 00 00 00 00 00  |TMGR    ........|
00000180  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001a0  00 00 00 00 00 00 00 00  00 00 00 00 0d 0a 44 69  |..............Di|
000001b0  73 6b 20 65 72 72 6f 72  ff 0d 0a 50 72 65 00 00  |sk error...Pre..|
000001c0  01 01 0c 3f e0 ff 00 08  00 00 00 f8 3f 01 00 00  |...?........?...|
000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|

MBR:
$ hexdump -C -s 446 -n $((512 - 446)) /dev/nbd0
000001be  00 00 01 01 0c 3f e0 ff  00 08 00 00 00 f8 3f 01  |.....?........?.|
000001ce  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001fe  55 aa                                             |U.|

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1182831
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-27 13:09:27 +01:00
Karel Zak 861b11d5e2 libblkid: (bcache) fix keys usage
References: http://bugs.debian.org/775374
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-15 11:58:08 +01:00
Karel Zak 325165d0c3 libblkid: fix compiler warnings [-Wpointer-sign]
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-01-13 13:40:25 +01:00
Karel Zak 3d9644f30d Merge branch '2015wk01' of https://github.com/kerolasa/lelux-utiliteetit
* '2015wk01' of https://github.com/kerolasa/lelux-utiliteetit:
  eject: add verbosity to cdrom door lock error
  libblkid: assume strtoull() is available
  ipcs: remove FIXME markup
  ul: remove unexplained TERM=lpr override
  look: remove dead code
  docs: make tools/checkmans.sh to pass without warnings
  build-sys: fix make checkincludes warnings
  docs: add howto-pull-request.txt
  docs: small improvements to howto-contribute.txt

Conflicts:
	Documentation/howto-pull-request.txt
2015-01-08 14:53:01 +01:00
Sami Kerola 9385a11d8d libblkid: assume strtoull() is available
The strtoull() is part of ISO/IEC 9899:1999 (aka C99) and the function
has been happily used in prlimit(1) since 2011-10-19 without anyone
complaining compatibility issues.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/strtoul.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-07 22:05:43 +00:00
Pali Rohár 2f2730bc77 libblkid: udf: Fix reading LABEL, add support for UUID and other udf identifiers 2014-12-15 18:28:42 +01:00
Pali Rohár 1e9d4d4ab6 libblkid: superblocks: Add function blkid_probe_set_utf8_id_label for setting utf8 id label 2014-12-15 16:31:18 +01:00
Sebastian Krahmer 109df14fad libblkid: fix potential bufer overflows
While digging deeper into libblk probing, I found that some
computations might wrap and allocate too few buffer space which then
overflows. In particular on 32bit systems (chromebook) where size_t is
32bit, this is problematic (for 64bit the result fits into the calloc
size_t).

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-12-05 11:37:05 +01:00
Karel Zak 89e90ae7b2 libblkid: care about unsafe chars in cache
The high-level libblkid API uses /run/blkid/blkid.tab cache to
store probing results. The cache format is

   <device NAME="value" ...>devname</device>

and unfortunately the cache code does not escape quotation marks:

   # mkfs.ext4 -L 'AAA"BBB'

   # cat /run/blkid/blkid.tab
   ...
   <device ... LABEL="AAA"BBB" ...>/dev/sdb1</device>

such string is later incorrectly parsed and blkid(8) returns
nonsenses. And for use-cases like

   # eval $(blkid -o export /dev/sdb1)

it's also insecure.

Note that mount, udevd and blkid -p are based on low-level libblkid
API, it bypass the cache and directly read data from the devices.

The current udevd upstream does not depend on blkid(8) output at all,
it's directly linked with the library and all unsafe chars are encoded by
\x<hex> notation.

   # mkfs.ext4 -L 'X"`/tmp/foo` "' /dev/sdb1
   # udevadm info --export-db | grep LABEL
   ...
   E: ID_FS_LABEL=X__/tmp/foo___
   E: ID_FS_LABEL_ENC=X\x22\x60\x2ftmp\x2ffoo\x60\x20\x22

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-27 13:39:35 +01:00
Karel Zak adc9f78cfc build-sys: cleanup library symbol files
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-20 14:01:03 +01:00
Boris Egorov ad1ac445da libblkid: (nilfs) fix typo
Signed-off-by: Boris Egorov <egorov@linux.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-13 15:10:22 +01:00
Karel Zak b7da851e5a libblkid: clean up debug, add "help" debug mask
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-03 13:12:20 +01:00
Karel Zak 819d9a2975 include/debug: fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-24 11:19:23 +02:00
Karel Zak 00749bc366 libblkid: zeroize errno on blkid_probe_get_buffer() success
Since 37f4060225 prober functions are
sensitive to errno, it seems more robust to set errno=0 with in
blkid_probe_get_buffer() on success than set the zero on all places
where we call blkid_probe_get_buffer().

Addresses: https://github.com/karelzak/util-linux/issues/119
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-10-07 12:44:34 +02:00
Karel Zak 22e9e9c8e9 libblkid: move string trim function to strutils.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-25 15:31:53 +02:00
Karel Zak 03e4220d29 include/debug: cleanup masks
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-13 14:13:32 +02:00
Ondrej Oprala 14ad2353cc libs/debug: accept human readable names for _DEBUG=
For example
	$ LIBMOUNT_DEBUG=tab,cache findmnt

to debug only TAB and CACHE subsystem.

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-13 12:33:47 +02:00
Karel Zak 413b91d190 libblkid: (gpt) fix PT offset
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-11 15:59:04 +02:00
Karel Zak 8d8a02398a libblkid: (gpt) use real sector size to set PTMAGIC_OFFSET
So stupid and 5 years old bug...

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-08 11:57:19 +02:00
Karel Zak f9953bbaa2 libblkid: comparing an array to null is not useful [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-17 14:20:03 +02:00
Karel Zak f3438ee801 libblkid: fix probe_ddf() [clang-analyze]
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-01 12:32:25 +02:00
David Shea cbccd7a4f8 libblkid: correct the return values in squashfs probe
Returning -1 can cause squashfs v3 detection to make v4 detection fail.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-24 10:54:48 +02:00
Karel Zak 25472aaf94 libblkid: fix compiler warning [-Wimplicit-function-declaration]
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-18 11:27:39 +02:00
Karel Zak 39866431ee lib/sysfs: add sysfs_devno_is_lvm_private() from libblkid
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-17 11:20:32 +02:00
Thomas Petazzoni 6e90f2b479 Only move shared libraries to /lib if they exists
In several Makemodule.am, there is a install-exec-hook-<library>
target whose role is to move the shared library from /usr/lib to /lib,
while keeping a symbolic link /usr/lib/libuuid.so ->
../../lib/<library>.so.<version>.

However, when util-linux is built with --enable-static
--disable-shared (as is needed on noMMU platforms that don't support
shared libraries), no <library>.so is built, but the
install-exec-hook-libuuid creates an invalid /usr/lib/<library>.so
symbolic link, pointing to ../../lib (yes, the directory). This causes
troubles later one when other libraries/programs are compiled with
-l<library>, as gcc thinks a shared library is available because
there's a file named /usr/lib/<library>.so.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-06-16 14:53:09 +02:00
Karel Zak d2a8b8d145 libblkid: cleanup internal return codes
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-10 13:32:02 +02:00
Karel Zak 20e1c3dc03 libblkid: ignore private LVM devices
The virtual private LVM devices do not contain any blkid relevant data
and it does not make any sense to scan for superblocks or partitions
on the devices, because we can interpret data from the devices in bad
way.

Unfortunately, for LVM has "private" very special meaning. The private
LVM devices are accessible and readable (according to LVM guys it's
feature, because debugging etc.).

The problem is pretty visible with LVM thin provisioning where a virtual
pool device contains segments from the top-level thin devices.

Mountable top-level LVM-thin device:

	# blkid -o udev -p /dev/mapper/vg-thin1
	ID_FS_UUID=57ed6490-903b-416c-91d2-6d06804ec60c
	ID_FS_TYPE=ext4

Virtual private LVM-pool device (contains data from all thin devices):

	# blkid -o udev -p /dev/mapper/vg-pool0
	ID_FS_UUID=57ed6490-903b-416c-91d2-6d06804ec60c
	ID_FS_TYPE=ext4

... this is incorrect, vg-pool0 is unmountable.

LVM uses special UUID suffixes for private devices. All devices with
uuid in format "LVM-<uuid>-<type>" are private.

This patch modifies libblkid to not scan such devices. The high-level
API ignores such devices at all now.

The low-level API allows to assign the device to blkid_prober, but all
scan functions always return nothing and library does not read
anything from the device. The another functionality (get parental
device, topology, sector sizes, etc.) still works as expected. The
change affects only probing code.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1101345
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-10 12:16:59 +02:00
Karel Zak ee312c654b docs: fix "behaviour" vs. "behavior"
Sometimes we use "behaviour" and "behavior" in the same text, let's
use "behavior" only everywhere.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1011068
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-06 09:49:35 +02:00
Karel Zak 7a1c36ab38 docs: rename libs xml/version.xml to xml/version-utils.xml
It seems that gtk-docs stuff is confused when we use version.xml
(package version) and xml/version.xml (library version functions).

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-06-03 12:37:33 +02:00
Karel Zak 59cbbd71cd libblkid: (zfs) let's keep compiler happy
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-30 11:27:41 +02:00
Karel Zak 574528ed40 Merge branch 'fix-build-sys' of https://github.com/rudimeier/util-linux 2014-05-26 12:52:18 +02:00
Ruediger Meier 11402f5e0d libblkid: detect squashfs 3 vs 4
Detect squashfs version <= 3 as squashfs3 and version >= 4 as squashfs.

squashfs kernel module version 4.0 (kernel 2.6.29) is not backward
compatible to open squashfs created with previous versions.

Also fixed version number parsing, see
$  mkdir test
$  mksquashfs test test.sqsh
$  blkid -p test.sqsh
- test.sqsh: VERSION="1024.0" TYPE="squashfs" USAGE="filesystem"
+ test.sqsh: VERSION="4.0" TYPE="squashfs" USAGE="filesystem"

This patch comes from openSUSE / SLE. Original author was probably
Miklos Szeredi.
Internal SUSE references: bnc#666893, sr226509

CC: Stanislav Brabec <sbrabec@suse.cz>
CC: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-26 12:00:44 +02:00
Ruediger Meier 0f918ac197 build-sys: fix typo, sparc vs spark (62b2c024)
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-23 15:17:01 +00:00
Bjarni Ingi Gislason c6f285fcb3 libblkid/libblkid.3: Improve the typsetting of the manual
Correct space between sentences to two space characters
 (or begin each sentence on a new line).

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2014-05-06 11:28:53 +02:00
Karel Zak 8a2c2dab26 libblkid: make new_partition() more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-18 12:01:42 +02:00
Karel Zak a61618987a libblkid: fix return codes from PART_ENTRY_* probing
The partitions prober does two step:

1) probe the assigned device for partition table

2) probe whole-disk device for partition table if the assigned device is a
   partition (this generates PART_ENTRY_* results for blkid -p -o udev))

The step 2) is optional and the return code from this probing should
not override success (rc=0) from the step 1) -- except situations when
the step 2) ends with I/O error or when the step 1) found nothing, but
2) was successful.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-15 13:09:20 +02:00
Karel Zak 8d0ce083b1 libblkid: remove private function from docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-07 13:27:24 +02:00
Karel Zak 1024dd6acb build-sys: fix .h.in usage in libblkid and libmount
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-07 13:26:56 +02:00
Karel Zak 5b575d4381 libblkid: fix partitions probing
* PART_ENTRY_* stuff is optional and should not overwrite
   previous probing result in partitions_probe()

 * missing minix parental partition is not error

 * blkid_probe_is_vfat() usage has to be more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-28 15:07:17 +01:00
Karel Zak c62a6311ee libblkid: use new debug functions
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-21 12:34:50 +01:00
Karel Zak 9a7769141a Merge branch 'common_debug' of https://github.com/ooprala/util-linux
* 'common_debug' of https://github.com/ooprala/util-linux:
  clean up redundant macros and defines
  libfdisk: use include/debug.h
  libblkid: use include/debug.h
  libmount: further debug.h integration
  libcommon: don't mention lib versions in debug macros
  libcommon: define more debugging macros
  libmount: use macros from include/debug.h
  libcommon: add common debugging routines
2014-03-21 10:59:58 +01:00
Hannes Reinecke 37f4060225 blkid: convert superblocks to new calling convention
With the previous patch the scanning functions were
modified to return a differentiated return code.
To correctly abort scanning when an I/O error occurs
we need to differentiate between 'error' (= -1) and
'not found' (= 1) in the probe functions.
This patch updates all superblock scanning functions
to the new calling convention.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-20 15:26:48 +01:00
Hannes Reinecke 296d96e20e blkid: stop scanning on I/O error
Whenever we fail to read from a device it's pointless to
continue with probing; we should be failing immediately.
Otherwise the system will continue logging I/O errors.

This patch updates the probe functions to return the
negative error number on error and BLKID_PROBE_NONE
if not found.

[kzak@redhat.com: - fix s/return errno/return -errno/]

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-20 13:43:40 +01:00
Ondrej Oprala 274228fecc clean up redundant macros and defines
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2014-03-13 11:53:31 +01:00
Ondrej Oprala ed64028665 libblkid: use include/debug.h
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2014-03-13 11:11:10 +01:00
Karel Zak 88e3d03eb8 libblkid: convert GPT attributes to host endianess
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-12 15:09:02 +01:00
Sami Kerola cc93d115de build-sys: sort gitignore files
Use 'LC_ALL=C sort -fu' order for all lists.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-03-12 12:06:37 +01:00
Karel Zak f948a1474f libblkid: improve comment
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-12 09:11:36 +01:00
Karel Zak dbf7043ea1 build-sys: don't connect _DEPENDENCIES and _LIBADD
The _DEPENDENCIES has to be used for dependencies on another in-tree
files, but _LIBADD is to specify additional libs (including external
libs).

Reported-by: oleid <notifications@github.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-05 10:20:10 +01:00
Karel Zak 53e6896ab8 libblkid: add extra checks to XFS prober
The current code rely on XFS magic string only. It seems too fragile.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-19 13:27:56 +01:00
Karel Zak e3c69a7d78 libblkid: detect alone PMBR
wipefs(8) has to also erase PMBR, not GPR header only, otherwise the
device could be still interpreted as a device with a partition table.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1054186
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-20 10:51:00 +01:00
Karel Zak c93c20304c libblkid: no more probe for btrfs backup superblock
* Linux kernel cares about the first superblock only

 * backup superblock are FS specific stuff and there is no reason to
   care about it in generic tools

 * the problem with broken btrfs utils has been already fixed (it was
   possible to use the utils on filesystem with erased primary
   superblok without any warning message).

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-16 16:38:30 +01:00
Karel Zak a3ebe0eca3 libblkid: add blkid_partlist_get_partition_by_partno()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-15 10:52:16 +01:00
Karel Zak 5f77ce6f32 libblkid: (nilfs2) check also backup superblock
* read also backup superblock
* check which superblock is newer
* set minimal device size to 1MiB

Reported-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-13 14:32:06 +01:00
Lukas Czerner a1ca32fb38 libblkid: Identify extN file system properly
Currently when trying to identify extN file system we're playing games
with searching for kernel modules and parsing /proc/filesystem. All of
this just because ext4 module can be used to mount ext3 and ext2 file
systems on recent kernel and also because of ext4dev.

However all of this is not necessary. Ext4 module which does support
mounting ext2 and ext3 file system is able to recognize and mount ext2
and ext3 type so there is no need to disguise it and ext4dev should only
be ever used for testing and not as fallback when other modules are
missing (use -t instead).

This also introduces a bug when in situation that we only have ext4
modules with ext2/ext3 support which is not loaded and we try to mount
ext2 file system we will mount it incorrectly as ext4. This will not
happen if the ext4 module is already loaded.

With this patch we remove all the unnecessary checks and return the real
type of the file system which is on the device. This fixes the issue.
However on the kernel which was not compiled with EXT4_USE_FOR_EXT23
support one would have to provide file system type (-t) to be able to
mount the file system with ext4 driver.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-12-12 11:14:26 +01:00
Karel Zak 4253275490 libblkid: fix sgi PT parser to report system partitions
... to be compatible with Linux kernel.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-11-27 16:55:08 +01:00
Karel Zak c1178175e7 libblkid: fix memory leak in blkid_parse_tag_string()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-11-19 17:52:56 +01:00
Karel Zak 50cb6c0e27 libblkid: fix swap-area version
* v1: hdr->version = 1, magic string = SWAPSPACE2
 * v0: no versio in header, magic string = SWAP-SPACE

The mistake has been introduced in the old udev volume_id
binary where the version was set according to magic string.

Reported-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-11-04 09:59:54 +01:00
Benno Schulenberg e9c58f6d55 COPYING: fix grammar of referring phrase, and indicate location better
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-10-08 15:38:39 +02:00
Karel Zak 3b41176384 libblkid: use proper type in xfs log checker [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-10-01 17:21:12 +02:00
Karel Zak 6ea595d996 libblkid: update docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-27 10:38:47 +02:00
Karel Zak 412d542f6e libblkid: Get rid of an unnecessary check
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-26 09:48:33 +02:00
Karel Zak 30b46e7cb0 libblkid: fix kboff usage in BSD prober
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:05 +02:00
Karel Zak cc3d127e4c libblkid: move bsd definitions to pt-bsd.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:04 +02:00
Karel Zak e8bf93ded2 fdisk: add mbr_get_partition()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:02 +02:00
Karel Zak b44244cb98 fdisk: use functions from pt-mbr.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:02 +02:00
Karel Zak 71ade4da58 libblkid: rename sys_type to sys_ind
This makes struct dos_partition more compatible with the current fdisk
code.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:02 +02:00
Karel Zak f917738efa libblkid: move MBR definitions to include/pt-mbr.h 2013-09-16 16:47:02 +02:00
Karel Zak 7e5f8f3824 libblkid: move MBR partition types to include/
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:58 +02:00
Karel Zak 1c314b3183 libblkid: move SGI disklabel definitions to include/
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:57 +02:00
Karel Zak d88803a4ad libblkid: export info about bad csum
If a bad check sum is detected and BLKID_SUBLKS_BADCSUM is enabled
than SBBADCSUM=1 is added to the probing result.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-11 17:42:48 +02:00
Rolf Fokkens a083b725a1 libblkid: Add bcache support
From https://bugzilla.redhat.com/show_bug.cgi?id=1001120#c11

[kzak@redhat.com: - move crc64 code to lib/ by separate patch,
                  - use BLKID_USAGE_OTHER rather than _RAID]

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-11 17:12:24 +02:00
Gabriel de Perthuis 02f3c12a5f wipefs: Also wipe superblocks with bad checksums
[kzak@redhat.com: - move BLKID_SUBLKS_BADCSUM login to
                    blkid_probe_verify_csum()]

Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-11 16:36:16 +02:00
Karel Zak c89a1defc7 libblkid: use separate function to verify checksums
* consolidate "incorrect checksum" debug messages
 * verify all on one place

Based on patch from Gabriel de Perthuis <g2p.code@gmail.com>

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-11 16:24:56 +02:00
Karel Zak e9b1e01762 libblkid: don't use UUID= for xfs external log
The log UUID is usually the same as filesystem UUID, it is bad idea to
have two devices with the same UUID in the system. It seems batter to
use only LOGUUID= for xfs external log.

 # mkfs.xfs -l logdev=/dev/sdb1 /dev/sdb2

 # blkid -p -o udev /dev/sdb1 | grep FS
 ID_FS_LOGUUID=4063d453-5c01-46ce-b92f-9523d64aecc7
 ID_FS_TYPE=xfs_external_log
 ID_FS_USAGE=other

 # blkid -p -o udev /dev/sdb2 | grep FS
 ID_FS_UUID=4063d453-5c01-46ce-b92f-9523d64aecc7
 ID_FS_TYPE=xfs
 ID_FS_USAGE=filesystem

The filesystem (sdb2) uses UUID= and log (sdb1) uses LOGUUID=.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-11 15:37:05 +02:00
Karel Zak ed5a064d2e libblkid: don't interpret regual XFS as external xfs log
$ blkid -o udev -p tests/output/blkid/images-fs/xfs.img
 ID_FS_AMBIVALENT=filesystem:xfs other:xfs_external_log

it seems that regular XFS with internal log may be interpreted as log
device. This is incorrect.

This patch checks for XFS magic string to avoid this collision.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-11 15:33:26 +02:00
Karel Zak 42d3e81631 libblkid: diffs between errors and failed probing in via raid
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-11 12:57:22 +02:00
Karel Zak 422501ca83 libblkid: diffs between errors and failed probing in silicon raid
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-11 12:54:19 +02:00
Karel Zak 8bd67a19f7 libblkid: populate jbd LOGUUID in addition to UUID
The LOGUUID is alias for UUID, this alias is necessary to standardize
the tag name (we want to use the same tag LOGUUID= for all external
logs on all filesystems).

Note that for another filesystems (e.g. xfs) we have to differentiate
between the journal and filesystem uuids to avoid collisions, because
both devices use the same uuid.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-11 11:15:33 +02:00
Karel Zak c57e6f5208 libblkid: rename UUID_LOG to LOGUUID
* the goal is to make the uuid visible and usable it as mount
   variable/spec, then LOGUUID= seems better than UUID_LOG=

 * we already have PARTUUID=

 * the UUID_RAW and UUID_SUB are not used by mount(8)

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-11 10:40:13 +02:00
Eric Sandeen 0a2002551d libblkid: Detect external XFS log device
Detects external XFS log devices with a minimum size of 10MB.  It's possible to
craft a smaller log, but that would be very unlikely; it'd require a small XFS
filesystem and an intentionally small log, which would defeat the performance
goal of an external log in the first place.

[kzak@redhat.com: - use UUID_LOG variable name for the log uuid]

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-11 10:29:33 +02:00
Karel Zak 03d00d495f build-sys: add CFLAGS and LDFLAGS for daemons and shared libs
This is necessary for paranoid security guys who believe that things
like "-Wl,-z,relro" or "-Wl,-z,bind_now" is a way how to make the
world a safer place...

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-08-27 11:49:01 +02:00
Karel Zak d67cc2889a libblkid: support pseudo PARTUUID= for MBR
# blkid /dev/sdb1
  dev/sdb1: TYPE="ext2" PARTUUID="54e743a7-01"

the PARTUUID is generated from MBR Id and partition number. The same
method uses Linux kernel for root=PARTUUID= on systems with MBR.

Note that the patch also removes 0x prefix from PTUUID.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-06-13 15:16:56 +02:00
Karel Zak 635c0acc1c libblkid: split blkid_parttable_set_id()
to avoid things like strcmp(tab->type, "gpt") in generic code.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-06-13 14:45:36 +02:00
Karel Zak 6e9dfa41f2 libblkid: set PTUUID for GPT and DOS
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-06-13 14:35:34 +02:00
Karel Zak 62e83b1d44 libblkid: add functions to set PTUUID
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-06-13 14:35:05 +02:00
Karel Zak 9c06cdbf61 libblkid: make uuid_is_empty() usable for whole library
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-06-13 14:33:47 +02:00
Karel Zak 84992b8ad6 libblkid: add ReFS magic string
Reported-by: "Richard W.M. Jones" <rjones@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-05-14 15:53:14 +02:00
Mike Frysinger 66083665d5 standard SEE ALSO section of man pages
The standard format is to seperate each entry with a comma, and
for each one to be on a line by itself.  Most util-linux pages
follow this, but a few do not.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-05-13 14:42:59 +02:00
Karel Zak aab691cf8d libblkid: fix blkid_parse_tag_string() to ignore incomplete tags
fstab entry:

    FOO=     /       btrfs  defaults       1 1

Program received signal SIGABRT, Aborted.
0x00007f016ccd8819 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56   return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
(gdb) bt
    at ../sysdeps/unix/sysv/linux/libc_fatal.c:196

Reported-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-05-06 17:20:03 +02:00
Sami Kerola 8d21d9ab8f libblkid: check writing to a file was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-26 13:26:06 +02:00
Karel Zak 7553740c01 libblkid: remove obsolete code
... forgot in the previous commit to the swap prober.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-18 11:56:46 +02:00
Karel Zak c4cc7b4160 libblkid: ubifs is LE
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-18 11:50:56 +02:00
Karel Zak fa86784f14 libblkid: make swap detection arch independent
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-18 11:36:09 +02:00
Karel Zak edb0b73d85 libblkid: use more robust code in silicon_raid checksum prober
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-17 16:17:46 +02:00
Karel Zak 320173e653 libblkid: fix silicon raid checksum code on BE
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-16 13:45:49 +02:00
Karel Zak 09daba4069 libblkid: arch independent minix detection
It seems that on-disk MINIX FS superblock is native-endian.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=833841
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-15 15:14:33 +02:00
Karel Zak 9b3a772463 libblkid: remove duplicate includes
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-10 17:16:28 +02:00
Karel Zak 983a43e08b libblkid: fix ZFS superblok offset for SBMAGIC
# wipefs /dev/sdd1

 offset               type
 ----------------------------------------------------------------
 0x65000              zfs_member   [raid]
                      LABEL: zm1
                      UUID:  18067835215330778964

 and "wipefs -o 0x65000 /dev/sdd1" seems to run in an endless loop.

Reported-by: Helmut Hullen <Hullen@t-online.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-10 15:13:02 +02:00
Karel Zak 310f672874 libblkid: export blkid_init_debug()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-09 13:12:55 +02:00
Karel Zak 35cf827870 libblkid: support LIBBLKID_DEBUG= only
... the BLKID_DEBUG= is not more supported.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-09 12:52:09 +02:00
Karel Zak 76041e708d libblkid: fix DBG()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-09 12:44:02 +02:00
Sami Kerola 604ba9734f libblkid: number of functions should not be declared extern [smatch scan]
These functions are already marked extern in header file.

libblkid/src/dev.c:70:19: warning: function 'blkid_dev_devname' with external linkage has definition
libblkid/src/dev.c:128:26: warning: function 'blkid_dev_iterate_begin' with external linkage has definition
libblkid/src/dev.c:148:12: warning: function 'blkid_dev_set_search' with external linkage has definition
libblkid/src/dev.c:175:12: warning: function 'blkid_dev_next' with external linkage has definition
libblkid/src/dev.c:196:13: warning: function 'blkid_dev_iterate_end' with external linkage has definition
libblkid/src/tag.c:84:12: warning: function 'blkid_dev_has_tag' with external linkage has definition
libblkid/src/tag.c:282:26: warning: function 'blkid_tag_iterate_begin' with external linkage has definition
libblkid/src/tag.c:303:12: warning: function 'blkid_tag_next' with external linkage has definition
libblkid/src/tag.c:322:13: warning: function 'blkid_tag_iterate_end' with external linkage has definition
libblkid/src/tag.c:336:18: warning: function 'blkid_find_dev_with_tag' with external linkage has definition

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-09 12:26:43 +02:00
Sami Kerola 3acc206d39 various: fix variable and function declarations [smatch scan]
disk-utils/fsck.minix.c:511:9: warning: mixing declarations and code
fdisks/sfdisk.c:982:5: warning: mixing declarations and code
fdisks/sfdisk.c:1254:5: warning: mixing declarations and code
fdisks/sfdisk.c:1564:5: warning: mixing declarations and code
lib/mbsalign.c:279:7: warning: mixing declarations and code
libblkid/src/devname.c:378:17: warning: mixing declarations and code
libfdisk/src/alignment.c:219:9: warning: mixing declarations and code
term-utils/wall.c:111:9: warning: mixing declarations and code
text-utils/col.c:418:19: warning: non-ANSI function declaration of function 'flush_blanks'
text-utils/col.c:553:12: warning: non-ANSI function declaration of function 'alloc_line'
text-utils/rev.c:105:9: warning: mixing declarations and code
text-utils/tailf.c:245:9: warning: mixing declarations and code

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-09 12:17:20 +02:00
Karel Zak 0540ea544d libblkid: clean up DBG()
- use stderr only
 - use BLKID_ prefix for debug masks
 - don't use \n in in messages and don't use printf(),
   but use generic blkid_debug().

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-08 18:22:13 +02:00
Karel Zak 4000fc128c libblkid: use O_CLOEXEC
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-03 16:14:15 +02:00
Karel Zak 6acde8a3b1 libblkid: (udf) fix possible null pointer dereference [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27 16:02:07 +01:00
Karel Zak eb542dff6a libblkid: check returns [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27 14:12:37 +01:00
Karel Zak 45b048b340 libblkid: fix NTFS prober on big-endian machines
MFT_RECORD_ATTR_VOLUME_NAME  = cpu_to_le32(0x60),
                                 ^
./include/bitops.h:94:36: error: braced-group within expression
allowed only inside a function

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27 11:37:57 +01:00
Benno Schulenberg 9c91fc03ae docs: make the section AVAILABILITY always come last in man pages
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-03-20 14:09:24 +01:00
Karel Zak 2029dbd9b1 docs: update year
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-15 15:18:22 +01:00
Karel Zak 2bb7a706a1 libblkid: clean up header file
* don't teach people C by header files, so use warn_unused_result
   attribute only on places where we return allocated memory (to avoid
   leaks in applications).

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-15 14:59:02 +01:00