summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/label.c
Commit message (Collapse)AuthorAgeFilesLines
* libfdisk: fix typosMarcos Mello2019-06-201-4/+4
|
* libfdisk: (docs) add notes about fdisk_enable_wipe()Karel Zak2019-06-171-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix docs warningsKarel Zak2018-02-211-0/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: extend API to provide label specific geometry rangesKarel Zak2018-01-021-0/+70
| | | | | | | 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: update docsKarel Zak2017-05-231-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: check for collisions when create new labelKarel Zak2017-02-141-0/+4
| | | | | | | | We need to be sure that when create a new disklabel than the old label will be removed. Addresses: https://github.com/karelzak/util-linux/issues/410 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: cleanup labelitem initializationKarel Zak2016-10-271-1/+1
| | | | | | | | * use macro for label initialization * make sure we do not call fdisk_ref_labelitem() and fdisk_unref_labelitem() for non-allocated items Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix uninitialized fdisk_labelitemRuediger Meier2016-10-271-1/+1
| | | | | | | | | | | | | | | fdisk -l could crash randomly. Only seen on some i586 systems with certain exotic compiler options. The problem was that this item is later used in function fdisk_reset_labelitem() like this: if (li->type == 's') free(li->data.str); This may crash if item is randomly initialized. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: Fix various typosSebastian Rasmussen2016-05-311-6/+6
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* libfdisk: add API for work with labelitemsKarel Zak2016-05-121-4/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: move fdisk_field_...() functions to field.cKarel Zak2016-05-121-46/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add fdisk_wipe_partition()Karel Zak2016-05-041-5/+1Star
| | | | | | | | | | | | | | | | | | | 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: add API to control signatures wipingKarel Zak2016-02-181-0/+6
| | | | | | | | | | | | | | | | | 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: (gpt) reorder only when necessaryKarel Zak2015-09-021-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: make context->label usage more robust [smatch scan]Karel Zak2015-08-051-1/+2
|
* libfdisk: cleanup assert() usageKarel Zak2015-08-041-10/+6Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add new API to read label specific dataKarel Zak2015-06-111-9/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | * removes list() label operation from internal API The list() has been based on fdisk_info() it was useless for anything else than print on stdout... * add a new get_item() label operation and fdisk_get_disklabel_item() public API The new API provides abstract and pretty simple way how to get label specific disk label information, for example fdisk_get_disklabel_item(cxt, GPT_LABELITEM_ENTRIESLBA, &iterm); return LBA of the array with GPT entries. Note that this patch does not implement public functions to get data from the @item object. * removes get_id() label operation -- it's subset of the new get_item() * the new internal API is also used to implement backwardly compatible fdisk_list_disklabel() and fdisk_get_disklabel_id() Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add fdisk_label_get_fields_ids_all()Karel Zak2015-05-111-0/+41
| | | | | | | | The current fdisk_label_get_fields_ids() is too smart as it differentiate between details mode etc. It's useful for default output, but in some cases it's better to provide all output fields. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: don't use off_t in public APIKarel Zak2015-01-261-1/+1
| | | | | | | | | | | | It's better to use exact and explicitly defined types (e.g. uint64_t) rather than something like off_t to make code more portable. [reported with gcc (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3)] The patch also fixes one debug message. Reported-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix some typosKarel Zak2015-01-131-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: cleanup gtk-docs warningsKarel Zak2015-01-131-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add API docsKarel Zak2014-11-261-13/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: rename and move functionKarel Zak2014-11-261-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix typoKarel Zak2014-11-261-1/+3
|
* agetty: fix typoKarel Zak2014-11-211-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: make it possible to use zero for size and startKarel Zak2014-10-151-2/+9
| | | | | | | | | | | | | | | | The zero may be valid size and start of the partition. This patch introduces: fdisk_partition_has_start() fdisk_partition_has_size() fdisk_partition_unset_size() fdisk_partition_unset_start() to make it possible to work with zero. The feature is internally implemented by magic constant ((type) -1) for undefined sizes and offsets. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add fdisk_label_get_field_by_name() and const for labelsKarel Zak2014-10-071-7/+32
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: remove old label drives' API for parttypesKarel Zak2014-10-071-5/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: use new set_part API in fdisk_set_partition_type()Karel Zak2014-10-071-3/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add geometry to API, cleanupKarel Zak2014-08-151-4/+3Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fdisk_label_is_labeltype()Karel Zak2014-08-151-0/+12
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: more docsKarel Zak2014-08-141-6/+90
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: final parttype API cleanupKarel Zak2014-08-141-37/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: move get_parttypes to label APIKarel Zak2014-08-141-19/+52
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: make it possible to get fields for all labesKarel Zak2014-08-141-38/+42
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: cleanup label geometry APIKarel Zak2014-08-141-23/+13Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: cleanup fdisk_is_label stuffKarel Zak2014-08-131-18/+7Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: clean up API (context.c)Karel Zak2014-08-131-10/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: rename fdisk_column to fdisk_fieldKarel Zak2014-08-131-32/+32
| | | | | | .. to make the API and fdisk(s) code more readable. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: remove dependence on libsmartcolsKarel Zak2014-08-131-4/+23
| | | | | | It's application business to convert libfdisk_table to string. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix possible memory leak [clang-analyze]Karel Zak2014-07-011-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add partitions reorder operation to label APIKarel Zak2014-04-181-0/+18
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: properly implement read-only modeKarel Zak2014-03-211-2/+1Star
| | | | | | | | | | Don't use fallback to read-only mode in fdisk_context_assign_device(), it's application responsibility open the device in the right mode. The commands fdisk and cfdisk check (and report) read-only mode now. Reported-by: Maciej MaƂecki <me@mmalecki.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: clean up debug outputKarel Zak2014-03-211-9/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: use new debug functionsKarel Zak2014-03-211-10/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: clean up cylinder columnKarel Zak2014-03-111-2/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: use fdisk_table to generate outputKarel Zak2014-03-111-164/+3Star
| | | | | | | | | | | * add generic fdisk_iter iterator * use fdisk_table to convert partition table to human readable output * clean up partition.c API (don't use reference to fdisk_context in fdisk_partition struct) * extern table.c API to use fdisk_iter iterator * remove old fdisk_list_partitions() Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: move partition stuff to partition.cKarel Zak2014-03-111-95/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add reference counting to fdisk_partitionKarel Zak2014-03-111-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add support to list free spaceKarel Zak2014-03-111-23/+82
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>