summaryrefslogtreecommitdiff
path: root/sys/fs/udf/udf_vfsops.c
diff options
context:
space:
mode:
authorCraig Rodrigues <rodrigc@FreeBSD.org>2005-10-09 04:45:33 +0000
committerCraig Rodrigues <rodrigc@FreeBSD.org>2005-10-09 04:45:33 +0000
commita3d7f575c0cb8f67fe4a88cf010a91634760a0c9 (patch)
tree6f575af978b60fe022cc9e6bd1c23a4b126c20f5 /sys/fs/udf/udf_vfsops.c
parentbd1509e0cd574f240576533a5827da2859329855 (diff)
Notes
Diffstat (limited to 'sys/fs/udf/udf_vfsops.c')
-rw-r--r--sys/fs/udf/udf_vfsops.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c
index 896f0cf37f35..6abe5498da81 100644
--- a/sys/fs/udf/udf_vfsops.c
+++ b/sys/fs/udf/udf_vfsops.c
@@ -314,6 +314,7 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td) {
struct fileset_desc *fsd;
struct file_entry *root_fentry;
uint32_t sector, size, mvds_start, mvds_end;
+ uint32_t logical_secsize;
uint32_t fsd_offset = 0;
uint16_t part_num = 0, fsd_part = 0;
int error = EINVAL;
@@ -356,16 +357,31 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td) {
#if 0
udfmp->im_l2d = NULL;
#endif
+ /*
+ * The UDF specification defines a logical sectorsize of 2048
+ * for DVD media.
+ */
+ logical_secsize = 2048;
+
+ if (((logical_secsize % cp->provider->sectorsize) != 0) ||
+ (logical_secsize < cp->provider->sectorsize)) {
+ DROP_GIANT();
+ g_topology_lock();
+ g_vfs_close(cp, td);
+ g_topology_unlock();
+ PICKUP_GIANT();
+ return (EINVAL);
+ }
- bsize = 2048; /* XXX Should probe the media for it's size */
+ bsize = cp->provider->sectorsize;
/*
* Get the Anchor Volume Descriptor Pointer from sector 256.
* XXX Should also check sector n - 256, n, and 512.
*/
sector = 256;
- if ((error = bread(devvp, sector * btodb(bsize), bsize, NOCRED,
- &bp)) != 0)
+ if ((error = bread(devvp, sector * btodb(logical_secsize), bsize,
+ NOCRED, &bp)) != 0)
goto bail;
if ((error = udf_checktag((struct desc_tag *)bp->b_data, TAGID_ANCHOR)))
goto bail;
@@ -383,8 +399,8 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td) {
mvds_start = le32toh(avdp.main_vds_ex.loc);
mvds_end = mvds_start + (le32toh(avdp.main_vds_ex.len) - 1) / bsize;
for (sector = mvds_start; sector < mvds_end; sector++) {
- if ((error = bread(devvp, sector * btodb(bsize), bsize,
- NOCRED, &bp)) != 0) {
+ if ((error = bread(devvp, sector * btodb(logical_secsize),
+ bsize, NOCRED, &bp)) != 0) {
printf("Can't read sector %d of VDS\n", sector);
goto bail;
}