summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/utils.c
Commit message (Collapse)AuthorAgeFilesLines
* docs: fix typos [codespell]Sami Kerola2019-02-181-1/+1
| | | | | Reference: https://github.com/codespell-project/codespell Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libfdisk: reduce number of asprintf() calls, check return valueKarel Zak2018-07-041-14/+19
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: Fix multipath partition seperators for user-friendly namesKyleMahlkuch2018-07-041-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | The current code assumes "-part" is the only partition sepereator but this is not true for some distros. For example in Ubuntu 18.04 fdisk does not print the correct names for mpatha: ~# ls -l /dev/mapper/mpatha* lrwxrwxrwx 1 root root 7 Feb 1 04:39 /dev/mapper/mpatha -> ../dm-0 lrwxrwxrwx 1 root root 7 Feb 1 04:38 /dev/mapper/mpatha1 -> ../dm-4 lrwxrwxrwx 1 root root 7 Feb 1 04:38 /dev/mapper/mpatha2 -> ../dm-5 lrwxrwxrwx 1 root root 7 Feb 1 04:38 /dev/mapper/mpatha3 -> ../dm-6 ~# fdisk -l /dev/mapper/mpatha Device Boot Start End Sectors Size Id Type /dev/mapper/mpatha-part1 2048 419432447 419430400 200G 83 Linux /dev/mapper/mpatha-part2 419432448 838862847 419430400 200G 83 Linux /dev/mapper/mpatha-part3 838862848 1258291199 419428352 200G 83 Linux Instead of assuming a partition seperator of "-part" this patch uses access to check the file system for a partition seperator of "p" or the absense of a partition seperator. If neither of these work the patch defaults to "-part" like we had before this patch.
* misc: fix compiler warnungs (unsigned/signed)Ruediger Meier2016-02-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These ones should be fixed: libblkid/src/probe.c:393:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/probe.c:907:25: warning: signed and unsigned type in conditional expression [-Wsign-compare] libblkid/src/probe.c:1221:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:540:47: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:1043:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:1056:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:1057:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:1061:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:1199:27: warning: signed and unsigned type in conditional expression [-Wsign-compare] libblkid/src/partitions/partitions.c:1410:26: warning: signed and unsigned type in conditional expression [-Wsign-compare] libblkid/src/partitions/partitions.c:1431:25: warning: signed and unsigned type in conditional expression [-Wsign-compare] libblkid/src/superblocks/linux_raid.c:151:8: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] libblkid/src/superblocks/linux_raid.c:155:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] libblkid/src/superblocks/superblocks.c:375:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/superblocks/xfs.c:141:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libsmartcols/src/table.c:333:24: warning: signed and unsigned type in conditional expression [-Wsign-compare] libsmartcols/src/table.c:344:25: warning: signed and unsigned type in conditional expression [-Wsign-compare] libsmartcols/src/table_print.c:753:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/ask.c:364:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/utils.c:33:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/context.c:435:56: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/context.c:730:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/script.c:557:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/dos.c:1791:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/gpt.c:813:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] disk-utils/partx.c:140:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] disk-utils/partx.c:551:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] disk-utils/partx.c:640:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* tests: fix compiler warnings [-Wmissing-prototypes]Ruediger Meier2016-02-231-1/+1
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libfdisk: Use predictable /dev/mapper partition names for /dev/dm-NStanislav Brabec2015-05-281-3/+13
| | | | | | | | | | It is impossible to predict /dev/dm-N partition names. Use predictable and better readable /dev/mapper names instead. [kzak@redhat.com: - remove if-before-free] Signed-off-by: Stanislav Brabec <sbrabec@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
* Use correct partition names for /dev/mapperStanislav Brabec2015-05-261-2/+4
| | | | | | | | | | | | | | The default configuration of multipath-tools appends "-partN" to partition nodes. Follow this conventions and do the same. It fixes for example fdisk -l /dev/mapper/name_of_the_device. Note that the current implementation only partially fixes the problem. It does not reflect any udev configuration changes, as udev does not provide any function to return names of future (or current) partitions of a particular device. It also does not fix fdisk -l /dev/dm-0. Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* libfdisk: support bootbits protection from (p)MBRKarel Zak2015-04-131-22/+51
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add API docsKarel Zak2014-11-261-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: fix typoKarel Zak2014-11-211-1/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix partition names on GNU Hurd.Gabriele Giacone2014-11-181-0/+4
|
* libfdisk: fdisk_read_firstsector should seek to offset 0Samuel Thibault2014-11-101-0/+7
| | | | | | | The current offset of cxt->dev_fd may not be still 0, notably when blkdev_get_size has to resort to using blkdev_find_size Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org
* libfdisk: propagate assign-device operation to parentKarel Zak2014-10-071-1/+2
| | | | | | | Let's make it possible to use fdisk_assign_device() for nested contexts. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix script partitions size parsingKarel Zak2014-10-071-2/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: make first sector buffer usage more robustKarel Zak2014-07-141-13/+28
| | | | | | | | | | | | $ ~/util-linux/fdisk -b 4096 xxx .. Segmentation fault The buffer has to be reinitialized always when we apply a new device properties (e.g. sector size). Reported-by: Bernhard Voelker <mail@bernhard-voelker.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: clean up debug outputKarel Zak2014-03-211-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: use new debug functionsKarel Zak2014-03-211-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: remove Mac codeKarel Zak2013-09-161-3/+0Star
| | | | | | The code has been used only to detect magic strings, nothing else. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add fdisk_scround()Karel Zak2013-09-161-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add fdisk_partname()Karel Zak2013-09-161-0/+78
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add fdisk_new_context(), reuse contextKarel Zak2013-03-111-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add firstsector utilsKarel Zak2013-03-111-0/+42
Signed-off-by: Karel Zak <kzak@redhat.com>