Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:FrontRunner
parted.14698
libparted-dasd-add-swap-flag-handling-for-DASD-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libparted-dasd-add-swap-flag-handling-for-DASD-CDL.patch of Package parted.14698
From: Sebastian Parschauer <sparschauer@suse.de> Date: Thu, 15 Jun 2017 19:04:41 +0200 Subject: libparted/dasd: add swap flag handling for DASD-CDL References: fate#314888, bsc#1044536 Patch-mainline: no, upstream wants to drop the swap flag The way how the linux-swap partition type is handled is not how fdasd handles it. It is only set if there is a linux-swap file system set with mkpart or if there is a swap file system created by mkswap on disk. But we want to know the partition type on disk. So introduce a swap flag which behaves like the other flags. The parted function do_mkpart() sets this flag for us if creating a partition with FS type name "linux-swap*". Signed-off-by: Sebastian Parschauer <sparschauer@suse.de> --- libparted/labels/dasd.c | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) --- a/libparted/labels/dasd.c +++ b/libparted/labels/dasd.c @@ -65,6 +65,7 @@ extern void ped_disk_dasd_done (); typedef struct { int type; int system; + int swap; int raid; int lvm; } DasdPartitionData; @@ -316,6 +317,7 @@ dasd_read (PedDisk* disk) part->num = 1; part->fs_type = ped_file_system_probe (&part->geom); dasd_data = part->disk_specific; + dasd_data->swap = 0; dasd_data->raid = 0; dasd_data->lvm = 0; dasd_data->type = 0; @@ -400,6 +402,7 @@ dasd_read (PedDisk* disk) part->num = 1; part->fs_type = ped_file_system_probe (&part->geom); dasd_data = part->disk_specific; + dasd_data->swap = 0; dasd_data->raid = 0; dasd_data->lvm = 0; dasd_data->type = 0; @@ -457,18 +460,11 @@ dasd_read (PedDisk* disk) } dasd_data = part->disk_specific; + dasd_data->swap = !strncmp(PART_TYPE_SWAP, str, 6); dasd_data->raid = !strncmp(PART_TYPE_RAID, str, 6); dasd_data->lvm = !strncmp(PART_TYPE_LVM, str, 6); dasd_partition_set_system(part, part->fs_type); - if (strncmp(PART_TYPE_SWAP, str, 6) == 0) { - fs = ped_file_system_probe(&part->geom); - if (fs && is_linux_swap(fs->name)) { - dasd_data->system = PARTITION_LINUX_SWAP; - PDEBUG; - } - } - vtoc_ebcdic_enc(p->f1->DS1DSNAM, p->f1->DS1DSNAM, 44); dasd_data->type = 0; @@ -745,14 +741,25 @@ dasd_partition_set_flag (PedPartition* p dasd_data = part->disk_specific; switch (flag) { + case PED_PARTITION_SWAP: + if (state) { + dasd_data->raid = 0; + dasd_data->lvm = 0; + } + dasd_data->swap = state; + return ped_partition_set_system(part, part->fs_type); case PED_PARTITION_RAID: - if (state) + if (state) { + dasd_data->swap = 0; dasd_data->lvm = 0; + } dasd_data->raid = state; return ped_partition_set_system(part, part->fs_type); case PED_PARTITION_LVM: - if (state) + if (state) { + dasd_data->swap = 0; dasd_data->raid = 0; + } dasd_data->lvm = state; return ped_partition_set_system(part, part->fs_type); default: @@ -770,6 +777,8 @@ dasd_partition_get_flag (const PedPartit dasd_data = part->disk_specific; switch (flag) { + case PED_PARTITION_SWAP: + return dasd_data->swap; case PED_PARTITION_RAID: return dasd_data->raid; case PED_PARTITION_LVM: @@ -784,6 +793,8 @@ dasd_partition_is_flag_available (const PedPartitionFlag flag) { switch (flag) { + case PED_PARTITION_SWAP: + return 1; case PED_PARTITION_RAID: return 1; case PED_PARTITION_LVM: @@ -962,17 +973,14 @@ dasd_partition_set_system (PedPartition* return 1; } - if (!fs_type) { - dasd_data->system = PARTITION_LINUX; - PDEBUG; - } else if (is_linux_swap (fs_type->name)) { + if (dasd_data->swap) { dasd_data->system = PARTITION_LINUX_SWAP; PDEBUG; - } else { - dasd_data->system = PARTITION_LINUX; - PDEBUG; + return 1; } + dasd_data->system = PARTITION_LINUX; + PDEBUG; return 1; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor