Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:Update
parted
libparted-preserve-uuid-on-dm-part.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libparted-preserve-uuid-on-dm-part.patch of Package parted
From: "Brian C. Lane" <bcl@redhat.com> Date: Wed, 11 Sep 2013 12:24:54 -0700 Subject: libparted: preserve the uuid on dm partitions (#832145) References: bsc#501773, bsc#1092327 Patch-mainline: v3.2 Git-commit: 39e38c0a4c0f3ad0e029792e0ddee9761b956c1e * libparted/arch/linux.c (_dm_add_partition): Set the uuid if there was one. Acked-by: Sebastian Parschauer <sparschauer@suse.de> --- libparted/arch/linux.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) --- a/libparted/arch/linux.c +++ b/libparted/arch/linux.c @@ -2697,9 +2697,12 @@ static int _dm_add_partition (PedDisk* disk, const PedPartition* part) { LinuxSpecific* arch_specific = LINUX_SPECIFIC (disk->dev); - char *params = NULL; - char *vol_name = NULL; - uint32_t cookie = 0; + char* params = NULL; + char* vol_name = NULL; + const char* dev_name = NULL; + char* vol_uuid = NULL; + const char* dev_uuid = NULL; + uint32_t cookie = 0; /* Get map name from devicemapper */ struct dm_task *task = dm_task_create (DM_DEVICE_INFO); @@ -2713,7 +2716,7 @@ _dm_add_partition (PedDisk* disk, const if (!dm_task_run(task)) goto err; - const char *dev_name = dm_task_get_name (task); + dev_name = dm_task_get_name (task); size_t name_len = strlen (dev_name); vol_name = zasprintf ("%s%s%d", dev_name, @@ -2722,6 +2725,11 @@ _dm_add_partition (PedDisk* disk, const if (vol_name == NULL) goto err; + dev_uuid = dm_task_get_uuid (task); + if (dev_uuid && (strlen(dev_uuid) > 0) + && !(vol_uuid = zasprintf ("part%d-%s", part->num, dev_uuid))) + goto err; + /* Caution: dm_task_destroy frees dev_name. */ dm_task_destroy (task); task = NULL; @@ -2734,6 +2742,8 @@ _dm_add_partition (PedDisk* disk, const goto err; dm_task_set_name (task, vol_name); + if (vol_uuid) + dm_task_set_uuid (task, vol_uuid); dm_task_add_target (task, 0, part->geom.length, "linear", params); if (!dm_task_set_cookie (task, &cookie, 0)) @@ -2742,6 +2752,7 @@ _dm_add_partition (PedDisk* disk, const dm_task_update_nodes (); dm_task_destroy (task); free (params); + free (vol_uuid); free (vol_name); return 1; } else { @@ -2752,6 +2763,7 @@ err: if (task) dm_task_destroy (task); free (params); + free (vol_uuid); free (vol_name); return 0; }
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