Commit Graph

205 Commits

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