summaryrefslogtreecommitdiff
path: root/libparted
Commit message (Collapse)AuthorAgeFilesLines
* tests: Fixing libparted test framework usageBrian C. Lane2023-02-077-30/+39
| | | | | | The fail and fail_if functions from libcheck are deprecated, replace them with ck_abort_msg and ck_assert_msg. Note that the logic of assert is the opposite of fail_if.
* libparted: Fix problem with creating 1s partitionsBrian C. Lane2023-02-061-1/+1
| | | | | | | | | There was a 1-off error in _partition_get_overlap_constraint that prevented partitions from being created in 1s free space. You could create 1s partitions as long they were done in order, but not after leaving 'holes'. This fixes this and adds tests for it on msdos and gpt disklabels.
* gpt: Add no_automount partition flagMike Fleetwood2022-12-132-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | Add user requested support for GPT partition type attribute bit 63 [1] so the no-auto flag in the systemd originated Discoverable Partitions Specification [2] can be manipulated. The UEFI specification [3] says partition attribute bits 48 to 63 are partition type specific, however the DPS [2] and Microsoft [4] use the bit 63 to mean no automounting / assign no drive letter and apply it to multiple partition types so don't restrict its application. [1] Request for GPT partition attribute bit 63 "no automount" editing support https://gitlab.gnome.org/GNOME/gparted/-/issues/214 [2] The Discoverable Partitions Specification (DPS), Partition Attribute Flags https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ [3] UEFI Specification, version 2.8, Table 24. Defined GPT Partition Entry - Attributes https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_final.pdf [4] CREATE_PARTITION_PARAMETERS structure (vds.h) https://learn.microsoft.com/en-gb/windows/win32/api/vds/ns-vds-create_partition_parameters Signed-off-by: Mike Fleetwood <mike.fleetwood@googlemail.com> Signed-off-by: Brian C. Lane <bcl@redhat.com>
* parted: Add display of GPT UUIDs in JSON outputArvin Schnell2022-09-302-1/+103
| | | | | | | | | | | This adds 2 new disk type features, one for the whole disk UUID and another for the per-partition UUID. It adds ped_disk_get_uuid and ped_partition_get_uuid functions to retrieve them. It adds them to the JSON output on GPT disklabeled disks as "uuid" in the disk and partitions sections of the JSON output. Signed-off-by: Brian C. Lane <bcl@redhat.com>
* tests: Add a libparted test for ped_partition_set_system on msdosBrian C. Lane2022-08-151-0/+35
| | | | | Test the libparted API to make sure the flag is not cleared by calling ped_partition_set_system.
* libparted: Fix handling of msdos partition typesBrian C. Lane2022-08-151-8/+46
| | | | | | | | | | | | | This restores the previous behavior by testing the partition type against the list of known types and skipping the filesystem type reset. Now the sequence of: ped_partition_new(...) ped_partition_set_flag(part, PED_PARTITION_BLS_BOOT, 1); ped_partition_set_system(part, ped_file_system_type_get("ext4")); Will keep the type set to PED_PARTITION_BLS_BOOT, which is how it used to behave.
* tests: Add a libparted test for ped_partition_set_system on gptBrian C. Lane2022-08-153-2/+108
| | | | | Test the libparted API to make sure the flag is not cleared by calling ped_partition_set_system.
* libparted: Fix handling of gpt partition typesBrian C. Lane2022-08-151-2/+43
| | | | | | | | | | | | | This restores the previous behavior by testing the GUID against the list of known types and skipping the filesystem GUID reset. Now the sequence of: ped_partition_new(...) ped_partition_set_flag(part, PED_PARTITION_BIOS_GRUB, 1); ped_partition_set_system(part, ped_file_system_type_get("ext4")); Will keep the GUID set to PED_PARTITION_BIOS_GRUB, which is how it used to behave.
* libparted: Fix check for availability of _type_id functionsArvin Schnell2022-07-271-2/+2
| | | | | | | | Fix a copy/paste error. In practice this didn't cause any problems because the *_set_type_id and *_get_type_id are either both NULL or both set to the function. Signed-off-by: Brian C. Lane <bcl@redhat.com>
* libparted: add swap flag for DASD labelArvin Schnell2022-05-131-68/+50
| | | | | | | | Support the swap flag and fix reading flags from disk. Also cleanup code by dropping the 2 flags "raid" and "lvm" from DasdPartitionData and instead use "system" directly. Signed-off-by: Brian C. Lane <bcl@redhat.com>
* parted: add type commandArvin Schnell2022-05-134-333/+438
| | | | | | | | | Include the partition type-id and type-uuid in the JSON output. Also add the the command 'type' to set them. Remove redundant flags from DosPartitionData and use only the system variable. Signed-off-by: Brian C. Lane <bcl@redhat.com>
* libparted: Fix syntax-check sc_avoid_if_before_free errorBrian C. Lane2022-03-251-7/+2
| | | | It is safe to free even if they are NULL.
* gpt: Include xalloc-oversized.hBrian C. Lane2022-03-231-0/+1
|
* maint: Update copyright statements to 2022Brian C. Lane2022-03-23112-112/+112
| | | | By running make update-copyright
* maint: Bump library REVISION number for releaseBrian C. Lane2022-03-232-2/+2
|
* gpt: Revert to filesystem GUID when setting flag to offBrian C. Lane2021-09-301-1/+1
|
* gpt: Add linux-home flagArvin Schnell2021-09-302-0/+7
| | | | | | | This sets the partition GUID to the linux home type: 933AC7E1-2EB4-4F13-B844-0E14E2AEF915 Signed-off-by: Brian C. Lane <bcl@redhat.com>
* gpt: Map PED_PARTITON_ flags to GUID valuesArvin Schnell2021-09-291-423/+54
| | | | | | | Drop the 14 flags from _GPTPartitionData that correspond to a partition type/uuid. Use the type/uuid directly instead. Signed-off-by: Brian C. Lane <bcl@redhat.com>
* keep GUID specific attributesArvin Schnell2021-09-231-21/+9
| | | | | | Keep GUID specific attributes when writing GPT. Signed-off-by: Brian C. Lane <bcl@redhat.com>
* hurd: Implement partition table rereadingColin Watson2021-09-221-6/+78
| | | | | | | | We have to tell both the device for the drive itself, it case it implements the partitioned devices, and tell the partition devices to go away, in case they are implemented on their own by using parted. Signed-off-by: Brian C. Lane <bcl@redhat.com>
* hurd: Support rumpdisk-based device namesSamuel Thibault2021-09-221-0/+9
| | | | Signed-off-by: Brian C. Lane <bcl@redhat.com>
* hurd: Fix partition pathsColin Watson2021-09-221-1/+1
| | | | | | | We have always had an 's' to separate drive number from partition number. Signed-off-by: Brian C. Lane <bcl@redhat.com>
* libparted: Check devpath before passing to strlenBrian C. Lane2021-08-251-0/+3
|
* libparted: Tell libdevmapper to retry remove when BUSYBrian C. Lane2021-08-101-0/+1
| | | | | | | | | | | This sets the libdevmapper retry remove flag, which will retry a remove command if it is BUSY. parted already has it's own BUSY retry code, but when run with device-mapper an error can be printed by libdevmapper which can be confusing to the user. Resolves: rhbz#1980697
* libparted: Add swap flag to msdos disklabelBrian C. Lane2021-08-101-2/+22
| | | | | | | | | Previously you had to set the filesystem type to one of the linux-swap options at creation time. With this change you can now toggle the partition swap type using the 'swap' partition flag in the same way that you can on gpt disklabels. Thanks to Arvin Schnell for this patch.
* libparted: Fix potential memory leak in gpt_writeBrian C. Lane2021-06-111-4/+8
| | | | | _generate_header() can return with 1 after allocating gpt so it needs to be freed in the error path.
* libparted: Fix warning about buffer size in Atari labelBrian C. Lane2021-06-111-6/+11
| | | | | | When the Atari table is empty it copies 'PARTEDATARI' into the id, and the start and size bytes. This can be confusion, so turn it into a union of the string and the non-empty values.
* fs: Fix copy-paste error in HFS journal codeBrian C. Lane2021-06-111-3/+5
|
* libparted: Fix potential memory leak in sdmmc_get_product_infoBrian C. Lane2021-06-111-1/+7
|
* libparted: Fix fd check in _flush_cacheBrian C. Lane2021-06-111-1/+1
| | | | In theory open() could return 0 so the correct error value is -1.
* maint: Update copyright statements to 2021Brian C. Lane2021-01-18112-112/+112
| | | | By running make update-copyright
* libparted/fs: Add ./lib to include search pathBrian C. Lane2020-12-111-1/+1
|
* libparted: Check for NULL flag_name in ped_partition_flag_get_by_nameBrian C. Lane2020-12-111-2/+2
| | | | strcasecmp parameters cannot be NULL according to gcc -Wanalyzer-null-argument
* maint: Update copyright statements to 2020Brian C. Lane2020-12-11110-162/+196
| | | | By running make update-copyright
* maint: Bump library REVISION number for releaseBrian C. Lane2020-12-112-2/+2
|
* labels/bsd.c: Drop alpha_bootblock_checksum from bsd_probeBrian C. Lane2020-12-041-2/+0
| | | | | | | | | | | | | Thanks to Alpine Linux for catching this. In commit a5f69f396713ab8ac1e57458cbb9af552d2c1659 I change label to actually point to the label and failed to pass the new s0 to alpha_bootblock_checksum() instead of label. So it was writing the so-called checksum off the end of the 512b sector buffer. bug: https://gitlab.alpinelinux.org/alpine/aports/-/issues/12161 upstream report: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=45026 Signed-off-by: Brian C. Lane <bcl@redhat.com>
* libparted/fs: Fix GCC warnings suggesting pure for PED_ASSERT functionsBrian C. Lane2020-11-203-9/+9
| | | | | | | There was some question about whether or not pure should be used for functions with PED_ASSERT (or exit) in them. It should be fine, since the values checked by the ASSERT are passed to the function directly. Behavior should be exactly the same for the same inputs.
* libparted: Remove disabled codeBrian C. Lane2020-11-203-59/+0
|
* fs/r/hfs: Remove disabled codeBrian C. Lane2020-11-201-194/+0
|
* fs/r/fat: Remove disabled codeBrian C. Lane2020-11-203-275/+0
|
* hfs/reloc_plus: Fix gcc 10 warnings about cast alignmentBrian C. Lane2020-11-201-14/+19
|
* hfs/reloc: Fix gcc 10 warnings about cast alignmentBrian C. Lane2020-11-201-15/+20
|
* ped_assert: Fix incorrect exception optionBrian C. Lane2020-11-201-1/+1
| | | | | PED_EXCEPTION_FATAL is a type, not an option. A PED_EXCEPTION_BUG should always select CANCEL.
* ufs: Fix gcc 10 warnings about cast alignmentBrian C. Lane2020-11-201-4/+4
|
* ntfs: Fix gcc 10 warnings about cast alignmentBrian C. Lane2020-11-201-5/+6
|
* nilfs2: Fix gcc 10 warnings about cast alignmentBrian C. Lane2020-11-201-6/+5
|
* ext2: Fix gcc 10 warnings about cast alignmentBrian C. Lane2020-11-202-4/+5
|
* hfs/hfs: Fix gcc 10 warnings about cast alignmentBrian C. Lane2020-11-201-5/+4
|
* hfs/advfs_plus: Fix gcc 10 warnings about cast alignmentBrian C. Lane2020-11-201-10/+12
|
* hfs/advfs: Fix gcc 10 warnings about cast alignmentBrian C. Lane2020-11-201-11/+14
|