return write_ok;
}
-/* Read sector, SECTOR_NUM (which has length DEV->sector_size) into malloc'd
- storage. If the read fails, free the memory and return zero without
- modifying *BUF. Otherwise, set *BUF to the new buffer and return 1. */
+/* Read N sectors, starting with sector SECTOR_NUM (which has length
+ DEV->sector_size) into malloc'd storage. If the read fails, free
+ the memory and return zero without modifying *BUF. Otherwise, set
+ *BUF to the new buffer and return 1. */
int
-ptt_read_sector (PedDevice const *dev, PedSector sector_num, void **buf)
+ptt_read_sectors (PedDevice const *dev, PedSector start_sector,
+ PedSector n_sectors, void **buf)
{
- char *b = ped_malloc (dev->sector_size);
+ char *b = ped_malloc (n_sectors * dev->sector_size);
PED_ASSERT (b != NULL, return 0);
- if (!ped_device_read (dev, b, sector_num, 1)) {
+ if (!ped_device_read (dev, b, start_sector, n_sectors)) {
free (b);
return 0;
}
return 1;
}
+/* Read sector, SECTOR_NUM (which has length DEV->sector_size) into malloc'd
+ storage. If the read fails, free the memory and return zero without
+ modifying *BUF. Otherwise, set *BUF to the new buffer and return 1. */
+int
+ptt_read_sector (PedDevice const *dev, PedSector sector_num, void **buf)
+{
+ return ptt_read_sectors (dev, sector_num, 1, buf);
+}
+
/* Zero N sectors of DEV, starting with START.
Return nonzero to indicate success, zero otherwise. */
int
int ptt_write_sector (PedDisk const *disk, void const *buf, size_t buflen);
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_partition_max_start_len (char const *label_type,
const PedPartition *part);