summaryrefslogtreecommitdiffstats
path: root/libfdisk
Commit message (Collapse)AuthorAgeFilesLines
* misc: simplify if clauses [oclint]Sami Kerola2016-07-212-17/+14Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libfdisk: cleanup fdisk_gpt_set_npartitions()Karel Zak2016-06-213-6/+19
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (gpt) be more careful with 64bit constantsKarel Zak2016-06-211-29/+27Star
| | | | | | | | It's probably more robust (and readable) to be explicit when we count with constant and 64bit numbers. Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1344482 Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: Fix typo RequiredPartiton -> RequiredPartitionSebastian Rasmussen2016-05-311-1/+6
| | | | | | | | This typo fix is backwards compatible in that fdisk will accept both the GPT attribute RequiredPartition and RequiredPartiton with the typo. Update documentation and tests to all use the new attribute name. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* misc: Fix various typosSebastian Rasmussen2016-05-3117-83/+83
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* docs: Fix various typosSebastian Rasmussen2016-05-311-1/+1
| | | | Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* libfdisk: use table-length in dump for non-standard PTKarel Zak2016-05-183-9/+17
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: make table-length usage more robustKarel Zak2016-05-182-3/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: Add support for altering GPT sizeSassan Panahinejad2016-05-181-2/+13
| | | | Adds a header option to alter the GPT table length
* libfdisk: Add support for altering GPT sizeSassan Panahinejad2016-05-183-0/+102
| | | | | | | | | | | | | | | | | | | | | This is useful in two situations: 1. More than 128 partitions are required. Or 2. The partition table must be restricted in size, such as when a system expects to find a bootloader at a location that would otherwise overlap the partition table. The gdisk partitioner supports this feature. libfdisk is already capable of reading and writing partition tables of any size, but previously could only create ones of 128 entries and could not resize. This change should be fairly safe, as it has no effect unless explicitly activated. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix range checking for fdisk_set_last_lbaSassan Panahinejad2016-05-181-1/+1
|
* libfdisk: add API for work with labelitemsKarel Zak2016-05-128-14/+309
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: move fdisk_field_...() functions to field.cKarel Zak2016-05-124-52/+97
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: use fdisk_add_partition() for unused partnoKarel Zak2016-05-101-0/+5
| | | | | | | | | | | | For example: sfdisk -N <parno> may address unused partition. In this case we need to redirect from fdisk_set_partition() to fdisk_add_partition() and follow default setting (used all free space). Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add fdisk_wipe_partition()Karel Zak2016-05-0410-50/+324
| | | | | | | | | | | | | | | | | | | Now libfdisk provides functionality wipe disk device only ([s]fdisk option --wipe). This patch allows to probe for filesystems/RAIDs on newly created partitions. It means we can remove signatures before the partition node (device) is created. This reduces udev events and it's unnecessary to call wipefs for all partitions. For example sfdisk --wipe=always --wipe-partitions=always /dev/sda <<< ... EOF is a elegant way how to create new disk layout without any obsolete filesystems/RAIDs. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: don't offer zero length freespaceKarel Zak2016-04-251-5/+16
| | | | | Reported-by: Kay Sievers <kay@vrfy.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: remove duplicate codeKarel Zak2016-04-221-1/+1
| | | | | | | | For petty long time we have strdup_to_struct_member() macro to avoid duplicate code when strdup() strings in setter functions. Let's use it for libmount. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix ref.counting in fdisk_apply_script() [clang analyze]Karel Zak2016-03-301-4/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (gpt) reword two error messages with a sense of directionBenno Schulenberg2016-03-161-2/+2
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* libfdisk: (bsd) fix spelling in warning messageBenno Schulenberg2016-03-161-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* build-sys: use AC_PROG_MKDIR_P and remove a few gnuismsRuediger Meier2016-03-131-1/+1
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: fix printf i386 compiler warningsRuediger Meier2016-03-121-1/+1
| | | | | | | | | | | | | | | Still a few printf warnings found on i386 Linux: libfdisk/src/alignment.c: In function 'fdisk_align_lba': libfdisk/src/alignment.c:115:3: warning: format '%ju' expects argument of type 'uintmax_t', but argument 6 has type 'long unsigned int' [-Wformat] sys-utils/lsns.c: In function ‘add_namespace’: sys-utils/lsns.c:346:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘ino_t’ [-Wformat] sys-utils/lsns.c: In function ‘add_process_to_namespace’: sys-utils/lsns.c:362:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘ino_t’ [-Wformat] sys-utils/lsns.c: In function ‘add_scols_line’: sys-utils/lsns.c:440:4: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘ino_t’ [-Wformat] Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: fix if..endif for *_la_LDFLAGSKarel Zak2016-03-101-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: remove ifdef HDIO_GETGEORuediger Meier2016-03-072-4/+1Star
| | | | | | We don't use HDIO_GETGEO since e5b5a349. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* fdisk: sun, undef HAVE_QSORT_R for non-LinuxRuediger Meier2016-03-071-0/+5
| | | | | | | | | | | | Linux/glibc's qsort_r(3) has differently ordered arguments than BSD implementations. For now we undef that quick and dirty. The real fix would be to make configure check for qsort_r more carefully (AC_CHECK_FUNCS with AC_LANG_WERROR). Moreover one could add a wrapper to swap arguments, see https://github.com/noporpoise/sort_r/blob/master/sort_r.h Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: again fixing many printf format stringsRuediger Meier2016-03-077-44/+53
| | | | | | | | | | | | | | | | | | | This is again a huge patch regarding printf format strings to fix compiler warnings seen on clang/OSX. I'm trying to follow these rules strictly: #type #format #cast uintmax_t %ju - intmax_t %jd - uint64_t PRIu64 - int64_t PRId64 - size_t %zu - ssize_t %zd - ino_t %ju (uintmax_t) off_t %jd (intmax_t) Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: safer (and uniform) handling of return valueYuriy M. Kaminskiy2016-03-071-6/+2Star
| | | | | | When `rc` is `INT_MAX`, `rc + 1` result in signed integer overflow. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: Fix order of C/H/S numbers outputAndreas Henriksson2016-03-071-4/+4
| | | | | | | | | While the header says C/H/S the actual numbers where printed as C/S/H. Addresses: http://bugs.debian.org/815847 Reported-by: "groups, freeman" <freeman_groups@reason.dyndns.org> Signed-off-by: Andreas Henriksson <andreas@fatal.se>
* fdisk: fix warning, incompatible pointer types passing 'uint64_t *'Ruediger Meier2016-02-291-1/+2
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: disable unused parameter warnings for some test progsRuediger Meier2016-02-231-1/+1
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: fix compiler warnungs (unsigned/signed)Ruediger Meier2016-02-236-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* misc: fix warnings "unused parameter" [-Wunused-parameter]Ruediger Meier2016-02-232-6/+6
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libfdisk: fix warnings, "redundant redeclaration" [-Wredundant-decls]Ruediger Meier2016-02-231-6/+0Star
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* tests: fix compiler warnings [-Wmissing-prototypes]Ruediger Meier2016-02-235-9/+9
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libfdisk: fix compiler warnings [-Wmissing-prototypes]Ruediger Meier2016-02-231-1/+1
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libfdisk: fix missing symbolRuediger Meier2016-02-231-1/+1
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: always add AM_CFLAGSRuediger Meier2016-02-231-0/+1
| | | | | | | | We were missing our nice compliler warnings for many programs and libs. See next commits how many trivial and non-trival warnings have to be fixed. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: always use global LDADDRuediger Meier2016-02-231-1/+1
| | | | | | | | This was a major showstopper when building on a system where LTLIBINTL libs are needed (e.g. OSX). Maybe there are a few test programs which wouldn't need LDADD ... never mind. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* Merge branch 'port-osx' of https://github.com/rudimeier/util-linuxKarel Zak2016-02-191-1/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'port-osx' of https://github.com/rudimeier/util-linux: include: fix sys/sysinfo.h libblkid: don't include endian.h lib: fix ismounted includes for FreeBSD lib: remove unused variable lsns: use xcalloc() include: remove unused mntent.h include: check for sys/sysmacros.h lib: define LOGIN_NAME_MAX fallback include: provide MAP_ANONYMOUS on OSX lib: rename strmode() and setmode() tests: fix ts_option helpers build-sys: fix [g]libtoolize version for OSX build-sys: check linker support for version scripts build-sys: portable usage of find command travis: minor cleanup
| * build-sys: check linker support for version scriptsRuediger Meier2016-02-181-1/+3
| | | | | | | | | | | | | | The macro AX_CHECK_VSCRIPT was taken from gnu autoconf archive. http://www.gnu.org/software/autoconf-archive/ Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | libfdisk: fix typoKarel Zak2016-02-181-1/+1
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libfdisk: add API to control signatures wipingKarel Zak2016-02-186-15/+113
|/ | | | | | | | | | | | | | | | | Now libfdisk warns if another filesystem/RAID/PT signature is detected on the device. It seems better and user-friendly to make it possible to wipe the signatures when we write a new disk label to the device. This patch adds to the library API fdisk_enable_wipe() fdisk_has_wipe() fdisk_get_collision() to control this new feature. The device modification is done by libblkid (the same we use in some mkfs-like utils). Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add missing breakKarel Zak2016-02-091-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: add ESP shortcut also for Legacy MBRKarel Zak2016-02-081-0/+2
| | | | | References: https://github.com/karelzak/util-linux/issues/267 Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: fix typos found by codespellRuediger Meier2016-02-031-1/+1
| | | | | | Using "codespell" from https://github.com/lucasdemarchi/codespell Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* sfdisk: add 'U' shortcut for ESPKarel Zak2016-02-011-0/+3
| | | | | | | | | echo -e ',512M,U\n,,L' | sfdisk --label gpt /dev/foo to make ESP system partition. References: https://github.com/karelzak/util-linux/issues/267 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: Add GPT type GUID for Itanium Linux rootAndrew Wilcox2016-01-121-0/+1
| | | | | | References: http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/ Signed-off-by: Andrew Wilcox <awilfox@adelielinux.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: Detect out-of-space when adding new primary partitionIan Wienand2015-10-091-1/+4
| | | | | | | | | | | | | | | | | | | | | | I got a bit confused with the interaction below: Command (m for help): p Disk /dev/sda: 41 GiB, 43965677568 bytes, 85870464 sectors ... Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 1026047 1024000 500M 83 Linux /dev/sda2 1026048 85868543 84842496 40.5G 8e Linux LVM Command (m for help): n To create more partitions, first replace a primary with an extended partition. I knew I should have had two primary partitions available, but I did not notice that the disk was seen as full (I was trying to grow it) This change detects available primary partitions, and if so indicates we are out of space, rather than out of partitions. Signed-off-by: Ian Wienand <iwienand@redhat.com>
* lib/crc32: don't require to modify GPT headerKarel Zak2015-09-241-46/+35Star
| | | | | | | | | | 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>
* libfdisk: fix partition move/resize codeKarel Zak2015-09-172-9/+24
| | | | | | | | | - verify that the new partition fits to the area if the size of the has not been modified - fix remaining space calculation (yes, brown-paper-bag bug..) - offer also space before first partition as free space Signed-off-by: Karel Zak <kzak@redhat.com>