hal/hald/linux/volume_id volume_id.c,1.45.2.1,1.45.2.2
David Zeuthen
david at freedesktop.org
Thu Jan 6 19:26:53 PST 2005
Update of /cvs/hal/hal/hald/linux/volume_id
In directory gabe:/tmp/cvs-serv6751/hald/linux/volume_id
Modified Files:
Tag: hal-0_4-stable-branch
volume_id.c
Log Message:
2005-01-06 David Zeuthen <davidz at redhat.com>
* hald/linux/volume_id/volume_id.c (probe_iso9660): Patch from
Leon Breedt <bitserf at gmail.com>. Signed off by Kay Sievers
<kay.sievers at vrfy.org>. It seems Joliet stores the volume label in
something called a Supplementary Volume Descriptor (located some
where after the Primary Volume Descriptor). This has largely the
same format as a PVD, and the volume_id field of this descriptor
contains the UTF-16 (Big Endian) encoded volume ID. I've created a
patch that uses this instead if present, and it works for me. As
in, the names in lshal and hal-device-manager are correctly
displayed.
Index: volume_id.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/volume_id/volume_id.c,v
retrieving revision 1.45.2.1
retrieving revision 1.45.2.2
diff -u -d -r1.45.2.1 -r1.45.2.2
--- volume_id.c 22 Nov 2004 21:53:50 -0000 1.45.2.1
+++ volume_id.c 7 Jan 2005 03:26:51 -0000 1.45.2.2
@@ -1214,6 +1214,12 @@
}
#define ISO_SUPERBLOCK_OFFSET 0x8000
+#define ISO_SECTOR_SIZE 0x800
+#define ISO_VD_OFFSET (ISO_SUPERBLOCK_OFFSET + ISO_SECTOR_SIZE)
+#define ISO_VD_PRIMARY 0x1
+#define ISO_VD_SUPPLEMENTARY 0x2
+#define ISO_VD_END 0xff
+#define ISO_VD_MAX 16
static int probe_iso9660(struct volume_id *id, __u64 off)
{
union iso_super_block {
@@ -1239,8 +1245,36 @@
return -1;
if (strncmp(is->iso.id, "CD001", 5) == 0) {
- set_label_raw(id, is->iso.volume_id, 32);
- set_label_string(id, is->iso.volume_id, 32);
+ int vd_offset;
+ int i;
+ __u8 found_svd;
+
+ found_svd = 0;
+ vd_offset = ISO_VD_OFFSET;
+ for (i = 0; i < ISO_VD_MAX; i++) {
+ is = (union iso_super_block *)
+ get_buffer (id, off + vd_offset, 0x200);
+ if (is == NULL || is->iso.type == ISO_VD_END)
+ break;
+ if (is->iso.type == ISO_VD_SUPPLEMENTARY) {
+ dbg("found ISO supplementary VD at offset 0x%x", off + vd_offset);
+ found_svd = 1;
+ break;
+ }
+ vd_offset += ISO_SECTOR_SIZE;
+ }
+
+ if (!found_svd) {
+ is = (union iso_super_block *)
+ get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200);
+ if (is == NULL)
+ return -1;
+ set_label_raw(id, is->iso.volume_id, 32);
+ set_label_string(id, is->iso.volume_id, 32);
+ } else {
+ set_label_raw(id, is->iso.volume_id, 32);
+ set_label_unicode16(id, is->iso.volume_id, BE, 32);
+ }
goto found;
}
if (strncmp(is->hs.id, "CDROM", 5) == 0)
More information about the hal-commit
mailing list