Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 08 Jun 2012 08:36:30 +0000
From:      oleksandr@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r237289 - soc2012/oleksandr/udf-head/sys/fs/udf2
Message-ID:  <20120608083630.7596F106566C@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: oleksandr
Date: Fri Jun  8 08:36:29 2012
New Revision: 237289
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237289

Log:
  Add some comments and debug section

Modified:
  soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h
  soc2012/oleksandr/udf-head/sys/fs/udf2/udf_mount.h
  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.h
==============================================================================
--- soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h	Fri Jun  8 07:44:42 2012	(r237288)
+++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h	Fri Jun  8 08:36:29 2012	(r237289)
@@ -32,10 +32,57 @@
 /* lets see debug stuff for now */
 #define DEBUG
 
+/* debug section */
+extern int udf_verbose;
 
 /* undefine UDF_COMPLETE_DELETE to need `purge'; but purge is not implemented */
 #define UDF_COMPLETE_DELETE
 
+/* debug categories */
+#define UDF_DEBUG_VOLUMES	0x0000001
+#define UDF_DEBUG_LOCKING	0x0000002
+#define UDF_DEBUG_NODE		0x0000004
+#define UDF_DEBUG_LOOKUP	0x0000008
+#define UDF_DEBUG_READDIR	0x0000010
+#define UDF_DEBUG_FIDS		0x0000020
+#define UDF_DEBUG_DESCRIPTOR	0x0000040
+#define UDF_DEBUG_TRANSLATE	0x0000080
+#define UDF_DEBUG_STRATEGY	0x0000100
+#define UDF_DEBUG_READ		0x0000200
+#define UDF_DEBUG_WRITE		0x0000400
+#define UDF_DEBUG_CALL		0x0000800
+#define UDF_DEBUG_ATTR		0x0001000
+#define UDF_DEBUG_EXTATTR	0x0002000
+#define UDF_DEBUG_ALLOC		0x0004000
+#define UDF_DEBUG_ADWLK		0x0008000
+#define UDF_DEBUG_DIRHASH	0x0010000
+#define UDF_DEBUG_NOTIMPL	0x0020000
+#define UDF_DEBUG_SHEDULE	0x0040000
+#define UDF_DEBUG_ECCLINE	0x0080000
+#define UDF_DEBUG_SYNC		0x0100000
+#define UDF_DEBUG_PARANOIA	0x0200000
+#define UDF_DEBUG_PARANOIDADWLK	0x0400000
+#define UDF_DEBUG_NODEDUMP	0x0800000
+#define UDF_DEBUG_RESERVE	0x1000000
+
+/* initial value of udf_verbose */
+#define UDF_DEBUGGING		0
+
+#ifdef DEBUG
+#define DPRINTF(name, arg) { \
+		if (udf_verbose & UDF_DEBUG_##name) {\
+			printf arg;\
+		};\
+	}
+#define DPRINTFIF(name, cond, arg) { \
+		if (udf_verbose & UDF_DEBUG_##name) { \
+			if (cond) printf arg;\
+		};\
+	}
+#else
+#define DPRINTF(name, arg) {}
+#define DPRINTFIF(name, cond, arg) {}
+#endif
 
 /* constants to identify what kind of identifier we are dealing with */
 #define UDF_REGID_DOMAIN		 1

Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_mount.h
==============================================================================
--- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_mount.h	Fri Jun  8 07:44:42 2012	(r237288)
+++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_mount.h	Fri Jun  8 08:36:29 2012	(r237289)
@@ -39,8 +39,7 @@
  * Arguments to mount UDF filingsystem.
  */
 
-//#define UDFMNT_VERSION	1
-#if 0
+#define UDFMNT_VERSION	1
 struct udf_args {
 	uint32_t	 version;	/* version of this structure         */
 	char		*fspec;		/* mount specifier                   */
@@ -58,13 +57,12 @@
 	/* extendable */
 	uint8_t	 reserved[32];
 };
-#endif
 
 
 /* udf mount options */
 
