GNU bug report logs - #15352
[PATCH 04/19] libparted: preserve the uuid on dm partitions (#832145)

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: parted; Reported by: "Brian C. Lane" <bcl@HIDDEN>; Keywords: patch; dated Wed, 11 Sep 2013 20:17:02 UTC; Maintainer for parted is bug-parted@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 11 Sep 2013 20:16:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 11 16:16:40 2013
Received: from localhost ([127.0.0.1]:56506 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VJqq8-0004KG-AZ
	for submit <at> debbugs.gnu.org; Wed, 11 Sep 2013 16:16:40 -0400
Received: from eggs.gnu.org ([208.118.235.92]:46467)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <bcl@HIDDEN>) id 1VJqq6-0004K2-BX
 for submit <at> debbugs.gnu.org; Wed, 11 Sep 2013 16:16:38 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <bcl@HIDDEN>) id 1VJqpq-00020r-MJ
 for submit <at> debbugs.gnu.org; Wed, 11 Sep 2013 16:16:33 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:60843)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bcl@HIDDEN>) id 1VJqpq-00020g-Jn
 for submit <at> debbugs.gnu.org; Wed, 11 Sep 2013 16:16:22 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:48059)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bcl@HIDDEN>) id 1VJqpk-0002uk-IZ
 for bug-parted@HIDDEN; Wed, 11 Sep 2013 16:16:22 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <bcl@HIDDEN>) id 1VJqpe-0001ut-J6
 for bug-parted@HIDDEN; Wed, 11 Sep 2013 16:16:16 -0400
Received: from neil.brianlane.com ([24.113.37.65]:44100
 helo=lister.brianlane.com) by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bcl@HIDDEN>) id 1VJqpe-0000sS-9Y
 for bug-parted@HIDDEN; Wed, 11 Sep 2013 16:16:10 -0400
Received: from lister.brianlane.com (localhost [127.0.0.1])
 by lister.brianlane.com (8.14.7/8.14.7) with ESMTP id r8BJPFJK015290
 for <bug-parted@HIDDEN>; Wed, 11 Sep 2013 12:25:15 -0700
Received: (from bcl@localhost)
 by lister.brianlane.com (8.14.7/8.14.7/Submit) id r8BJPFc6015289
 for bug-parted@HIDDEN; Wed, 11 Sep 2013 12:25:15 -0700
From: "Brian C. Lane" <bcl@HIDDEN>
To: bug-parted@HIDDEN
Subject: [PATCH 04/19] libparted: preserve the uuid on dm partitions (#832145)
Date: Wed, 11 Sep 2013 12:24:54 -0700
Message-Id: <1378927509-15215-5-git-send-email-bcl@HIDDEN>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1378927509-15215-1-git-send-email-bcl@HIDDEN>
References: <1378927509-15215-1-git-send-email-bcl@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

From: "Brian C. Lane" <bcl@HIDDEN>

* libparted/arch/linux.c (_dm_add_partition): Set the uuid if there was
  one.
---
 libparted/arch/linux.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 1c5faa5..375be83 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2711,9 +2711,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);
@@ -2727,7 +2730,7 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part)
         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,
@@ -2736,6 +2739,11 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part)
         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;
@@ -2748,6 +2756,8 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part)
                 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))
@@ -2756,6 +2766,7 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part)
                 dm_task_update_nodes ();
                 dm_task_destroy (task);
                 free (params);
+                free (vol_uuid);
                 free (vol_name);
                 return 1;
         } else {
@@ -2766,6 +2777,7 @@ err:
         if (task)
                 dm_task_destroy (task);
         free (params);
+        free (vol_uuid);
         free (vol_name);
         return 0;
 }
-- 
1.8.3.1





Acknowledgement sent to "Brian C. Lane" <bcl@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-parted@HIDDEN. Full text available.
Report forwarded to bug-parted@HIDDEN:
bug#15352; Package parted. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.