summaryrefslogtreecommitdiffstats
path: root/libfdisk
Commit message (Collapse)AuthorAgeFilesLines
* libfdisk: fix printf format modifierRuediger Meier2018-10-041-1/+1
| | | | | | | | | libfdisk/src/script.c: In function ‘fdisk_script_read_context’: libfdisk/src/script.c:452:33: error: format ‘%zu’ expects argument of type ‘size_t’, but argument 4 has type ‘long unsigned int’ [-Werror=format=] snprintf(buf, sizeof(buf), "%zu", fdisk_get_grain_size(cxt)); ^ Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libfdisk: fix OSX compiler warningRuediger Meier2018-10-041-3/+5
| | | | | | | libfdisk/src/context.c:1354:54: error: unused parameter 'cxt' [-Werror,-Wunused-parameter] const char *fdisk_get_devmodel(struct fdisk_context *cxt) Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libfdisk: (docs) add missing functionKarel Zak2018-09-191-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: count gaps to possible size when resizeKarel Zak2018-09-171-1/+1
| | | | | | | | | The current code counts only partition sizes when it counts possible space, but we have gaps between the partitions. It seems better to count all based on offsets rather than sizes. Addresses: https://github.com/karelzak/util-linux/issues/693 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: accept grain script headerKarel Zak2018-09-122-1/+24
| | | | | | | | | | | | The "grain" variable is used to calculate partitions alignment. The default is 1MiB (or minimal I/O size). The libfdisk provides API to overwrite this default, but this feature has been nowhere accessible for end-user. This patch support for "grain: <size>" in libfdisk scripts. Addresses: https://github.com/karelzak/util-linux/issues/688 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add fdisk_get_devmodel() and fdisk_get_devno()Karel Zak2018-08-305-0/+61
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: use SPDX license namesKarel Zak2018-08-161-1/+1
| | | | | | | | | | Let's use standardized names for licenses. The names used by SPDX makes things more obvious at first glance. For complete list see: https://spdx.org/licenses/ Note, this commit does not change any license or so... Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: Accept negative numbers for last sector inputAwal Garg2018-07-319-7/+45
| | | | | | | | [kzak@redhat.com: - add note to the man page - add '-' to the dialog query - cleanup functions names and libfdisk.sym] Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix compiler warnings [-Wcast-qual]Karel Zak2018-07-233-6/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix compiler warning [-Wmaybe-uninitialized]Karel Zak2018-07-181-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* 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.
* libfdisk: use \x<hex> to read/write partition nameKarel Zak2018-07-041-2/+6
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/656 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix list_del after partition resetVaclav Dolezal2018-05-091-1/+1
| | | | Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* libfdisk: fix compiler warning [-Wunused-parameter]Karel Zak2018-05-035-15/+5Star
| | | | | Reported-by: L A Walsh <lkml@tlinx.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: improve JSON outputKarel Zak2018-04-051-22/+48
| | | | | | | * use fputs_quoted_json() for all data * fix use of variables separator Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (docs) fix section nameKarel Zak2018-03-211-1/+1
| | | | | | | The string "DOS (MBR)" generates filename with "(...)" which is unacceptable by kernel.org stuff. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (docs) update yearKarel Zak2018-03-201-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix docs warningsKarel Zak2018-02-212-0/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (docs) add missing docs blocksKarel Zak2018-02-213-22/+48
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (docs) improve enums documentationKarel Zak2018-02-211-16/+61
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: fix typos using codespellRuediger Meier2018-02-166-7/+7
| | | | | | Some more funny typos, please review carefully. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: remove redundant EXTRA_DIST filesRuediger Meier2018-01-221-2/+1Star
| | | | | | | The sources of AC_CONFIG_FILES (*.in) are automatically distributed. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: avoid using prog_DEPENDENCIESRuediger Meier2018-01-221-4/+1Star
| | | | | | | Use EXTRA_prog_DEPENDENCIES to have the benefit of automake's automatic prog_DEPENDENCIES. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: remove unneeded dependencies on bla.h.inRuediger Meier2018-01-221-2/+1Star
| | | | | | | | | | We have already automakes's automatic dependencies like bla.h.in -> bla.h -> foo.o -> bar.la An explicit direct dependency bla.h.in -> bar.la is redundant and useless anyways. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: automake is able to find headers in builddir ...Ruediger Meier2018-01-221-1/+1
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: remove generated headers from dist tar ballRuediger Meier2018-01-221-5/+1Star
| | | | | | | | | | | | | Headers should only be listed in either *_HEADERS or *_SOURCES, especially when we want nodist_*_HEADERS. Since all the generated headers are made by configure we don't even need to use BUILT_SOURCES or other tricks. Also see automake docs 9.4.1 Built Sources Example: case "Build bindir.h from configure" Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* include/debug: introduce __UL_INIT_DEBUG_FROM_STRING()Karel Zak2018-01-171-1/+1
| | | | | | | Let's make it possible to use debug.h without environment variables. Suggested-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (script) be consistent in code with typesKarel Zak2018-01-121-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/debug: don't print pointer address for SUID programsKarel Zak2018-01-121-0/+3
| | | | | | | | | | | | | | | | * introduce new flag __UL_DEBUG_FL_NOADDR to suppress pointer address printing * use __UL_DEBUG_FL_NOADDR when SUID * move ul_debugobj() to debugobj.h, and require UL_DEBUG_CURRENT_MASK to provide access to the current mask from ul_debugobj(). It's better than modify all ul_debugobj() calls and use the global mask as argument. * remove never used UL_DEBUG_DEFINE_FLAG Reported-by: halfdog <me@halfdog.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: allow to start freespace for zeroKarel Zak2018-01-113-1/+8
| | | | | | | This is necessary for disk labels like SUN where whole disk is possible to address by partitions. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (sun) fix n-1 bug and whole-diskKarel Zak2018-01-111-1/+5
| | | | | | | | * set whole_disk variable if SUN_TAG_WHOLEDISK specified * fix N-1 bug in add new partition according to template (script) Addresses: https://github.com/karelzak/util-linux/issues/555 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (script) support R (RAID) and V (LVM) shortcutsKarel Zak2018-01-091-0/+13
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/560 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (gpt) add VMware specific UUIDsKarel Zak2018-01-081-0/+7
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/559 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (dos) fix max headsKarel Zak2018-01-021-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: extend API to provide label specific geometry rangesKarel Zak2018-01-026-3/+112
| | | | | | | Now fdisk provides DOS specific geometry ranges in expert menu. Addresses: https://github.com/karelzak/util-linux/issues/556 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (gpt) use fdisk_warn() for failed name settingKarel Zak2017-12-201-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: return bytes processed from gpt_entry_set_name(), process rcVaclav Dolezal2017-12-191-5/+8
| | | | | | | Made gpt_entry_set_name() return number of utf8 bytes processed on success, so info message about change can be accurate. Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* libfdisk: allocate enough bytes for ucs2 to utf8 encodingVaclav Dolezal2017-12-181-7/+6Star
| | | | | | | | | Allocate 3*number_of_ucs2_characters bytes for utf8 output. Also as we are using calloc there's no need to write terminating null byte. Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* libfdisk: gpt: properly encode string on renameVaclav Dolezal2017-12-181-10/+36
| | | | | | | GPT partition name entry should be recorded as little endian UCS2, so I have written proper conversion (assuming UTF8 input). Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* misc: fix typosSami Kerola2017-11-281-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libfdisk: (sun) enhance searching of free spaceMikhail Vorobyov2017-11-161-4/+9
| | | | | | Potential partition start should be aligned to cylinders. So fdisk wouldn't consider partition's last cylinder remains as eligible space for new partition start.
* libfdisk: (sun) move aligning of the first sector before availability checkMikhail Vorobyov2017-11-161-14/+13Star
| | | | | So it will check a sector which would be actualy used as the first sector of the partition.
* libfdisk: (gpt) move backup header after device resizeKarel Zak2017-11-141-2/+56
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/532 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: Fix uninitialized structureRoddy Shuler2017-11-031-1/+1
| | | | | | | | Without this, 'sfdisk -d' with certain filenames would lead to reading an 's' from the 'type' field in fdisk_reset_labelitem and cause a crash due to prematurely freeing the 'data.str' field. Signed-off-by: Roddy Shuler <roddy@endlessm.com>
* libfdisk: (sun) fix creation of whole disk partitionMikhail Vorobyov2017-11-021-4/+9
| | | | | | | | | | | | | sun_add_partition() allowed the 1st sector to be 0 for the 3rd partition only if that sector was free or if other partitions covered the whole disk. Now it's always allowed for the 1st sector to be set to 0 for the 3rd partition. [kzak@redhat.com: - print info about "wholedisk" before "First sector" dialog for 3rd partition - default to 0 for 3rd partition start sector] Signed-off-by: Mikhail Vorobyov <m.vorobyov@cs.msu.ru> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: fix non-blkid compilationKarel Zak2017-09-191-7/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: cleanup UUID_STR_LEN definitionsKarel Zak2017-09-152-4/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: replace magic number 37 with UUID_STR_LENPhilip Prindeville2017-09-051-5/+9
| | | | Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
* libfdisk: fix fdisk_reset_partition() leaking *_chs strings.Vaclav Dolezal2017-08-241-0/+2
| | | | Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>