summaryrefslogtreecommitdiff
path: root/libparted
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-12-21 16:56:17 +0100
committerJim Meyering <meyering@redhat.com>2012-01-12 19:09:47 +0100
commitb87498c214ed9ae74cdca3b44cdb83f749f654db (patch)
tree84e8752d24d96820d28fb76f50a2f39367497200 /libparted
parent9f5a705742c220b24905e55641d412b294398677 (diff)
downloadparted-b87498c214ed9ae74cdca3b44cdb83f749f654db.tar.gz
libparted: provide a new convenience function: ptt_geom_clear_sectors
* libparted/labels/pt-tools.c (ptt_geom_clear_sectors): New function. * libparted/labels/pt-tools.h: Declare it.
Diffstat (limited to 'libparted')
-rw-r--r--libparted/labels/pt-tools.c8
-rw-r--r--libparted/labels/pt-tools.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/libparted/labels/pt-tools.c b/libparted/labels/pt-tools.c
index a8ac4e4..2693151 100644
--- a/libparted/labels/pt-tools.c
+++ b/libparted/labels/pt-tools.c
@@ -103,6 +103,14 @@ ptt_clear_sectors (PedDevice *dev, PedSector start, PedSector n)
? 1 : ped_device_write (dev, zero, start + n_z_sectors * i, rem));
}
+/* Zero N sectors of GEOM->dev, starting with GEOM->start + START.
+ Return nonzero to indicate success, zero otherwise. */
+int
+ptt_geom_clear_sectors (PedGeometry *geom, PedSector start, PedSector n)
+{
+ return ptt_clear_sectors (geom->dev, geom->start + start, n);
+}
+
#include "pt-limit.c"
/* Throw an exception and return 0 if PART's starting sector number or
diff --git a/libparted/labels/pt-tools.h b/libparted/labels/pt-tools.h
index ba02977..aa31122 100644
--- a/libparted/labels/pt-tools.h
+++ b/libparted/labels/pt-tools.h
@@ -22,6 +22,8 @@ int ptt_read_sector (PedDevice const *dev, PedSector sector_num, void **buf);
int ptt_read_sectors (PedDevice const *dev, PedSector start_sector,
PedSector n_sectors, void **buf);
int ptt_clear_sectors (PedDevice *dev, PedSector start, PedSector count);
+int ptt_geom_clear_sectors (PedGeometry *geom, PedSector start,
+ PedSector count);
int ptt_partition_max_start_len (char const *label_type,
const PedPartition *part);