bug-parted
[Top][All Lists]
Advanced

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

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


From: Hans de Goede
Subject: [PATCH parted 3/4] linux: Use cached major minor instead of statting the device again
Date: Fri, 6 Nov 2009 17:50:51 +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 0d471ab..d5d3597 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2340,22 +2340,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.2





reply via email to

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