bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH parted 3/3] linux: Use cached major minor instead of statting the


From: Hans de Goede
Subject: [PATCH parted 3/3] linux: Use cached major minor instead of statting the device again
Date: Mon, 2 Nov 2009 14:37:00 +0100

---
 libparted/arch/linux.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 3ca938a..a87f7e2 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2333,22 +2333,20 @@ err:
 static int
 _dm_remove_parts (PedDevice* dev)
 {
-        struct stat             dev_stat;
         struct dm_task*         task = NULL;
         struct dm_info*         info = alloca(sizeof *info);
         struct dm_names*        names = NULL;
         unsigned int            next = 0;
         int                     rc;
-
-        if (!_device_stat (dev, &dev_stat))
-                goto err;
+        LinuxSpecific*          arch_specific = LINUX_SPECIFIC (dev);
 
         task = dm_task_create(DM_DEVICE_LIST);
         if (!task)
                 goto err;
 
-        dm_task_set_major (task, major (dev_stat.st_rdev));
-        dm_task_set_minor (task, minor (dev_stat.st_rdev));
+        if (!dm_task_set_major_minor(task, arch_specific->major,
+                                     arch_specific->minor, 0))
+                goto err;
 
         rc = dm_task_run(task);
         if (rc < 0)
-- 
1.6.5.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]