summaryrefslogtreecommitdiffstats
path: root/sys/fs/udf
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2002-08-02 06:22:20 +0000
committerscottl <scottl@FreeBSD.org>2002-08-02 06:22:20 +0000
commit0e245756afdcef4e2c5a2b661db3ffaa0beba667 (patch)
treeb7d3b3ac8690d62fd72c86dc7a0a07a6dc0f6441 /sys/fs/udf
parentf27f293d96cd04c95d4bb2908932d5e5397a7bc9 (diff)
downloadFreeBSD-src-0e245756afdcef4e2c5a2b661db3ffaa0beba667.zip
FreeBSD-src-0e245756afdcef4e2c5a2b661db3ffaa0beba667.tar.gz
Calculate the correct physical block number for files that are
embedded into their file_entry descriptor. This is more for correctness, since these files cannot be bmap'ed/mmap'ed anyways. Enforce this restriction. Submitted by: tes@sgi.com
Diffstat (limited to 'sys/fs/udf')
-rw-r--r--sys/fs/udf/udf_vnops.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/fs/udf/udf_vnops.c b/sys/fs/udf/udf_vnops.c
index 31f006f..6701a9b 100644
--- a/sys/fs/udf/udf_vnops.c
+++ b/sys/fs/udf/udf_vnops.c
@@ -92,6 +92,8 @@ VNODEOP_SET(udf_vnodeop_opv_desc);
MALLOC_DEFINE(M_UDFFID, "UDF FID", "UDF FileId structure");
+#define INVALID_BMAP -1
+
/* Look up a udf_node based on the ino_t passed in and return it's vnode */
int
udf_hashlookup(struct udf_mnt *udfmp, ino_t id, int flags, struct vnode **vpp)
@@ -813,7 +815,7 @@ udf_bmap(struct vop_bmap_args *a)
error = udf_bmap_internal(node, a->a_bn * node->udfmp->bsize, &lsector,
&max_size);
- if (error > 0)
+ if (error)
return (error);
/* Translate logical to physical sector number */
@@ -1094,7 +1096,7 @@ udf_readatoffset(struct udf_node *node, int *size, int offset, struct buf **bp,
udfmp = node->udfmp;
error = udf_bmap_internal(node, offset, &sector, &max_size);
- if (error == -1) {
+ if (error == INVALID_BMAP) {
/*
* This error means that the file *data* is stored in the
* allocation descriptor field of the file entry.
@@ -1211,9 +1213,9 @@ udf_bmap_internal(struct udf_node *node, uint32_t offset, daddr_t *sector, uint3
* allocation descriptor field of the file entry.
*/
*max_size = 0;
- *sector = node->hash_id + udfmp->bsize;
+ *sector = node->hash_id + udfmp->part_start;
- return (-1);
+ return (INVALID_BMAP);
case 2:
/* DirectCD does not use extended_ad's */
default:
OpenPOWER on IntegriCloud