[Parted-commits] GNU Parted Official Repository: Changes to 'master'
Jim Meyering
meyering at alioth.debian.org
Thu Sep 29 11:16:58 UTC 2011
libparted/labels/dvh.c | 26 ++++----------------------
1 file changed, 4 insertions(+), 22 deletions(-)
New commits:
commit b10b9c125a6b168c6bcac1644e529f1ea05be3da
Author: Petr Uzel <petr.uzel at suse.cz>
Date: Thu Sep 29 11:38:30 2011 +0200
dvh: factor out read_sector and use ptt_read_sector
* libparted/labels/dvh.c (read_sector): Factor out this function.
(dvh_probe): Use ptt_read_sector instead of read_sector.
(dvh_read): Likewise.
diff --git a/libparted/labels/dvh.c b/libparted/labels/dvh.c
index 6378c04..8f4a208 100644
--- a/libparted/labels/dvh.c
+++ b/libparted/labels/dvh.c
@@ -60,31 +60,13 @@ typedef struct _DVHPartData {
static PedDiskType dvh_disk_type;
-/* FIXME: factor out this function: copied from aix.c, with changes to
- the description, and an added sector number argument.
- 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. */
-static int
-read_sector (const PedDevice *dev, PedSector sector_num, char **buf)
-{
- char *b = ped_malloc (dev->sector_size);
- PED_ASSERT (b != NULL);
- if (!ped_device_read (dev, b, sector_num, 1)) {
- free (b);
- return 0;
- }
- *buf = b;
- return 1;
-}
-
static int
dvh_probe (const PedDevice *dev)
{
struct volume_header *vh;
- char *label;
- if (!read_sector (dev, 0, &label))
+ void *label;
+ if (!ptt_read_sector (dev, 0, &label))
return 0;
vh = (struct volume_header *) label;
@@ -313,8 +295,8 @@ dvh_read (PedDisk* disk)
ped_disk_delete_all (disk);
- char *s0;
- if (!read_sector (disk->dev, 0, &s0))
+ void *s0;
+ if (!ptt_read_sector (disk->dev, 0, &s0))
return 0;
memcpy (&vh, s0, sizeof vh);
free (s0);
More information about the Parted-commits
mailing list