Commit Graph

232 Commits

Author SHA1 Message Date
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