summaryrefslogtreecommitdiffstats
path: root/libblkid
Commit message (Collapse)AuthorAgeFilesLines
* libblkid: support pseudo PARTUUID= for MBRKarel Zak2013-06-133-1/+14
| | | | | | | | | | | | # 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>
* libblkid: split blkid_parttable_set_id()Karel Zak2013-06-133-6/+12
| | | | | | to avoid things like strcmp(tab->type, "gpt") in generic code. Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: set PTUUID for GPT and DOSKarel Zak2013-06-132-14/+22
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add functions to set PTUUIDKarel Zak2013-06-132-1/+57
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: make uuid_is_empty() usable for whole libraryKarel Zak2013-06-133-13/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add ReFS magic stringKarel Zak2013-05-144-0/+29
| | | | | Reported-by: "Richard W.M. Jones" <rjones@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* standard SEE ALSO section of man pagesMike Frysinger2013-05-131-1/+1
| | | | | | | | 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>
* libblkid: fix blkid_parse_tag_string() to ignore incomplete tagsKarel Zak2013-05-061-2/+2
| | | | | | | | | | | | | | | 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>
* libblkid: check writing to a file was successfulSami Kerola2013-04-262-2/+9
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libblkid: remove obsolete codeKarel Zak2013-04-181-4/+0Star
| | | | | | ... forgot in the previous commit to the swap prober. Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: ubifs is LEKarel Zak2013-04-181-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: make swap detection arch independentKarel Zak2013-04-181-0/+11
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: use more robust code in silicon_raid checksum proberKarel Zak2013-04-171-2/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix silicon raid checksum code on BEKarel Zak2013-04-161-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: arch independent minix detectionKarel Zak2013-04-151-26/+91
| | | | | | | 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>
* libblkid: remove duplicate includesKarel Zak2013-04-101-2/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix ZFS superblok offset for SBMAGICKarel Zak2013-04-101-4/+8
| | | | | | | | | | | | | | | # wipefs /dev/sdd1 offset type ---------------------------------------------------------------- 0x65000 zfs_member [raid] LABEL: zm1 UUID: 18067835215330778964 and "wipefs -o 0x65000 /dev/sdd1" seems to run in an endless loop. Reported-by: Helmut Hullen <Hullen@t-online.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: export blkid_init_debug()Karel Zak2013-04-097-27/+63
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: support LIBBLKID_DEBUG= onlyKarel Zak2013-04-091-3/+0Star
| | | | | | ... the BLKID_DEBUG= is not more supported. Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix DBG()Karel Zak2013-04-091-4/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: number of functions should not be declared extern [smatch scan]Sami Kerola2013-04-092-10/+10
| | | | | | | | | | | | | | | | | These functions are already marked extern in header file. libblkid/src/dev.c:70:19: warning: function 'blkid_dev_devname' with external linkage has definition libblkid/src/dev.c:128:26: warning: function 'blkid_dev_iterate_begin' with external linkage has definition libblkid/src/dev.c:148:12: warning: function 'blkid_dev_set_search' with external linkage has definition libblkid/src/dev.c:175:12: warning: function 'blkid_dev_next' with external linkage has definition libblkid/src/dev.c:196:13: warning: function 'blkid_dev_iterate_end' with external linkage has definition libblkid/src/tag.c:84:12: warning: function 'blkid_dev_has_tag' with external linkage has definition libblkid/src/tag.c:282:26: warning: function 'blkid_tag_iterate_begin' with external linkage has definition libblkid/src/tag.c:303:12: warning: function 'blkid_tag_next' with external linkage has definition libblkid/src/tag.c:322:13: warning: function 'blkid_tag_iterate_end' with external linkage has definition libblkid/src/tag.c:336:18: warning: function 'blkid_find_dev_with_tag' with external linkage has definition Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* various: fix variable and function declarations [smatch scan]Sami Kerola2013-04-091-3/+3
| | | | | | | | | | | | | | | | | disk-utils/fsck.minix.c:511:9: warning: mixing declarations and code fdisks/sfdisk.c:982:5: warning: mixing declarations and code fdisks/sfdisk.c:1254:5: warning: mixing declarations and code fdisks/sfdisk.c:1564:5: warning: mixing declarations and code lib/mbsalign.c:279:7: warning: mixing declarations and code libblkid/src/devname.c:378:17: warning: mixing declarations and code libfdisk/src/alignment.c:219:9: warning: mixing declarations and code term-utils/wall.c:111:9: warning: mixing declarations and code text-utils/col.c:418:19: warning: non-ANSI function declaration of function 'flush_blanks' text-utils/col.c:553:12: warning: non-ANSI function declaration of function 'alloc_line' text-utils/rev.c:105:9: warning: mixing declarations and code text-utils/tailf.c:245:9: warning: mixing declarations and code Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libblkid: clean up DBG()Karel Zak2013-04-0834-361/+278Star
| | | | | | | | | - use stderr only - use BLKID_ prefix for debug masks - don't use \n in in messages and don't use printf(), but use generic blkid_debug(). Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: use O_CLOEXECKarel Zak2013-04-039-14/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: (udf) fix possible null pointer dereference [coverity scan]Karel Zak2013-03-271-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: check returns [coverity scan]Karel Zak2013-03-271-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: fix NTFS prober on big-endian machinesKarel Zak2013-03-271-4/+4
| | | | | | | | | MFT_RECORD_ATTR_VOLUME_NAME = cpu_to_le32(0x60), ^ ./include/bitops.h:94:36: error: braced-group within expression allowed only inside a function Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: make the section AVAILABILITY always come last in man pagesBenno Schulenberg2013-03-201-4/+3Star
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* docs: update yearKarel Zak2013-03-151-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: clean up header fileKarel Zak2013-03-155-92/+60Star
| | | | | | | | * don't teach people C by header files, so use warn_unused_result attribute only on places where we return allocated memory (to avoid leaks in applications). Signed-off-by: Karel Zak <kzak@redhat.com>
* 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>