Make a better guess on VAT locations so discs that are semi-standard

formatted can be recognised. This also fixes the bug that prevented UDF to
mount an empty CD-R/DVD*R disc.
This commit is contained in:
reinoud 2006-08-21 23:52:19 +00:00
parent a6fdd24769
commit 5223c4995c
2 changed files with 15 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: udf.h,v 1.4 2006/02/02 21:58:40 christos Exp $ */
/* $NetBSD: udf.h,v 1.5 2006/08/21 23:52:19 reinoud Exp $ */
/*
* Copyright (c) 2006 Reinoud Zandijk
@ -153,15 +153,19 @@ struct udf_mount {
int vtop[UDF_PMAPS+1]; /* vpartnr trans */
int vtop_tp[UDF_PMAPS+1]; /* type of trans */
uint32_t possible_vat_location; /* predicted */
/* VAT */
uint32_t first_possible_vat_location;
uint32_t last_possible_vat_location;
uint32_t vat_table_alloc_length;
uint32_t vat_entries;
uint32_t vat_offset; /* offset in table */
uint8_t *vat_table; /* read in data */
/* sparable */
uint32_t sparable_packet_len;
struct udf_sparing_table*sparing_table;
/* meta */
struct udf_node *metafile;
struct udf_node *metabitmapfile;
struct udf_node *metacopyfile;

View File

@ -1,4 +1,4 @@
/* $NetBSD: udf_subr.c,v 1.12 2006/08/11 23:15:30 reinoud Exp $ */
/* $NetBSD: udf_subr.c,v 1.13 2006/08/21 23:52:19 reinoud Exp $ */
/*
* Copyright (c) 2006 Reinoud Zandijk
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: udf_subr.c,v 1.12 2006/08/11 23:15:30 reinoud Exp $");
__RCSID("$NetBSD: udf_subr.c,v 1.13 2006/08/21 23:52:19 reinoud Exp $");
#endif /* not lint */
@ -680,8 +680,6 @@ udf_read_anchors(struct udf_mount *ump, struct udf_args *args)
track_end = last_track.next_writable
- ump->discinfo.link_block_penalty;
}
/* VATs are only recorded on sequential media, but initialise */
ump->possible_vat_location = track_end;
/* its no use reading a blank track */
first_anchor = 0;
@ -707,6 +705,10 @@ udf_read_anchors(struct udf_mount *ump, struct udf_args *args)
}
}
/* VATs are only recorded on sequential media, but initialise */
ump->first_possible_vat_location = track_start + 256 + 1;
ump->last_possible_vat_location = track_end;
return ok;
}
@ -1254,8 +1256,9 @@ udf_search_vat(struct udf_mount *ump, union udf_pmap *mapping)
/* mapping info not needed */
mapping = mapping;
vat_loc = ump->possible_vat_location;
early_vat_loc = vat_loc - 20;
vat_loc = ump->last_possible_vat_location;
early_vat_loc = vat_loc - ump->discinfo.blockingnr;
early_vat_loc = MAX(early_vat_loc, ump->first_possible_vat_location);
late_vat_loc = vat_loc + 1024;
/* TODO first search last sector? */