[patch] support partiton labels/uuids of common filesystems

Kay Sievers kay.sievers at vrfy.org
Tue May 4 17:57:14 PDT 2004


On Wed, May 05, 2004 at 12:08:22AM +0200, David Zeuthen wrote:
> > Attached is a patch to support the reading of iso9660 and udf labels.
> 
> Very nice, I've applied this. Thanks a lot.
> 
> > If anyone is using a big-endian system, please test if a Video-DVD is
> > recognized as a udf volume with a label.
> > 
> 
> My main development system just happens to be a Powerbook :-). So, it
> works nicely for iso9660 with labels. For DVD's it does detect udf
> correctly but there is no label. I've tested with a region-2 "Boogie
> Nights" DVD disc, here is some debug output from a debug-enabled build,
> hope it is useful
...
> probe_udf: 0x0 descriptors starting at logical secor 0x0

It's hopefully fixed. The 0x0 descriptor was the key :) I need to take
32 bit numbers instead of just 16. Big endian code just got the upper
zeros.

> > Hmm, seems we need to call detect_fs() for the cdrom volumes, it's not
> > working with this patch alone.
> > 
> 
> This is fixed; I've also fixed another bug where multiple discs were
> added due to callouts taking some time.

Works nice on my box. I really enjoy it now, to watch hal-device-manager
updating the property strings, just by inserting the 10th DVD in the drive :)

thanks,
Kay
-------------- 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.2
diff -u -r1.2 volume_id.c
--- hald/linux/volume_id/volume_id.c	4 May 2004 21:56:47 -0000	1.2
+++ hald/linux/volume_id/volume_id.c	5 May 2004 00:33:55 -0000
@@ -538,6 +538,8 @@
 	for (b = 0; b < 64; b++) {
 		vsd = (struct volume_structure_descriptor *)
 		      get_buffer(id, UDF_VSD_OFFSET + (b * bs), 0x800);
+		if (vsd == NULL)
+			return -1;
 
 		dbg("vsd: %c%c%c%c%c",
 		    vsd->id[0], vsd->id[1], vsd->id[2], vsd->id[3], vsd->id[4]);
@@ -555,21 +557,23 @@
 	/* read anchor volume descriptor */
 	vd = (struct volume_descriptor *) get_buffer(id, 256 * bs, 0x200);
 	if (vd == NULL)
-		goto found;
+		return -1;
 
 	type = le16_to_cpu(vd->tag.id);
 	if (type != 2) /* TAG_ID_AVDP */
 		goto found;
 
 	/* get desriptor list address and block count */
-	count = le16_to_cpu(vd->type.anchor.length) / bs;
-	loc = le16_to_cpu(vd->type.anchor.location);
+	count = le32_to_cpu(vd->type.anchor.length) / bs;
+	loc = le32_to_cpu(vd->type.anchor.location);
 	dbg("0x%x descriptors starting at logical secor 0x%x", count, loc);
 
 	/* pick the primary descriptor from the list */
 	for (b = 0; b < count; b++) {
 		vd = (struct volume_descriptor *)
 		     get_buffer(id, (loc + b) * bs, 0x200);
+		if (vd == NULL)
+			return -1;
 
 		type = le16_to_cpu(vd->tag.id);
 		dbg("descriptor type %i", type);
-------------- next part --------------
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal


More information about the Hal mailing list