FYI, while preparing to add partition- max-start-sector and max-length
APIs, this makes the existing partition_check function work also for MAC
partition tables.

>From 2b7ed13adab1fff6fc4e945b5dc9f96ace44c99f Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Thu, 3 Dec 2009 10:58:31 +0100
Subject: [PATCH] mac: hook up the partition_check function for this partition 
table type

* libparted/labels/pt-tools.c (ptt_partition_max_start_len): Define
for MAC partition tables.  They too have 32-bit-limited partition
starting sector number and partition length (in sectors).
* libparted/labels/mac.c (mac_partition_check): Use
ptt_partition_max_start_len.
---
 libparted/labels/mac.c      |    2 +-
 libparted/labels/pt-tools.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c
index 561ca5f..319adcc 100644
--- a/libparted/labels/mac.c
+++ b/libparted/labels/mac.c
@@ -1628,7 +1628,7 @@ mac_get_max_supported_partition_count (const PedDisk* 
disk, int *max_n)
 static bool
 mac_partition_check (const PedPartition* part)
 {
-       return true;
+       return ptt_partition_max_start_len ("mac", part);
 }

 static PedDiskOps mac_disk_ops = {
diff --git a/libparted/labels/pt-tools.c b/libparted/labels/pt-tools.c
index 8afec77..48c9384 100644
--- a/libparted/labels/pt-tools.c
+++ b/libparted/labels/pt-tools.c
@@ -98,7 +98,7 @@ ptt_clear_sectors (PedDevice *dev, PedSector start, PedSector 
n)
 int
 ptt_partition_max_start_len (char const *label_type, const PedPartition *part)
 {
-  static char const *const max_32[] = {"msdos", "dvh", "dasd"};
+  static char const *const max_32[] = {"msdos", "dvh", "dasd", "mac"};
   unsigned int i;

   for (i = 0; i < sizeof max_32 / sizeof *max_32; i++)
--
1.6.6.rc0.285.g73651

_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/parted-devel

Reply via email to