summaryrefslogtreecommitdiffstats
path: root/libfdisk
Commit message (Collapse)AuthorAgeFilesLines
...
* 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>
* libfdisk: fix two potential memory errors.Vaclav Dolezal2017-08-242-2/+5
| | | | | | | | | | Fixes one leak and one unchecked allocation error. [kzak@redhat.com: - don't call fdisk_ask_menu_get_result() after failed fdisk_do_ask()] Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: improve alignment debug mesaggesKarel Zak2017-08-221-5/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add --grain to mkpart sampleKarel Zak2017-08-221-1/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add fdisk_save_user_grain()Karel Zak2017-08-225-1/+46
| | | | | | | | | | | Let's provide API for applications that don't want to use the default 1MiB grain. The new function allow to use "as minimal as possible" if grain is set by fdisk_save_user_grain() to 512. If the phy sector size (or minimal I/O size) is greater than specified grain size than smallest possible setting is used. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (dos) use size-=1 when alignment not used laterKarel Zak2017-08-221-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: improve "add partition" debug messageKarel Zak2017-08-221-6/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (gpt) fix size-1 errorKarel Zak2017-08-221-1/+7
| | | | | | | | If partition does not require alignment, then don't call LBA align function and don't use size-=1 (fdisk_align_lba_in_range() returns unmodified size and we call size=-1 more than once for the same size). Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add --nopartno to mkpart sampleKarel Zak2017-08-011-6/+14
| | | | | | | | * disable dialogs for the mkpart sample * add --nopartno use-case to force libfdisk to use default partno(s) * add test for this feature Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: allow to resize in unsorted partition tableKarel Zak2017-07-191-4/+10
| | | | | | | The current code assumes that partition offsets (starts) are sorted. This is usual situation, but unsorted partition table is also valid... Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: improve table print debugsKarel Zak2017-07-192-5/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: support default partno in mkpart-fullspec sampleKarel Zak2017-07-191-15/+36
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add fdisk_disable_dialogs()Karel Zak2017-07-198-6/+60
| | | | | | | | | | | | | | | The default (for historical reasons) is to use dialog driven partitioning. It's possible to avoid dialogs by fdisk_partition template for fdisk_add_partition(). Unfortunately in some case (mostly DOS driver) it's not enough, because we need to distinguish between logical and primary partitions. If we know that dialogs are unwanted then we can default to primary partition, etc. This function simplify semantic of the library for non-interactive programs. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (dos) return EINVAL when delete unused partitionKarel Zak2017-07-191-2/+17
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix warning -Wunused-functionRuediger Meier2017-07-181-0/+2
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: don't use non-existing UUID_LIBSRuediger Meier2017-07-181-1/+1
| | | | | | | We've added UUID_LIBS in f77a4d1087 but I don't see what it was good for. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libfdisk: use fdisk_sector_t consistently and fix printf format stringsRuediger Meier2017-07-182-5/+5
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libfdisk: use BLKPG_* ioctls on linux onlyKarel Zak2017-07-171-1/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: make fdisk compliant to UEFI/GPT specification on PMBRKarel Zak2017-07-141-4/+5
| | | | | | | | The PMBR partition record should be StartingCHS=0x002000 (0/0/2) and EndingCHS=0xFFFFFF (1023/255/63) Addresses: https://github.com/karelzak/util-linux/issues/485 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: remove whitespacesKarel Zak2017-07-141-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: use BLKPG ioctls to inform kernel about changesKarel Zak2017-07-146-0/+186
| | | | | | | | | | | | | This patch introduces fdisk_reread_changes(). The function is less invasive alternative to fdisk_reread_partition_table(). The new function uses BLKPG ioctls for modified partitions. The another partitions are not affected. This solution allows to successfully use fdisks on disk where some partitions are still use (mounted). For example if you want to resize the last partition on the device. Signed-off-by: Karel Zak <kzak@redhat.com>