summaryrefslogtreecommitdiffstats
path: root/libblkid
Commit message (Collapse)AuthorAgeFilesLines
* libblkid: fix docs commentKarel Zak2013-03-151-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: ignore nested BSD partitions if same like parentKarel Zak2013-03-111-0/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: rename in sun_disklabel for compatibility with fdiskKarel Zak2013-03-111-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: move sun PT definition to include/Karel Zak2013-03-111-67/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: use correct block size for UDF probeZachary Catlin2013-03-021-15/+30
| | | | | | | | | | | In UDF, Volume Structure Descriptors are always 2048 bytes long (ECMA-167, 3rd ed., §2/9.1), while filesystem sectors are the same size as the sectors of the underlying media (e.g., UDF 2.01 §1.3.2). Before this commit, the block size was estimated from VSD offsets, which gives incorrect answers for non-optical media. Now, the UDF probe uses the device block size by default, falling back to 2048-byte sectors for the case of optical-disk images. Signed-off-by: Zachary Catlin <z@zc.is>
* libblkid: add debug messages for "idmag" stuff and btrfsKarel Zak2013-02-202-1/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: make backup superblock visible for wipefs(8) onlyKarel Zak2013-02-193-0/+12
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add blkid_probe_step_back to documentationKarel Zak2013-02-191-3/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: return disk ID/UUID by PT binary interfaceKarel Zak2013-02-199-4/+58
| | | | | | Add blkid_parttable_get_id() function. Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: read whole buffer for iso_volume_descriptorKarel Zak2013-02-141-2/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: Probe UDF volumes for ISO9660 info as wellZeeshan Ali (Khattak)2013-02-144-2/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I have seen blkid failing to report any meaningful data on some of UDF volumes I have (Windows installer media): $ ./blkid -p -o udev en_windows_7_professional_with_sp1_x64_dvd_u_676939.iso ID_FS_LABEL=UDF_Volume ID_FS_LABEL_ENC=UDF\x20Volume ID_FS_TYPE=udf Also, once my patches to expose more of ISO9660 info get merged, we'd also need the same info to be exposed for UDF volumes. This patch adds ISO9660 probing to UDF volumes and here is the result I see on my example UDF volume (together with my pending patch to expose more ISO9660 information): $ ./blkid -p -o udev en_windows_7_professional_with_sp1_x64_dvd_u_676939.iso ID_FS_PUBLISHER_ID=MICROSOFT CORPORATION ID_FS_APPLICATION_ID=CDIMAGE 2.54 (01/01/2005 TM) ID_FS_UUID=2011-04-12-02-38-58-00 ID_FS_UUID_ENC=2011-04-12-02-38-58-00 ID_FS_BOOT_SYSTEM_ID=EL TORITO SPECIFICATION ID_FS_LABEL=GSP1RMCPRXFRER_EN_DVD ID_FS_LABEL_ENC=GSP1RMCPRXFRER_EN_DVD ID_FS_TYPE=iso9660 $ ./blkid -p -o udev en_windows_xp_professional_with_service_pack_3_x86_cd_x14-80428.iso ID_FS_PUBLISHER_ID=MICROSOFT CORPORATION ID_FS_APPLICATION_ID=CDIMAGE 2.52 (03/09/2004 TM) ID_FS_UUID=2008-04-14-12-00-00-00 ID_FS_UUID_ENC=2008-04-14-12-00-00-00 ID_FS_BOOT_SYSTEM_ID=EL TORITO SPECIFICATION ID_FS_LABEL=GRTMPFPP_EN ID_FS_LABEL_ENC=GRTMPFPP_EN ID_FS_TYPE=iso9660 Before anyone asks, Yes! The UDF media I have is all legal and downloaded directly from MSDN. :) [kzak@redhat.com: - read LABEL from UDF only if not found anything useful in ISO9660] Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: Expose more ISO9660 headersZeeshan Ali (Khattak)2013-02-146-9/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to kill libosinfo's infamous udev rule[1], we need to make blkid report the following information as udev properties on IS09660 media so that libosinfo can make use of that for detection: 1. Volume ID (already exposed as label). 2. System ID. 3. Publisher ID. 4. Application ID. 5. Boot record's boot system ID, (almost always 'EL TORITO SPECIFICATION' if boot record is present). Example use: $ blkid -p -o udev Fedora-17-x86_64-DVD.iso ID_FS_SYSTEM_ID=LINUX ID_FS_APPLICATION_ID=GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C) 1993 E.YOUNGDALE ID_FS_UUID=2012-05-22-20-55-32-00 ID_FS_UUID_ENC=2012-05-22-20-55-32-00 ID_FS_BOOT_SYSTEM_ID=EL TORITO SPECIFICATION ID_FS_LABEL=Fedora_17_x86_64 ID_FS_LABEL_ENC=Fedora\x2017\x20x86_64 ID_FS_TYPE=iso9660 ID_PART_TABLE_TYPE=dos [1] https://fedorahosted.org/libosinfo/ticket/1 [kzak@redhat.com: - add blkid_ltrim_whitespace() and use it together with blkid_rtrim_whitespace() to trim white spaces - enlarge blkid values to 128 bytes - add generic blkid_probe_set_id_label() function - always terminate all _ID with \0 - don't export the _IDs to blkid cache] Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: Don't keep reading same sector of ISOZeeshan Ali (Khattak)2013-02-141-1/+3
| | | | | We were reading the same sector over and over again when parsing ISO9660. This patches fixes it.
* libblkid: add missing le16_to_cpu to sil raid proberKarel Zak2013-02-071-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: improve Silicon RAID proberKarel Zak2013-02-071-6/+51
| | | | | | | | * count checksum from superblock * new (correct) superblock definition from dmraid Reported-by: Frank Hirtz <fhirtz@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: make blkid_new_probe_from_filename() usable on whole-diskKarel Zak2013-02-061-0/+2
| | | | | | | | | | | | | | | | | This is stupid bug, when libblkid probe for partition table on whole-disk device with old 0.90 Linux RAID then it creates clone of the struct blkid_probe to avoid collisions with the original probing setting. If the cloned prober is unnecessary then it's deallocated by blkid_free_probe() ... and this function also closes the file descriptor if the device has been opened by blkid_new_probe_from_filename(). Fortunately we usually use open() + blkid_probe_set_device(), ... except wipefs(1). Reported-by: Lukas Czerner <lczerner@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add Flash-Friendly File System (f2fs) supportAlejandro Martinez Ruiz2013-02-064-1/+103
| | | | | | | | This adds support for detecting Flash-Friendly File System (f2fs) to libblkid. Based on work by Sven-Göran Bergh at http://www.mail-archive.com/busybox@busybox.net/msg17874.html Signed-off-by: Alejandro Martinez Ruiz <alex@nowcomputing.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* a pointer should not be compared to zero [coccinelle]Sami Kerola2013-02-061-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libblkid: add blkid_probe_step_back()Karel Zak2013-02-043-22/+97
| | | | | | | | | | | | | | | | | | | | | | It seems that blkid_do_probe() is too high-level solution for some mkfs programs (for example ext4 mkfs supports "undo" so all write operations has to be implemented by filesystem specific functions). The new function blkid_probe_step_back() resets internal libblkid buffers and move probing stuff one step back. It means that the previously used probing function will be called again in the next blkid_do_probe() call. This allows to modify on-disk data and check for backup superblocks or alternative magic strings. Something like: while (blkid_do_probe(pr) == 0) { ... get SBMAGIC_OFFSET and SBMAGIC len ... ... use your private seek & write() ... blkid_probe_step_back(pr); } References: https://bugzilla.redhat.com/show_bug.cgi?id=902512 Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: remove optimization from verify( funrtionKarel Zak2013-02-011-65/+11Star
| | | | | | | | | | | | | | | | Now libblkid (the cache based part) tries to probe for the cached filesystem firstly. This optimization is broken, because: * new another superblock could be on the device and the original is already obsolete * we still need to probe for partitions and raids * the code was too fragile The patch also suggests lsblk --fs in blkid.8 for end users. lsblk read information from used db. Reported-by: Andreas Hofmeister <andi@collax.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: make btrfs magics more readableKarel Zak2013-01-101-10/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add support for btrfs backup superblockGoffredo Baroncelli2013-01-101-0/+8
| | | | | | | | | | | | | | | | | | Btrfs has three superblock. The first one is placed at 64KB, the second one at 64MB, the third one at 256GB. If the first superblock is valid except that the "magic field" is zeroed, btrfs skips the check of the other superblocks. If the first superblock is fully invalid, btrfs checks for the other superblock. So zeroing the first superblock "magic field" at the beginning seems that the filesystem is wiped. But when the first superblock is overwritten (eg by another filesystem), then the other two superblock may be considered valid, and the filesystem may resurrect. This patch allow to find and wipe the other btrfs superblocks signature. Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add missing promise raid metadata locationsPhillip Susi2013-01-091-1/+1
| | | | | There are some additional locations where dmraid can find and use pdc raid metadata that libblkid was not checking.
* libblkid: improve test_blkid_devno, fix compiler warning [-Wunused-result]Karel Zak2012-12-191-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: check mkdir(/run/blkid) return code [coverity scan]Karel Zak2012-12-121-5/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: re-read PART{UUID,LABEL} for successfully verified cached devicesKarel Zak2012-12-041-5/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: cleanup arguments checksKarel Zak2012-12-0411-46/+51
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: cleanup nonnull attribute usageKarel Zak2012-12-041-118/+52Star
| | | | | | | | | | | | - don't mix __attribute__((nonnull)) and "if (!argument) return" for the same function. The "if ()" check will be *silently* optimized out by gcc. - use __attribute__((nonnull)) for functions where is impossible to return error code. For example "is" and "has" functions or functions where we return unsigned types and zero is a valid value. Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: cleanup blkid_strconcatKarel Zak2012-11-302-4/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: remove blkid_{strndup,strdup}Karel Zak2012-11-3010-51/+23Star
| | | | | | | Don't try to be smart. Let's use standard libc functions. (Note that we have fallback for strndup() in include/strutils.h) Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add function attributes to private APIKarel Zak2012-11-301-51/+123
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add function attributes to public APIOndrej Oprala2012-11-301-105/+273
| | | | | | | | [kzak@redhat.com: - use __ul prefix in public API, - define minimal requirement gcc 3.4] Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: (gpt) don't modify in memory buffersKarel Zak2012-11-211-12/+11Star
| | | | | | | | | | | | | | | | | LIBBLKID_DEBUG=0xffff blkid -p .... gpt: ---> call probefunc() reuse buffer: off=0 len=1024 pr=0xb0b690 reuse buffer: off=0 len=1024 pr=0xb0b690 reuse buffer: off=1024 len=16384 pr=0xb0b690 GPT entries corrupted reuse buffer: off=10737417728 len=512 pr=0xb0b690 reuse buffer: off=10737401344 len=16384 pr=0xb0b690 GPT entries corrupted gpt: <--- (rc = 1) Reported-by: Dave Reisner <d@falconindy.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: remove obsolete tags from cacheKarel Zak2012-11-142-1/+21
| | | | | | | | | | | | | | | | | The libblkid cache tags are not removed if a new version of the tags is empty (e.g. label 'foo' -> ''). # mkfs.ext4 -L test_label /dev/sda15 # blkid /dev/sda15 /dev/sda15: LABEL="test_label" # tune2fs -L '' /dev/sda15 # blkid /dev/sda15 /dev/sda15: LABEL="test_label" ^^^^^^^^^^ Reported-by: Mike Fleetwood <mike.fleetwood@googlemail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix compiler warning [-Wstrict-aliasing]Karel Zak2012-10-151-3/+5
| | | | | | | libblkid/src/superblocks/befs.c: In function 'get_uuid': libblkid/src/superblocks/befs.c:353:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix copyright noticed to be consistent (so all are LGPL)Karel Zak2012-09-112-3/+4
| | | | | | | | | | | | The libblkid library was intended to be released under the LGPL. There is very little significant code in version.c; just a version parser, and the original copyright holder (Theodore Ts'o, tytso@mit.edu) has confirmed that he had intended to relicense all of the files under the LGPL during a time when he was the sole author. Acked-by: "Theodore Ts'o" <tytso@mit.edu> Reported-by: John Calcote <john.calcote@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: check fchmod() return value [coverity scan]Karel Zak2012-09-071-3/+6
|
* libblkid: improve DBG() macroKarel Zak2012-09-071-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: use O_CLOEXECKarel Zak2012-09-045-6/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: rewrite ntfs proberKarel Zak2012-08-271-36/+85
| | | | | | | | | - 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>
* libblkid: use unsigned ints in ntfs proberKarel Zak2012-08-271-19/+22
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: expand paths at make timeKarel Zak2012-08-151-1/+2
| | | | | | | | | | | | | autoconf docs about *dir variables (e.g bindir): ... A corollary is that you should not use these variables except in makefiles... ...you should not rely on AC_CONFIG_FILES to replace bindir and friends in your shell scripts and other files; instead, let make manage their replacement. Signed-off-by: Karel Zak <kzak@redhat.com>
* Fix non-Linux buildSamuel Thibault2012-08-131-3/+12
| | | | | | | | | | | | 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>
* build-sys: don't compile lib{mount,blkid} tests when --disable-static specifiedKarel Zak2012-08-021-0/+4
| | | | | | The tests often depend on private (non-API) library functions. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: move tests to check_PROGRAMSKarel Zak2012-07-302-2/+2
| | | | | | Thanks to Mike Frysinger. Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: fix build without libsKarel Zak2012-07-271-6/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add minisg COPYING filesKarel Zak2012-07-271-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add noreturn function attributeSami Kerola2012-07-262-2/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libblkid: fix compiler warning [-Wsign-compare]Karel Zak2012-07-261-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch '2012wk28'Karel Zak2012-07-161-2/+0Star
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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