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

oleksandr at FreeBSD.org oleksandr at FreeBSD.org
Mon Jul 2 11:42:17 UTC 2012


Author: oleksandr
Date: Mon Jul  2 11:42:15 2012
New Revision: 238797
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238797

Log:
  setup rest of mount information, style fix and add debug section

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

Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c
==============================================================================
--- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c	Mon Jul  2 11:38:17 2012	(r238796)
+++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c	Mon Jul  2 11:42:15 2012	(r238797)
@@ -358,7 +358,7 @@
 	 * We sum all free space up here regardless of type.
 	 */
 
-/*	KASSERT(lvid); */
+	KASSERT(lvid, ("lvid is null")); 
 	num_vpart = le32toh(lvid->num_part);
 
 #if 0
@@ -454,7 +454,7 @@
 	vpart  = le16toh(icb_loc->loc.part_num);
 	lb_num = le32toh(icb_loc->loc.lb_num);
 	if (vpart > UDF_VTOP_RAWPART)
-		return EINVAL;
+		return (EINVAL);
 
 translate_again:
 	part = ump->vtop[vpart];
@@ -465,38 +465,38 @@
 		/* 1:1 to the end of the device */
 		*lb_numres = lb_num;
 		*extres = INT_MAX;
-		return 0;
+		return (0);
 	case UDF_VTOP_TYPE_PHYS :
 		/* transform into its disc logical block */
 		if (lb_num > le32toh(pdesc->part_len))
-			return EINVAL;
+			return (EINVAL);
 		*lb_numres = lb_num + le32toh(pdesc->start_loc);
 
 		/* extent from here to the end of the partition */
 		*extres = le32toh(pdesc->part_len) - lb_num;
-		return 0;
+		return (0);
 	case UDF_VTOP_TYPE_VIRT :
 		/* only maps one logical block, lookup in VAT */
 		if (lb_num >= ump->vat_entries)		/* XXX > or >= ? */
-			return EINVAL;
+			return (EINVAL);
 
 		/* lookup in virtual allocation table file */
 		error = udf_vat_read(ump->vat_node,
 				(uint8_t *) &udf_rw32_lbmap, 4,
 				ump->vat_offset + lb_num * 4);
 		if (error)
-			return error;
+			return (error);
 
 		lb_num = le32toh(udf_rw32_lbmap);
 
 		/* transform into its disc logical block */
 		if (lb_num > le32toh(pdesc->part_len))
-			return EINVAL;
+			return (EINVAL);
 		*lb_numres = lb_num + le32toh(pdesc->start_loc);
 
 		/* just one logical block */
 		*extres = 1;
-		return 0;
+		return (0);
 	case UDF_VTOP_TYPE_SPARABLE :
 		/* check if the packet containing the lb_num is remapped */
 		lb_packet = lb_num / ump->sparable_packet_size;
@@ -508,18 +508,18 @@
 				/* NOTE maps to absolute disc logical block! */
 				*lb_numres = le32toh(sme->map) + lb_rel;
 				*extres    = ump->sparable_packet_size - lb_rel;
-				return 0;
+				return (0);
 			}
 		}
 
 		/* transform into its disc logical block */
 		if (lb_num > le32toh(pdesc->part_len))
-			return EINVAL;
+			return (EINVAL);
 		*lb_numres = lb_num + le32toh(pdesc->start_loc);
 
 		/* rest of block */
 		*extres = ump->sparable_packet_size - lb_rel;
-		return 0;
+		return (0);
 	case UDF_VTOP_TYPE_META :
 printf("Metadata Partition Translated\n");
 		/* we have to look into the file's allocation descriptors */
@@ -537,7 +537,7 @@
 				slot, &s_icb_loc, &eof);
 			if (eof) {
 				UDF_UNLOCK_NODE(ump->metadata_node, 0);
-				return EINVAL;
+				return IEINVAL);
 			}
 			len   = le32toh(s_icb_loc.len);
 			flags = UDF_EXT_FLAGS(len);
