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

oleksandr at FreeBSD.org oleksandr at FreeBSD.org
Fri Jul 6 10:35:31 UTC 2012


Author: oleksandr
Date: Fri Jul  6 10:35:29 2012
New Revision: 239035
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239035

Log:
  Add some DPRINTF and correct KASSERT functions

Modified:
  soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c
  soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c

Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c
==============================================================================
--- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c	Fri Jul  6 10:26:32 2012	(r239034)
+++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c	Fri Jul  6 10:35:29 2012	(r239035)
@@ -483,9 +483,12 @@
 			return (EINVAL);
 
 		/* lookup in virtual allocation table file */
+		/* mutex_enter(&ump->allocate_mutex); */
 		error = udf_vat_read(ump->vat_node,
 				(uint8_t *) &udf_rw32_lbmap, 4,
 				ump->vat_offset + lb_num * 4);
+		/* mutex_exit(&ump->allocate_mutex); */
+
 		if (error)
 			return (error);
 
@@ -537,7 +540,17 @@
 		for (;;) {
 			udf_get_adslot(ump->metadata_node,
 				slot, &s_icb_loc, &eof);
+			DPRINTF(ADWLK, ("slot %d, eof = %d, flags = %d, "
+				"len = %d, lb_num = %d, part = %d\n",
+				slot, eof,
+				UDF_EXT_FLAGS(le32toh(s_icb_loc.len)),
+				UDF_EXT_LEN(le32toh(s_icb_loc.len)),
+				le32toh(s_icb_loc.loc.lb_num),
+				le16toh(s_icb_loc.loc.part_num)));
 			if (eof) {
+				DPRINTF(TRANSLATE,
+					("Meta partition translation "
+					 "failed: can't seek location\n"));
 				UDF_UNLOCK_NODE(ump->metadata_node, 0);
 				return (EINVAL);
 			}
@@ -913,12 +926,12 @@
 static int
 udf_search_free_vatloc(struct udf_mount *ump, uint32_t *lbnumres)
 {
-	uint32_t lb_size, lb_num, lb_map, udf_rw32_lbmap;
+	uint32_t lb_size, lb_num, lb_map, le32toh_lbmap;
 	uint8_t *blob;
 	int entry, chunk, found, error;
 
-	KASSERT(ump);
-	KASSERT(ump->logical_vol);
+	KASSERT(ump, ("ump is NULL"));
+	KASSERT(ump->logical_vol, ("ump->logical_vol is NULL"));
 
 	lb_size = le32toh(ump->logical_vol->lb_size);
 	blob = malloc(lb_size, M_UDFTEMP, M_WAITOK);
@@ -942,8 +955,8 @@
 
 		/* search this chunk */
 		for (entry=0; entry < chunk /4; entry++, lb_num++) {
-			udf_rw32_lbmap = *((uint32_t *) (blob + entry * 4));
-			lb_map = le32toh(udf_rw32_lbmap);
+			le32toh_lbmap = *((uint32_t *) (blob + entry * 4));
+			lb_map = le32toh(le32toh_lbmap);
 			if (lb_map == 0xffffffff) {
 				found = 1;
 				break;
@@ -1957,7 +1970,7 @@
 			l_icb.loc.part_num = udf_node->loc.loc.part_num;
 			l_icb.loc.lb_num   = short_ad->lb_num;
 		} else {
-			KASSERT(addr_type == UDF_ICB_LONG_ALLOC,("addr_type == UDF_ICB_LONG_ALLOC"));
+			KASSERT(addr_type == UDF_ICB_LONG_ALLOC,("addr_type != UDF_ICB_LONG_ALLOC"));
 			long_ad = (struct long_ad *) (data_pos + l_ad-adlen);
 			l_icb = *long_ad;
 		}

Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c
==============================================================================
--- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c	Fri Jul  6 10:26:32 2012	(r239034)
+++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c	Fri Jul  6 10:35:29 2012	(r239035)
@@ -2740,12 +2740,10 @@
 {
 	struct udf_mount *ump = vat_node->ump;
 
-/*	mutex_enter(&ump->allocate_mutex); */
 	if (offset + size > ump->vat_offset + ump->vat_entries * 4)
 		return (EINVAL);
-	memcpy(blob, ump->vat_table + offset, size);
-/*	mutex_exit(&ump->allocate_mutex); */
 
+	memcpy(blob, ump->vat_table + offset, size);
 	return (0);
 }
 


More information about the svn-soc-all mailing list