socsvn commit: r238459 - soc2012/oleksandr/udf-head/sys/fs/udf2

oleksandr at FreeBSD.org oleksandr at FreeBSD.org
Thu Jun 28 09:26:39 UTC 2012


Author: oleksandr
Date: Thu Jun 28 09:26:36 2012
New Revision: 238459
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238459

Log:
  change location of determine type operation in udf_strategy, fix value of di->last_posssible_lba, clean temporary blks in udf_read_phys_sectors and change style of return operation

Modified:
  soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c
  soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c
  soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c
  soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c

Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c
==============================================================================
--- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c	Thu Jun 28 08:25:19 2012	(r238458)
+++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c	Thu Jun 28 09:26:36 2012	(r238459)
@@ -335,10 +335,9 @@
 	/* off_t lblkno, rblkno; */
 	uint32_t sector_size, blks; /* buf_offset; */
 	struct vnode *devvp = ump->devvp;
-	uint32_t logical_secsize = 2048;
 
 	sector_size = ump->sector_size;
-	blks = btodb(logical_secsize);
+	blks = btodb(sector_size);
 
 	while (sectors > 0 && error == 0) {
 		if ((error = bread(devvp, start*blks, sector_size, NOCRED,

Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c
==============================================================================
--- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c	Thu Jun 28 08:25:19 2012	(r238458)
+++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c	Thu Jun 28 09:26:36 2012	(r238459)
@@ -198,7 +198,7 @@
 	di->disc_flags = MMC_DFLAGS_UNRESTRICTED;
 
 	/* TODO problem with last_possible_lba on resizable VND; request */
-	di->last_possible_lba = psize/sector_size;
+	di->last_possible_lba = psize/sector_size - 1;
 	di->sector_size       = sector_size;
 
 	di->num_sessions = 1;
@@ -751,14 +751,14 @@
 	}
 
 	if ((size == 0) || (lb_size == 0))
-		return 0;
+		return (0);
 
 	if (lb_size == 1)
-		return size;
+		return (size);
 
 	/* round up in sectors */
 	num_lb = (size + lb_size -1) / lb_size;
-	return num_lb * lb_size;
+	return (num_lb * lb_size);
 }
 
 
@@ -1117,7 +1117,7 @@
 		if (le16toh(part->part_num) == raw_phys_part)
 			break;
 	}
-	return phys_part;
+	return (phys_part);
 }
 
 /* --------------------------------------------------------------------- */
@@ -1166,7 +1166,7 @@
 
 		if (phys_part == UDF_PARTITIONS) {
 			free(dscr, M_UDFTEMP);
-			return EINVAL;
+			return (EINVAL);
 		}
 
 		UDF_UPDATE_DSCR(ump->partitions[phys_part], &dscr->pd);
@@ -1181,7 +1181,7 @@
 		free(dscr, M_UDFTEMP);
 	}
 
-	return 0;
+	return (0);
 }
 #undef UDF_UPDATE_DSCR
 
@@ -1203,17 +1203,17 @@
 		if (error) {
 			if (!dscr)
 				free(dscr, M_UDFTEMP);
-			return error;
+			return (error);
 		}
 
 		/* blank block is a terminator */
 		if (dscr == NULL)
-			return 0;
+			return (0);
 
 		/* TERM descriptor is a terminator */
 		if (le16toh(dscr->tag.id) == TAGID_TERM) {
 			free(dscr, M_UDFTEMP);
-			return 0;
+			return (0);
 		}
 
 		/* process all others */
@@ -1230,7 +1230,7 @@
 		loc += dscr_size / sector_size;
 	}
 
-	return error;
+	return (error);
 }
 
 
@@ -1274,7 +1274,7 @@
 		error = udf_read_vds_extent(ump, reserve_loc, reserve_len);
 	}
 
-	return error;
+	return (error);
 }
 
 /* --------------------------------------------------------------------- */
@@ -1983,19 +1983,19 @@
 	uint8_t *pmap_pos;
 	
 	if (ump == NULL)
-		return ENOENT;
+		return (ENOENT);
 	
 	/* we need at least an anchor (trivial, but for safety) */
 	if (ump->anchors[0] == NULL)
-		return EINVAL;
+		return (EINVAL);
 
 	/* we need at least one primary and one logical volume descriptor */
 	if ((ump->primary_vol == NULL) || (ump->logical_vol) == NULL)
-		return EINVAL;
+		return (EINVAL);
 
 	/* we need at least one partition descriptor */
 	if (ump->partitions[0] == NULL)
-		return EINVAL;
+		return (EINVAL);
 
 /*
 Check that character set is correct?
@@ -2008,20 +2008,20 @@
 	/* check logical volume sector size verses device sector size */
 	if (le32toh(ump->logical_vol->lb_size) != ump->sector_size) {
 		printf("UDF mount: format violation, lb_size != sector size\n");
-		return EINVAL;
+		return (EINVAL);
 	}
 
 	/* check domain name */
 	domain_name = ump->logical_vol->domain_id.id;
 	if (strncmp(domain_name, "*OSTA UDF Compliant", 20)) {
 		printf("mount_udf: disc not OSTA UDF Compliant, aborting\n");
-		return EINVAL;
+		return (EINVAL);
 	}
 
 	/* retrieve logical volume integrity sequence */
 	error = udf_retrieve_lvint(ump);
 	if (error != 0)