-//#define UDFMNT_CLOSESESSION	0x00000001	/* close session on dismount */
-//#define UDFMNT_BITS "\20\1CLOSESESSION"
+#define UDFMNT_CLOSESESSION	0x00000001	/* close session on dismount */
+#define UDFMNT_BITS "\20\1CLOSESESSION"
 #define UDFMNT_KICONV 100
 
 #endif /* !_FS_UDF_UDF_MOUNT_H_ */

Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c
==============================================================================
--- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c	Fri Jun  8 07:44:42 2012	(r237288)
+++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c	Fri Jun  8 08:36:29 2012	(r237289)
@@ -34,7 +34,6 @@
 #include <sys/stat.h>
 #include <sys/mount.h> /* We shouldn't be, but are dependent on this header. */
 #include <sys/iconv.h>
-
 #include "ecma167-udf.h"
 #include "udf.h"
 #include "udf_subr.h"
@@ -3276,6 +3275,7 @@
 	dscr  = NULL;
 	error = 0;
 	while (fsd_len || error) {
+		DPRINTF(VOLUMES, ("fsd_len = %d\n", fsd_len));
 		/* translate fsd_loc to lb_num */
 		error = udf_translate_vtop(ump, &fsd_loc, &lb_num, &dummy);
 		if (error)
@@ -3313,6 +3313,7 @@
 
 		/* follow up to fsd->next_ex (long_ad) if its not null */
 		if (le32toh(ump->fileset_desc->next_ex.len)) {
+			DPRINTF(VOLUMES, ("follow up FSD extent\n"));
 			fsd_loc = ump->fileset_desc->next_ex;
 			fsd_len = le32toh(ump->fileset_desc->next_ex.len);
 		}
@@ -3324,6 +3325,8 @@
 	if (ump->fileset_desc == NULL)
 		return ENOENT;
 
+	DPRINTF(VOLUMES, ("FSD read in fine\n"));
+	DPRINTF(VOLUMES, ("Updating fsd logical volume id\n"));
 	udf_update_logvolname(ump, ump->logical_vol->logvol_id);
 
 	/*
@@ -3508,7 +3511,7 @@
 
 	/* add node to the rb tree */
 	mutex_enter(&ump->ihash_lock);
-		rb_tree_insert_node(&ump->udf_node_tree, &udf_node->rbnode);
+	rb_tree_insert_node(&ump->udf_node_tree, &udf_node->rbnode);
 	mutex_exit(&ump->ihash_lock);
 }
 
@@ -3520,7 +3523,7 @@
 
 	/* remove node from the rb tree */
 	mutex_enter(&ump->ihash_lock);
-		rb_tree_remove_node(&ump->udf_node_tree, &udf_node->rbnode);
+	rb_tree_remove_node(&ump->udf_node_tree, &udf_node->rbnode);
 	mutex_exit(&ump->ihash_lock);
 }
 
