Commit Graph

89 Commits

Author SHA1 Message Date
Karel Zak 49a8f58e48 libblkid: use O_CLOEXEC
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-04 16:49:28 +02:00
Karel Zak 1abde0cdbc libblkid: rewrite ntfs prober
- use regular NTFS bios parameters block
 - don't care about mirror cluster location
 - remove unnecessary macros
 - add more checks (based on Linux kernel code)

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-08-27 17:38:24 +02:00
Karel Zak 7d447a811e libblkid: use unsigned ints in ntfs prober
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-08-27 15:13:41 +02:00
Samuel Thibault 4797b1e592 Fix non-Linux build
loopdev.c, test_pager, and get_max_number_of_cpus() are linux-specific.
get_linux_version will only work on Linux, let's introduce
system_supports_ext4_ext2() which assumes that mounting ext2 with ext4
is not supported on non-Linux systems.

[kzak@redhat.com: - use #ifdef SYS_sched_getaffinity rather than __linux__]

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-08-13 15:14:13 +02:00
Karel Zak 43ffdc82fa build-sys: don't compile lib{mount,blkid} tests when --disable-static specified
The tests often depend on private (non-API) library functions.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-08-02 20:19:14 +02:00
Karel Zak 922e6775e0 build-sys: move tests to check_PROGRAMS
Thanks to Mike Frysinger.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-30 17:59:16 +02:00
Karel Zak 7770e7df15 build-sys: fix build without libs
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-27 09:04:55 +02:00
Sami Kerola 5bd9151079 libblkid: add noreturn function attribute
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-26 13:51:28 +02:00
Karel Zak bd2d882209 libblkid: fix compiler warning [-Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-26 09:41:57 +02:00
Karel Zak c642a6aaae Merge branch '2012wk28'
* 2012wk28:
  translation: unify file open error messages
  translation: unify stat error messages
  utmpdump: use help and version output macros
  su: align with howto-usage-function
  fdisk: make if clause easier to read
  look: remove extra semicolon
  utmpdump: remove unused variable
  swapon: remove unused variables
  lib/loopdev: minor bug fix: add missing semicolon
  lib/pager: minor compiler warning fixes
  libblkid: remove duplicate entries in symbols
2012-07-16 18:19:08 +02:00
Sami Kerola 18377246af libblkid: remove duplicate entries in symbols
The commit a0487b1cb5 added symbol
dublicates.  The symbols should only be listed in BLKID_1.0 segment.

/usr/bin/ld.gold: warning: using 'BLKID_1.0' as version for 'blkid_probe_all' which is also named in version 'BLKID_2.15' in script
/usr/bin/ld.gold: warning: using 'BLKID_1.0' as version for 'blkid_probe_all_new' which is also named in version 'BLKID_2.15' in script
copying selected object files to avoid basename conflicts...

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-16 18:18:21 +02:00
Petr Uzel 44064b3c1f libblkid: cast blkid_loff_t to unsigned long long
Get rid of gcc warning and fix build with -Werror

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-07-16 18:09:22 +02:00
Karel Zak 657d9adb71 fix buffer overrun in some calls to sscanf
Reported-by: Sergei Antonov <saproj@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-09 22:26:27 +02:00
Karel Zak 641e3e2061 libblkid: cleanup _attribute__ usage 2012-07-09 17:26:15 +02:00
nick black ffab21e128 use proper printf format spec %lu 2012-07-07 11:42:35 -04:00
nick black 330ff7edc4 use memcpy() to cope with possible misalignment 2012-07-07 11:42:17 -04:00
nick black d8a5b55012 properly check for ansi c99 vsnprint truncation 2012-07-07 11:41:15 -04:00
nick black 28a47f13d9 use GCC format __attribute__ on sprinf 2012-07-07 11:40:45 -04:00
Karel Zak f38e5ff355 build-sys: cleanup .gitignore files
- move all binaries to top-level .gitignore
 - remove unnecessary */.gitignore files

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 20:50:54 +02:00
Karel Zak d77ab74af7 build-sys: convert lib/ to libcommon.la
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 20:50:53 +02:00
Karel Zak f77a4d1087 build-sys: convert libblkid/ to module
- create module
 - remove unused libblkid/src/tst_types.c test

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 17:44:15 +02:00
Milan Broz 31550e7001 libblkid: update dm-verity scan
New superblock now contains UUID. Old version is not going to be used.

Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-06-15 11:52:00 +02:00
Karel Zak a01e15f1e4 libblkid: trust in udev symlinks, don't verify
The libblkid always verify that /dev/disk/by-* symlinks match with
on-device LABELs/UUIDs. It means that all requests (e.g. mount -L |
-U) generates extra superblocks scans on the device.

Currently, many users and tools (GNOME, systemd, ...etc) use the
symlink directly and udev maintains the symlinks by inotify (+watch
rule). It seems better for system performance to disable the extra
paranoid mode and trust in udev.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-12 16:31:39 +02:00
Milan Broz cbc729f030 libblkid: add dm-verity hash device detection
dm-verity can use separate device for hash verification,
in this case there is a superblock in the first sector.

See
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/device-mapper/verity.txt
for more info.

Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-06-05 14:55:55 +02:00
Petr Uzel e12c9866b5 include: rename writeall.h to all-io.h
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-15 11:32:27 +02:00
Vladimir 'φ-coder/phcoder' Serbinenko a767169feb libblkid: support UFS UUID
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-04 11:49:16 +02:00
Vladimir 'φ-coder/phcoder' Serbinenko fd688b6cf3 libblkid: accept small blocks for NTFS and Reiserfs in blkid
libblkid is restrictive as to what it accepts as valid reiserfs or
valid NTFS.  One can mkfs an NTFS with 256B sectors and it's supported
by ntfs-3g Reiserfs can have 512B blocks and it works both with
mkfs.ntfs and Linux.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-04 11:48:07 +02:00
Petr Uzel 4f83dcceba libblkid: befs: declare functions static
Since commit 0b0c231f64
(swapon: move generic code to swapon-common.c), if util-linux is
configured with --enable-static --disable-shared --enable-libmount-mount
options, the build fails with the following error:

  ...
  libtool: link: gcc -std=gnu99 -fsigned-char -ggdb -O1 -Wall -D_FORTIFY_SOURCE=2 -o switch_root switch_root.o
  /home/petr/upstream/util-linux/libblkid/src/.libs/libblkid.a(befs.o): In function `get_uuid':
  /home/petr/upstream/util-linux/libblkid/src/superblocks/befs.c:333: multiple definition of `get_uuid'
  swapon-swapon-common.o:/home/petr/upstream/util-linux/sys-utils/swapon-common.c:99: first defined here
  collect2: ld returned 1 exit status
  /bin/sh ../libtool  --tag=CC   --mode=link gcc -std=gnu99 -fsigned-char -ggdb -O1 -Wall -D_FORTIFY_SOURCE=2   -o flock flock.o strutils.o
  libtool: link: gcc -std=gnu99 -fsigned-char -ggdb -O1 -Wall -D_FORTIFY_SOURCE=2 -o pivot_root pivot_root.o
  make[2]: *** [swapon] Error 1
  make[2]: *** Waiting for unfinished jobs....
  /home/petr/upstream/util-linux/libblkid/src/.libs/libblkid.a(befs.o): In function `get_uuid':
  /home/petr/upstream/util-linux/libblkid/src/superblocks/befs.c:333: multiple definition of `get_uuid'
  swapoff-swapon-common.o:/home/petr/upstream/util-linux/sys-utils/swapon-common.c:99: first defined here

Fix by declaring befs funcitons static.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-04-23 14:05:25 +02:00
Bernhard Voelker 455fe9a075 Fix typos found by misspellings
The tool misspellings (https://github.com/lyda/misspell-check)
detected several typos. Command used:

  $ git ls-files | grep -v ^po/ | misspellings -f -

* isosize: Fix typo in usage string.
* configure.ac: Fix typo in help string of --enable-most-builds option.
* fdisk: Fix typo in man page.
* libblkid, blkid, mount: Likewise.
* Fix various typos in docs and in source code comments.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2012-04-23 13:16:35 +02:00
Karel Zak fc387ee14c libblkid: add support for PARTUUID= and PARTLABEL=
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-19 14:33:49 +02:00
Michal Luscon 3b66f48e23 sysfs: move blkid_devno_to_wholedisk to sysfs_devno_to_wholedisk
Signed-off-by: Michal Luscon <mluscon@redhat.com>
2012-03-27 13:16:19 +02:00
Andreas Vogel 05a9d5120c libblkid: generate pseudo-UUID for ISO9660 image file
The UUID is generated from the modification date in the ISO volume
descriptor. As GRUB 2 is using this definition for the pseudo UUID for
ISO9660 files libblkid would be perfectly compatible with GRUB 2.

Signed-off-by: Andreas Vogel <Andreas.Vogel@anvo-it.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-21 13:43:35 +01:00
Karel Zak 4c5bbc5d7e libblkid: fix sysfs context usage
Reported-by: Elan Ruusamäe <glen@delfi.ee>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-06 11:24:54 +01:00
Karel Zak 89d39d2217 libblkid: properly reset chain in probe_do_wipe()
The command wipefs is not able to remove all signatures from the
device if the first detected signature is linux raid. The another
superblock signatures are ignored. For example:

  # pvcreate /dev/sdb1
  # mdadm --create md8 --metadata=0.90 --chunk=64 --level=0 \
        --raid-devices=2 /dev/sdb1 /dev/sdb2

  # wipefs -a /dev/sdb1

will delete the linux raid signature only.

Reported-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-01 14:24:04 +01:00
Sami Kerola f06b43285d build-sys: enhance readability of the autotools files
Several horizontal lists are turned to vertical, and sorted to
alphabetical order. Additionally spaces are converted to tabs where
ever possible.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-28 13:29:35 +01:00
Sami Kerola 7cebf0bb4f docs: corrections to FSF license files, and postal address
The COPYING and Documentation/licenses/COPYING* files are being
replaced by files from GNU web site.

http://www.gnu.org/licenses/gpl-2.0.txt
http://www.gnu.org/licenses/lgpl-2.1.txt

Postal addresses to FSF in other files are updated to match with the
address in license files.

Reference: http://lists.gnu.org/archive/html/freefont-announce/2005-04/msg00001.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-24 14:13:35 +01:00
Karel Zak 476b508e04 libblkid: add BLKID_PARTS_MAGIC to blkid_do_wipe() docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-22 13:10:21 +01:00
Sami Kerola 358ef9c0d1 libblkid: verify arroy bound before reference [cppcheck]
[libblkid/src/read.c:428]: (style) Array index end is used before limits check

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-08 14:08:49 +01:00
Sami Kerola a23facd637 libblkid: allow return value to indicate error [cppcheck]
[libblkid/src/probe.c:1207]: (style) Checking if unsigned variable 'len' is less than zero.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-08 14:07:12 +01:00
Sami Kerola 07023b0736 libblkid: clarify operation order [cppcheck]
[libblkid/src/cache.c:265]: (style) Suspicious condition (assignment+comparison), it can be clarified with parentheses

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-08 14:05:39 +01:00
Karel Zak 04f7020ead libblkid: improve reiserfs and btrfs min. size limits
Reported-by: Rogier Goossens <goossens.rogier@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-08 11:56:38 +01:00
Karel Zak c78cef54ce libblkid: remove >> 9 from GPT code
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-06 17:35:39 +01:00
Karel Zak 2b586af308 libblkid: fix suspicious implicit sign extension [coverity scan]
... thanks to "value preserving rules".

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-31 15:11:55 +01:00
Karel Zak 3be359813c libblkid: more robust idx usage [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-31 15:03:27 +01:00
Karel Zak 8af0d7bc44 libblkid: make fd usage in md code more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-31 14:56:34 +01:00
Karel Zak c03d12d874 libblkid: comparing an array to null is not useful [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-31 14:47:53 +01:00
Karel Zak 7110746576 libblkid: check for NULL in blkid_flush_cache() [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-31 13:39:49 +01:00
Karel Zak f805423212 libblkid: fix blkid_do_fullprobe() [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-31 13:35:35 +01:00
Karel Zak 47bcc2768c libblkid: check blkid_probe_set_magic() return in ultrix code [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-31 13:31:23 +01:00
Karel Zak cf94973758 libblkid: check blkid_probe_set_magic() return in GPT code [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-31 13:30:03 +01:00