[parted-devel] [PATCH 1/4] loop: simplify/correct loop_clobber
Jim Meyering
jim at meyering.net
Thu Nov 26 14:57:55 UTC 2009
From: Jim Meyering <meyering at redhat.com>
Before, it would clear a sector only if it recognized its own
signature. In addition, it would continue clearing subsequent
sectors as long as loop_probe succeeded. Now we simply clear
the first sector.
* libparted/labels/loop.c (loop_clobber): Simplify.
---
libparted/labels/loop.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/libparted/labels/loop.c b/libparted/labels/loop.c
index b08a04e..76a99af 100644
--- a/libparted/labels/loop.c
+++ b/libparted/labels/loop.c
@@ -78,13 +78,7 @@ static int
loop_clobber (PedDevice* dev)
{
PED_ASSERT (dev != NULL, return 0);
-
- PedSector i = 0;
- while (loop_probe (dev)) {
- if (!ptt_clear_sectors (dev, i++, 1))
- return 0;
- }
- return 1;
+ return ptt_clear_sectors (dev, 0, 1);
}
#endif /* !DISCOVER_ONLY */
--
1.6.6.rc0.54.gb073b
More information about the parted-devel
mailing list