hal/hald/linux/volume_id volume_id.c,1.16,1.17 volume_id.h,1.6,1.7
David Zeuthen
david at freedesktop.org
Thu Jul 29 13:58:39 PDT 2004
Update of /cvs/hal/hal/hald/linux/volume_id
In directory pdx:/tmp/cvs-serv17229/hald/linux/volume_id
Modified Files:
volume_id.c volume_id.h
Log Message:
2004-07-29 David Zeuthen <david at fubar.dk>
Patch from Kay Sievers <kay.sievers at vrfy.org>
* hald/linux/volume_id/volume_id.c (probe_hfs_hfsplus):
here we search for the first 'Apple_HFS' type partition. Please
have a look with your multi-multi-multi-partition DVD :)
Index: volume_id.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/volume_id/volume_id.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- volume_id.c 29 Jul 2004 17:43:58 -0000 1.16
+++ volume_id.c 29 Jul 2004 20:58:37 -0000 1.17
@@ -43,7 +43,6 @@
#include "volume_id.h"
-#define DEBUG
#ifdef DEBUG
#define dbg(format, arg...) \
do { \
@@ -1076,21 +1075,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: volume_id.h
===================================================================
RCS file: /cvs/hal/hal/hald/linux/volume_id/volume_id.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- volume_id.h 29 Jul 2004 17:07:09 -0000 1.6
+++ volume_id.h 29 Jul 2004 20:58:37 -0000 1.7
@@ -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
More information about the hal-commit
mailing list