summaryrefslogtreecommitdiffstats
path: root/sys/fs/udf
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2006-07-25 14:15:50 +0000
committeryar <yar@FreeBSD.org>2006-07-25 14:15:50 +0000
commitee7ffb561f04fe7650eb52de8352642966629792 (patch)
treec7a74f12ad4b83ed917cc194329043d1a38a54bd /sys/fs/udf
parent4dc957df411d6874bf6d2f119ff55f1826d45802 (diff)
downloadFreeBSD-src-ee7ffb561f04fe7650eb52de8352642966629792.zip
FreeBSD-src-ee7ffb561f04fe7650eb52de8352642966629792.tar.gz
In udf_find_partmaps(), when we find a type 1 partition map, we have to
skip the actual type 1 length (6 bytes). With this change, it is now possible to correctly spot the VAT partition map in certain discs. Submitted by: Pedro Martelletto <pedro@ambientworks.net>
Diffstat (limited to 'sys/fs/udf')
-rw-r--r--sys/fs/udf/ecma167-udf.h7
-rw-r--r--sys/fs/udf/udf_vfsops.c16
2 files changed, 13 insertions, 10 deletions
diff --git a/sys/fs/udf/ecma167-udf.h b/sys/fs/udf/ecma167-udf.h
index 6c7f943..2d78758 100644
--- a/sys/fs/udf/ecma167-udf.h
+++ b/sys/fs/udf/ecma167-udf.h
@@ -201,8 +201,6 @@ struct logvol_desc {
uint8_t maps[1];
} __packed;
-#define UDF_PMAP_SIZE 64
-
/* Type 1 Partition Map [3/10.7.2] */
struct part_map_1 {
uint8_t type;
@@ -211,6 +209,8 @@ struct part_map_1 {
uint16_t part_num;
} __packed;
+#define UDF_PMAP_TYPE1_SIZE 6
+
/* Type 2 Partition Map [3/10.7.3] */
struct part_map_2 {
uint8_t type;
@@ -218,6 +218,8 @@ struct part_map_2 {
uint8_t part_id[62];
} __packed;
+#define UDF_PMAP_TYPE2_SIZE 64
+
/* Virtual Partition Map [UDF 2.01/2.2.8] */
struct part_map_virt {
uint8_t type;
@@ -245,7 +247,6 @@ struct part_map_spare {
} __packed;
union udf_pmap {
- uint8_t data[UDF_PMAP_SIZE];
struct part_map_1 pm1;
struct part_map_2 pm2;
struct part_map_virt pmv;
diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c
index 816f65a..706816e 100644
--- a/sys/fs/udf/udf_vfsops.c
+++ b/sys/fs/udf/udf_vfsops.c
@@ -723,30 +723,31 @@ udf_vptofh (struct vnode *vp, struct fid *fhp)
static int
udf_find_partmaps(struct udf_mnt *udfmp, struct logvol_desc *lvd)
{
- union udf_pmap *pmap;
struct part_map_spare *pms;
struct regid *pmap_id;
struct buf *bp;
unsigned char regid_id[UDF_REGID_ID_SIZE + 1];
int i, k, ptype, psize, error;
+ uint8_t *pmap = (uint8_t *) &lvd->maps[0];
for (i = 0; i < le32toh(lvd->n_pm); i++) {
- pmap = (union udf_pmap *)&lvd->maps[i * UDF_PMAP_SIZE];
- ptype = pmap->data[0];
- psize = pmap->data[1];
+ ptype = pmap[0];
+ psize = pmap[1];
if (((ptype != 1) && (ptype != 2)) ||
- ((psize != UDF_PMAP_SIZE) && (psize != 6))) {
+ ((psize != UDF_PMAP_TYPE1_SIZE) &&
+ (psize != UDF_PMAP_TYPE2_SIZE))) {
printf("Invalid partition map found\n");
return (1);
}
if (ptype == 1) {
/* Type 1 map. We don't care */
+ pmap += UDF_PMAP_TYPE1_SIZE;
continue;
}
/* Type 2 map. Gotta find out the details */
- pmap_id = (struct regid *)&pmap->data[4];
+ pmap_id = (struct regid *)&pmap[4];
bzero(&regid_id[0], UDF_REGID_ID_SIZE);
bcopy(&pmap_id->id[0], &regid_id[0], UDF_REGID_ID_SIZE);
@@ -756,7 +757,8 @@ udf_find_partmaps(struct udf_mnt *udfmp, struct logvol_desc *lvd)
return (1);
}
- pms = &pmap->pms;
+ pms = (struct part_map_spare *)pmap;
+ pmap += UDF_PMAP_TYPE2_SIZE;
MALLOC(udfmp->s_table, struct udf_sparing_table *,
le32toh(pms->st_size), M_UDFMOUNT, M_NOWAIT | M_ZERO);
if (udfmp->s_table == NULL)
OpenPOWER on IntegriCloud