support for hfs(+)-fs on a CD

Kay Sievers kay.sievers at vrfy.org
Thu Jul 29 13:39:34 PDT 2004


On Thu, Jul 29, 2004 at 10:00:23PM +0200, Kay Sievers wrote:
> On Thu, 2004-07-29 at 21:49 +0200, David Zeuthen wrote:

> > 00001200  50 4d 00 00 00 00 00 0a  00 00 03 c8 00 72 0c 30  |PM...........r.0|
> > 00001210  4d 61 63 5f 4f 53 5f 58  00 00 00 00 00 00 00 00  |Mac_OS_X........|
> > 00001220  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
> > 00001230  41 70 70 6c 65 5f 48 46  53 00 00 00 00 00 00 00  |Apple_HFS.......|
> > 00001240  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
> > 00001250  00 00 00 00 00 72 0c 30  40 00 00 7f 00 00 3a f0  |.....r.0 at .....:.|
> > 00001260  00 0c 10 00 01 c0 00 00  00 00 00 00 01 c0 0c b0  |................|
> > 00001270  00 00 00 00 00 00 00 00  70 6f 77 65 72 70 63 00  |........powerpc.|
> > 00001280  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
> > *
> > 00001320  00 00 00 00 00 00 00 00  67 6f 6f 6e 00 00 00 00  |........goon....|
> > 00001330  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
> > *
> > 000013d0  00 00 00 00 00 23 ff ff  00 00 00 00 00 00 00 00  |.....#..........|
> > 000013e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
> > *
> > 00001400
> 
> Oh, bad. This is a single session with actually the 9th of the partition
> as the data we are looking for. Don't know, what the guys at Apple are
> smoking :) I will change it to look for the first valid partition, not
> assuming that it's the first after the partiton table.

Hey David,
here we search for the first 'Apple_HFS' type partition. Please have a look
with your multi-multi-multi-partition DVD :)
Can you send the debug output, even when it works for you. I want to see
the 10 partition scan loop on this disk.

Thanks,
Kay

-- 
I'm in the cinema and out for the rest of the night, so see you later...
-------------- next part --------------
Index: hald/linux/volume_id/volume_id.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/volume_id/volume_id.c,v
retrieving revision 1.16
diff -u -r1.16 volume_id.c
--- hald/linux/volume_id/volume_id.c	29 Jul 2004 17:43:58 -0000	1.16
+++ hald/linux/volume_id/volume_id.c	29 Jul 2004 20:31:51 -0000
@@ -1076,21 +1076,44 @@
 		 * just try to probe the first partition from the map */
 		unsigned int bsize = be16_to_cpu(driver->block_size);
 		unsigned long start;
+		int part_count;
+		int i;
 
-		buf = get_buffer(id, 2 * bsize, 0x200);
+		/* get first entry of partition table */
+		buf = get_buffer(id,  bsize, 0x200);
 		if (buf == NULL)
 			return -1;
+
 		part = (struct mac_partition *) buf;
+		if (strncmp(part->signature, "PM", 2) != 0)
+			return -1;
+
+		part_count = be32_to_cpu(part->map_count);
+		dbg("expecting %d partition entries", part_count);
+
+		for (i = 1; i <= part_count; i++) {
+			buf = get_buffer(id, i *  bsize, 0x200);
+			if (buf == NULL)
+				return -1;
+
+			part = (struct mac_partition *) buf;
+			if (strncmp(part->signature, "PM", 2) != 0)
+				return -1;
 
-		if (strncmp(part->signature, "PM", 2) == 0) {
 			start = be32_to_cpu(part->start_block) * bsize;
 			dbg("found '%s' partition entry pointing to 0x%lx",
 			    part->type, start);
 
-			partition_off = start;
+			if (strncmp(part->type, "Apple_HFS", 9) == 0) {
+				partition_off = start;
+				goto check;
+			}
 		}
+		return -1;
 	}
 
+
+check:
 	buf = get_buffer(id, partition_off + HFS_SUPERBLOCK_OFFSET, 0x200);
 	if (buf == NULL)
                 return -1;
Index: hald/linux/volume_id/volume_id.h
===================================================================
RCS file: /cvs/hal/hal/hald/linux/volume_id/volume_id.h,v
retrieving revision 1.6
diff -u -r1.6 volume_id.h
--- hald/linux/volume_id/volume_id.h	29 Jul 2004 17:07:09 -0000	1.6
+++ hald/linux/volume_id/volume_id.h	29 Jul 2004 20:31:51 -0000
@@ -21,7 +21,7 @@
 #ifndef _VOLUME_ID_H_
 #define _VOLUME_ID_H_
 
-#define VOLUME_ID_VERSION		005
+#define VOLUME_ID_VERSION		006
 
 #define VOLUME_ID_LABEL_SIZE		64
 #define VOLUME_ID_UUID_SIZE		16
-------------- next part --------------
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal


More information about the Hal mailing list