@@ -5573,15 +5576,40 @@
 int
 udf_dispose_node(struct udf_node *udf_node)
 {
+	//struct vnode *vp;
 	int extnr;
 
-	if (!udf_node)
+	DPRINTF(NODE, ("udf_dispose_node called on node %p\n", udf_node));
+	if (!udf_node) {
+		DPRINTF(NODE, ("UDF: Dispose node on node NULL, ignoring\n"));
 		return 0;
-
-/*	udf_cleanup_reservation(udf_node); */
+	}
+#if 0
+	vp  = udf_node->vnode;
+#ifdef DIAGNOSTIC
+	if (vp->v_numoutput)
+		panic("disposing UDF node with pending I/O's, udf_node = %p, "
+				"v_numoutput = %d", udf_node, vp->v_numoutput);
+#endif
+	udf_cleanup_reservation(udf_node); 
 
 	/* TODO extended attributes and streamdir */
 
+	/* remove dirhash if present */
+	dirhash_purge(&udf_node->dir_hash);
+
+	/* remove from our hash lookup table */
+	udf_deregister_node(udf_node);
+
+	/* destroy our lock */
+	mutex_destroy(&udf_node->node_mutex);
+	cv_destroy(&udf_node->node_lock);
+
+	/* dissociate our udf_node from the vnode */
+	genfs_node_destroy(udf_node->vnode);
+	vp->v_data = NULL;
+#endif	
+
 	/* free associated memory and the node itself */
 	for (extnr = 0; extnr < udf_node->num_extensions; extnr++) {
 		/*udf_free_logvol_dscr(udf_node->ump, &udf_node->ext_loc[extnr],

Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c
==============================================================================
--- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c	Fri Jun  8 07:44:42 2012	(r237288)
+++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c	Fri Jun  8 08:36:29 2012	(r237289)
@@ -187,11 +187,15 @@
 	char *fspec;
 	
 	td = curthread;
-
+	DPRINTF(CALL, ("udf_mount called\n"));
+	/*
+	 * Unconditionally mount as read-only.
+	 */
 	MNT_ILOCK(mp);
 	mp->mnt_flag |= MNT_RDONLY;
 	MNT_IUNLOCK(mp);
 
+	/* No root filesystem support */
 	if (mp->mnt_flag & MNT_ROOTFS)
 		return (ENOTSUP);
 
@@ -204,6 +208,8 @@
 	error = vfs_getopt(mp->mnt_optnew, "from", (void **)&fspec, &len);
 	if (!error && fspec[len - 1] != '\0')
 		return (EINVAL);
+
+	/* Check that the mount device exists */ 
 	if (fspec == NULL)
 		return (EINVAL);
 
@@ -218,6 +224,7 @@
 		return (error);
 	}
 
+	/* Check the access rights on the mount device */
 	error = VOP_ACCESS(devvp, VREAD, td->td_ucred, td);
 	if (error)
 		error = priv_check(td, PRIV_VFS_MOUNT_PERM);
@@ -236,7 +243,7 @@
 	}
 
 	/* successfully mounted */
-
+	DPRINTF(VOLUMES, ("udf_mount() successfull\n"));
 #if 0 
 	/* If we're not opened read-only, open its logical volume */
 	if ((mp->mnt_flag & MNT_RDONLY) == 0) {
@@ -281,9 +288,10 @@
 udf_unmount(struct mount *mp, int mntflags)
 {
 	struct udf_mount *ump;
-	int error, flags;
+	int error, flags = 0;
 
 	ump = VFSTOUDF(mp);
+
 	if (!ump)
 		panic("UDF unmount: empty ump\n");
 
@@ -400,6 +408,7 @@
 
 
 	/* setup basic mount information */
+	mp->mnt_data = NULL;
 	mp->mnt_stat.f_fsid.val[0] = dev2udev(devvp->v_rdev);
 	mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
 	mp->mnt_stat.f_namemax = UDF_MAX_NAMELEN;
@@ -413,6 +422,7 @@
 		MNTK_EXTENDED_SHARED;
 	MNT_IUNLOCK(mp);
 
+	/* allocate udf part of mount structure; malloc always succeeds */
 	ump = malloc(sizeof(struct udf_mount), M_UDFTEMP, M_WAITOK | M_ZERO);
 
 #if 0
@@ -422,6 +432,9 @@
 	mutex_init(&ump->get_node_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(&ump->allocate_mutex, MUTEX_DEFAULT, IPL_NONE);
 	cv_init(&ump->dirtynodes_cv, "udfsync2");
+
+	/* init rbtree for nodes, ordered by their icb address (long_ad) */
+	udf_init_nodes_tree(ump);
 #endif
 
 	/* set up linkage */
@@ -549,6 +562,9 @@
 		error = EINVAL;
 		goto fail;
 	}
+	
+	/*DPRINTF(VOLUMES, ("Read %d anchors on this disc, session %d\n",
+	    num_anchors, args->sessionnr));*/
 
 	/* read in volume descriptor sequence */
 	if ((error = udf_read_vds_space(ump))) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120608083630.7596F106566C>