summaryrefslogtreecommitdiffstats
path: root/libblkid
Commit message (Collapse)AuthorAgeFilesLines
* Revert "libblkid: support LSI RAID on partition too"Karel Zak2015-10-151-0/+2
| | | | | | | | This reverts commit bc9007c372765ad4a1c7e1d3d69ba8be800f250f. 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.
* libblkid: make XFS Log visible for wipefsKarel Zak2015-10-131-0/+6
| | | | | | Reported-by: Peter Rajnoha <prajnoha@redhat.com> Signed-off-by: root <root@ws.net.home> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: support LSI RAID on partition tooKarel Zak2015-10-131-2/+0Star
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1172510 Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add read() based fallback for char (UBI) devsKarel Zak2015-09-241-9/+60
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: use mmap() rather than read()Karel Zak2015-09-243-64/+144
| | | | | | | | | | | | | | | | | | | | | | 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>
* libblkid: (zfs) keep bufferes read-onlyKarel Zak2015-09-241-3/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: (promise raid) cleanup codeKarel Zak2015-09-241-4/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/crc32: don't require to modify GPT headerKarel Zak2015-09-241-9/+9
| | | | | | | | | | 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>
* libblkid: use 'VERSION' rather than 'PERSISTENCE_VERSION'Karel Zak2015-08-311-2/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: (drbdmanage) improve version setting codeKarel Zak2015-08-311-9/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: (drbdmanage) add magic strings array terminatorKarel Zak2015-08-271-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: added drbdmanage control volume detection.Philipp Marek2015-08-244-0/+95
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix inconsistent indenting [smatch scan]Karel Zak2015-08-052-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: remove dead code [coverity scan]Karel Zak2015-08-041-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid/whereis: simplify some conditions [cppcheck]Boris Egorov2015-06-251-1/+1
| | | | | | | | | [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>
* libblkid: (nilfs2) check size for backup superblock onlyKarel Zak2015-06-091-4/+5
| | | | | | | | | 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>
* libblkid: (nilfs2) check devise sizeKarel Zak2015-06-091-0/+3
| | | | | | | | | | | | | | 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>
* docs: fix gtk-docs related warningsKarel Zak2015-05-282-3/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: rename devname functions, cleanupKarel Zak2015-05-281-1/+0Star
| | | | | | | | | | | | | | | | | | 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>
* Fix /sys to /dev node name translationStanislav Brabec2015-05-261-0/+1
| | | | | | | | | | | | | | 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>
* libblkid: fix compiler warningsSami Kerola2015-03-172-5/+6
| | | | | | | | | 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>
* libblkid: fix compiler warning [-Wunused-variable]Karel Zak2015-03-061-1/+0Star
| | | | | | | 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>
* zfs: make less syscallsMichal Humpula2015-02-281-37/+58
|
* blkid: make zfs detection more robustMichal Humpula2015-02-251-15/+27
| | | | Try to use all the possible uberblock locations.
* libblkid: cleanup names, don't copy probing resultsKarel Zak2015-02-245-68/+100
| | | | | | | | | | * 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>
* libblkid: make probing data structures more dynamicOndrej Oprala2015-02-245-190/+273
| | | | | | | | | | | | | * 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>
* libblkid: set SBMAGIC for nilfs2Karel Zak2015-02-191-1/+11
| | | | | Reported-by: Mike Fleetwood <mike.fleetwood@googlemail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: (hfs) avoid overflow [coverity scan]Karel Zak2015-01-281-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix macro redefinition [coverity scan]Karel Zak2015-01-281-2/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: improve MBR vs. FAT + boot sector detectionKarel Zak2015-01-272-13/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* libblkid: (bcache) fix keys usageKarel Zak2015-01-151-1/+3
| | | | | References: http://bugs.debian.org/775374 Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix compiler warnings [-Wpointer-sign]Karel Zak2015-01-131-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch '2015wk01' of https://github.com/kerolasa/lelux-utiliteetitKarel Zak2015-01-081-10/+3Star
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * '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
| * libblkid: assume strtoull() is availableSami Kerola2015-01-071-10/+3Star
| | | | | | | | | | | | | | | | | | 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>
* | libblkid: udf: Fix reading LABEL, add support for UUID and other udf identifiersPali Rohár2014-12-151-22/+185
| |
* | libblkid: superblocks: Add function blkid_probe_set_utf8_id_label for ↵Pali Rohár2014-12-152-0/+25
|/ | | | setting utf8 id label
* libblkid: fix potential bufer overflowsSebastian Krahmer2014-12-053-4/+18
| | | | | | | | | | 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>
* libblkid: care about unsafe chars in cacheKarel Zak2014-11-272-4/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* build-sys: cleanup library symbol filesKarel Zak2014-11-202-5/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: (nilfs) fix typoBoris Egorov2014-11-131-1/+1
| | | | | Signed-off-by: Boris Egorov <egorov@linux.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: clean up debug, add "help" debug maskKarel Zak2014-11-033-35/+41
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/debug: fix typoKarel Zak2014-10-241-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: zeroize errno on blkid_probe_get_buffer() successKarel Zak2014-10-071-1/+4
| | | | | | | | | | Since 37f4060225df0591ab8e1dd676dbc8115d900d4f 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>
* libblkid: move string trim function to strutils.hKarel Zak2014-08-251-19/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/debug: cleanup masksKarel Zak2014-08-131-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libs/debug: accept human readable names for _DEBUG=Ondrej Oprala2014-08-131-0/+19
| | | | | | | | | | 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>
* libblkid: (gpt) fix PT offsetKarel Zak2014-08-112-4/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: (gpt) use real sector size to set PTMAGIC_OFFSETKarel Zak2014-08-081-1/+1
| | | | | | So stupid and 5 years old bug... Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: comparing an array to null is not useful [coverity scan]Karel Zak2014-07-171-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix probe_ddf() [clang-analyze]Karel Zak2014-07-011-6/+5Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>