-		return EINVAL; // previously it always returned this on error.
+		return (EINVAL); // previously it always returned this on error.
 
 	/*
 	 * We need at least one logvol integrity descriptor recorded.  Note
@@ -2029,7 +2029,7 @@
 	 * will close/update the integrity.
 	 */
 	if (ump->logvol_integrity == NULL)
-		return EINVAL;
+		return (EINVAL);
 
 	/* process derived structures */
 	n_pm   = le32toh(ump->logical_vol->n_pm);   /* num partmaps         */
@@ -2051,7 +2051,7 @@
 
 	if (n_pm > UDF_PMAPS) {
 		printf("UDF mount: too many mappings\n");
-		return EINVAL;
+		return (EINVAL);
 	}
 
 	/* count types and set partition numbers */
@@ -2106,7 +2106,7 @@
 			}
 			break;
 		default:
-			return EINVAL;
+			return (EINVAL);
 		}
 
 		/*
@@ -2120,9 +2120,9 @@
 		    raw_phys_part, phys_part, pmap_type));
 	
 		if (phys_part == UDF_PARTITIONS)
-			return EINVAL;
+			return (EINVAL);
 		if (pmap_type == UDF_VTOP_TYPE_UNKNOWN)
-			return EINVAL;
+			return (EINVAL);
 
 		ump->vtop   [log_part] = phys_part;
 		ump->vtop_tp[log_part] = pmap_type;
@@ -2134,14 +2134,14 @@
 
 	/* test some basic UDF assertions/requirements */
 	if ((n_virt > 1) || (n_spar > 1) || (n_meta > 1))
-		return EINVAL;
+		return (EINVAL);
 
 	if (n_virt) {
 		if ((n_phys == 0) || n_spar || n_meta)
-			return EINVAL;
+			return (EINVAL);
 	}
 	if (n_spar + n_phys == 0)
-		return EINVAL;
+		return (EINVAL);
 
 	/* select allocation type for each logical partition */
 	for (log_part = 0; log_part < n_pm; log_part++) {

Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c
==============================================================================
--- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c	Thu Jun 28 08:25:19 2012	(r238458)
+++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c	Thu Jun 28 09:26:36 2012	(r238459)
@@ -567,14 +567,14 @@
 			 */
 		}
 		/* double check if we're not mounting a pervious session RW */
-//#if 0		
+		
 		if (args->sessionnr != 0) {
 			printf("UDF mount: updating a previous session "
 				"not yet allowed\n");
 			error = EROFS;
 			goto fail;
 		}
-//#endif 
+ 
 	}
 
 #if 0

Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c
==============================================================================
--- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c	Thu Jun 28 08:25:19 2012	(r238458)
+++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c	Thu Jun 28 09:26:36 2012	(r238459)
@@ -502,31 +502,31 @@
 			bp->b_error  = error;
 			bufdone(bp);
 			return (error);
-		}	
-		if (bp->b_iocmd & BIO_READ) {
-			if (lsector == UDF_TRANS_ZERO) {
-				/* copy sezo sector */
-				memset(bp->b_data, 0, lb_size);
-				if ((bp->b_flags & B_ASYNC) == 0)
-					bufwait(bp);
-			/* pre-check if its an internal */
-			} else if (lsector == UDF_TRANS_INTERN) {
-				error = udf_read_internal(udf_node, (uint8_t *) bp->b_data);
-				if (error)
-					bp->b_error  = error;
-					bufdone(bp);
-				if ((bp->b_flags & B_ASYNC) == 0)
-					bufwait(bp);
-			} else {
-				/* bmap gives sector numbers. bio works with device blocks */
-				bp->b_blkno = lsector * (udf_node->ump->sector_size/DEV_BSIZE);
-			}
+		 }
+	}	
+	if (bp->b_iocmd & BIO_READ) {
+		if (lsector == UDF_TRANS_ZERO) {
+			/* copy sezo sector */
+			memset(bp->b_data, 0, lb_size);
+			if ((bp->b_flags & B_ASYNC) == 0)
+				bufwait(bp);
+		/* pre-check if its an internal */
+		} else if (lsector == UDF_TRANS_INTERN) {
+			error = udf_read_internal(udf_node, (uint8_t *) bp->b_data);
+			if (error)
+				bp->b_error  = error;
+				bufdone(bp);
+			if ((bp->b_flags & B_ASYNC) == 0)
+				bufwait(bp);
 		} else {
-			return (ENOTSUP);
+			/* bmap gives sector numbers. bio works with device blocks */
+			bp->b_blkno = lsector * (udf_node->ump->sector_size/DEV_BSIZE);
+			bp->b_iooffset = dbtob(bp->b_blkno);
+			BO_STRATEGY(bo, bp);
 		}
+	} else {
+		return (ENOTSUP);
 	}
-	bp->b_iooffset = dbtob(bp->b_blkno);
-	BO_STRATEGY(bo, bp);
 	return (bp->b_error);
 }
 


More information about the svn-soc-all mailing list