@@ -568,7 +568,7 @@
 		if (flags != UDF_EXT_ALLOCATED) {
 			DPRINTF(TRANSLATE, ("Metadata partion translation "
 					    "failed: not allocated\n"));
-			return EINVAL;
+			return (EINVAL);
 		}
 
 		/*
@@ -581,7 +581,7 @@
 			ump->vtop_tp[vpart]);
 	}
 
-	return EINVAL;
+	return (EINVAL);
 }
 
 
@@ -1981,6 +1981,8 @@
 	/* XXX l_ad == 0 should be enough to check */
 	*eof = (offset >= l_ad) || (l_ad == 0);
 	if (*eof) {
+		DPRINTF(PARANOIDADWLK, ("returning EOF, extnr %d, offset %d, "
+			"l_ad %d\n", extnr, offset, l_ad));
 		memset(icb, 0, sizeof(struct long_ad));
 		return;
 	}
@@ -1995,6 +1997,9 @@
 		long_ad = (struct long_ad *) (data_pos + offset);
 		*icb = *long_ad;
 	}
+	DPRINTF(PARANOIDADWLK, ("returning element : v %d, lb %d, len %d, "
+		"flags %d\n", icb->loc.part_num, icb->loc.lb_num,
+		UDF_EXT_LEN(icb->len), UDF_EXT_FLAGS(icb->len)));
 }
 
 /* --------------------------------------------------------------------- */

Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c
==============================================================================
--- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c	Mon Jul  2 11:38:17 2012	(r238796)
+++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c	Mon Jul  2 11:42:15 2012	(r238797)
@@ -2112,7 +2112,7 @@
 		maps_on = ump->vtop[log_part];
 		switch (ump->vtop_tp[log_part]) {
 		case UDF_VTOP_TYPE_PHYS :
-			/* assert(maps_on == log_part); */
+			KASSERT(maps_on == log_part, (" maps_on != log_part")); 
 			ump->vtop_alloc[log_part] = UDF_ALLOC_SPACEMAP;
 			break;
 		case UDF_VTOP_TYPE_VIRT :
@@ -2120,18 +2120,16 @@
 			ump->vtop_alloc[maps_on]  = UDF_ALLOC_SEQUENTIAL;
 			break;
 		case UDF_VTOP_TYPE_SPARABLE :
-			/* assert(maps_on == log_part); */
+			KASSERT(maps_on == log_part, ("maps_on != log_part")); 
 			ump->vtop_alloc[log_part] = UDF_ALLOC_SPACEMAP;
 			break;
 		case UDF_VTOP_TYPE_META :
 			ump->vtop_alloc[log_part] = UDF_ALLOC_METABITMAP;
-#if 0
 			if (ump->discinfo.mmc_cur & MMC_CAP_PSEUDOOVERWRITE) {
 				/* special case for UDF 2.60 */
 				ump->vtop_alloc[log_part] = UDF_ALLOC_METASEQUENTIAL;
 				ump->vtop_alloc[maps_on]  = UDF_ALLOC_SEQUENTIAL;
 			}
-#endif
 			break;
 		default:
 			panic("bad alloction type in udf's ump->vtop\n");
@@ -2227,6 +2225,7 @@
 	struct fileset_desc    *fsd = NULL;
 	struct udf_lv_info     *lvi = NULL;
 
+	DPRINTF(VOLUMES, ("Updating logical volume name\n"));
 	lvd = ump->logical_vol;
 	fsd = ump->fileset_desc;
 	if (ump->implementation)
@@ -2684,6 +2683,7 @@
 
 	/* paranoia */
 	if (a_l != sizeof(*implext) -1 + le32toh(implext->iu_l) + sizeof(lvext))
+		DPRINTF(VOLUMES, ("VAT LVExtension size doens't compute\n"));
 		return (EINVAL);
 
 	/*
@@ -2691,6 +2691,7 @@
 	 * bug in the specification it might not be word aligned so
 	 * copy first to avoid panics on some machines (!!)
 	 */
+	DPRINTF(VOLUMES, ("Found VAT LVExtension attr\n"));
 	lvextpos = implext->data + le32toh(implext->iu_l);
 	memcpy(&lvext, lvextpos, sizeof(lvext));
 
@@ -2700,6 +2701,7 @@
 		lvinfo->num_directories = lvext.num_directories;
 		udf_update_logvolname(ump, lvext.logvol_id);
 	} else {
+		DPRINTF(VOLUMES, ("VAT LVExtension out of date"));
 		/* replace VAT LVExt by free space EA */
 		memset(implext->imp_id.id, 0, UDF_REGID_ID_SIZE);
 		strcpy(implext->imp_id.id, "*UDF FreeEASpace");
@@ -2955,6 +2957,7 @@
 
 	/* vat_length is really 64 bits though impossible */
 
+	DPRINTF(VOLUMES, ("Checking for VAT\n"));
 	if (!vat_node)
 		return (ENOENT);
 
@@ -2987,6 +2990,8 @@
 	if ((filetype != 0) && (filetype != UDF_ICB_FILETYPE_VAT))
 		return (ENOENT);
 
+	DPRINTF(VOLUMES, ("\tPossible VAT length %d\n", vat_length));
+
 	vat_table_alloc_len =
 		((vat_length + UDF_VAT_CHUNKSIZE-1) / UDF_VAT_CHUNKSIZE)
 			* UDF_VAT_CHUNKSIZE;
@@ -3034,6 +3039,7 @@
 		regid_name = (char *) oldvat_tl->id.id;
 		error = strncmp(regid_name, "*UDF Virtual Alloc Tbl", 22);
 		if (error) {
+			DPRINTF(VOLUMES, ("VAT format 1.50 rejected\n"));
 			error = ENOENT;
 			goto out;
 		}
@@ -3083,6 +3089,7 @@
 	if (error)
 		goto out;
 
+	DPRINTF(VOLUMES, ("VAT format accepted, marking it closed\n"));
 	ump->logvol_integrity->lvint_next_unique_id = htole64(unique_id);
 	ump->logvol_integrity->integrity_type = htole32(UDF_INTEGRITY_CLOSED);
 	ump->logvol_integrity->time           = *mtime;
@@ -3127,9 +3134,16 @@
 	vat_loc = ump->last_possible_vat_location;
 	early_vat_loc = vat_loc - 256;	/* 8 blocks of 32 sectors */
 
+	DPRINTF(VOLUMES, ("1) last possible %d, early_vat_loc %d \n",
+		vat_loc, early_vat_loc));
+	early_vat_loc = MAX(early_vat_loc, ump->first_possible_vat_location);
+
 	early_vat_loc = MAX(early_vat_loc, ump->first_possible_vat_location);
 	late_vat_loc  = vat_loc + 1024;
 
+	DPRINTF(VOLUMES, ("2) last possible %d, early_vat_loc %d \n",
+		vat_loc, early_vat_loc));
+
 	/* start looking from the end of the range */
 	do {
 		if (vat_node) {
@@ -3152,6 +3166,7 @@
 				icb_loc.loc.part_num = htole16(UDF_VTOP_RAWPART);
 				icb_loc.loc.lb_num = htole32(vat_loc);
 				ino = udf_get_node_id(&icb_loc);
+
 				error = udf_get_node(ump, ino, &vat_node);
 				/* error = udf_vget(ump->vfs_mountp, ino, LK_EXCLUSIVE, &vp); */
 				/* vat_node = VTOI(vp); */
@@ -3287,8 +3302,8 @@
 		if (error)
 			error = EROFS;
 	}
-	/* DPRINTFIF(VOLUMES, error, ("udf mount: failed to read "
-				   "metadata files\n")); */
+	DPRINTFIF(VOLUMES, error, ("udf mount: failed to read "
+				   "metadata files\n")); 
 	return (error);
 }
 /* --------------------------------------------------------------------- */
@@ -3347,7 +3362,7 @@
 
 		/* also read in metadata partition spacebitmap if defined */
 		error = udf_read_metadata_partition_spacetable(ump);
-		return error;
+		return (error);
 	}
 #endif
 	return (0);

Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c
==============================================================================
--- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c	Mon Jul  2 11:38:17 2012	(r238796)
+++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c	Mon Jul  2 11:42:15 2012	(r238797)
@@ -630,6 +630,13 @@
 #endif
 
 	/* setup rest of mount information */
+	mp->mnt_data = ump;
+
+#if 0	
+	/* bshift is allways equal to disc sector size */
+	mp->mnt_dev_bshift = bshift;
+	mp->mnt_fs_bshift = bshift;
+#endif 	
 
 	/* note that the mp info needs to be initialised for reading! */
 	/* read vds support tables like VAT, sparable etc. */


More information about the svn-soc-all mailing list