kern/120482: [patch] Sync style changes between NetBSD and FreeBSD ntfs filesystem

Scot Hetzel swhetzel at gmail.com
Sat Feb 9 20:00:08 UTC 2008


>Number:         120482
>Category:       kern
>Synopsis:       [patch] Sync style changes between NetBSD and FreeBSD ntfs filesystem
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 09 20:00:08 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Scot Hetzel
>Release:        8.0-CURRENT
>Organization:
>Environment:
FreeBSD hp010 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Sat Feb  9 00:52:06 CST 2008     root at hp010:/usr/src/sys/amd64/compile/DV8135NR  amd64

>Description:
The attached patch syncs style changes between the NetBSD and FreeBSD NTFS filesystem implementations.

One additional change was to convert NTFS_DEBUG into  a sysctl option, which allows the debuging printfs to be enabled/disabled using:

sysctl debug.ntfs=X

Where X is:

0 - disable all debugging output
1 - enable some debugging output
2 - enable all debugging output

With theses changes, it allows us to easily compare the NetBSD NTFS filesystem to the FreeBSD implementation.
>How-To-Repeat:

>Fix:
Apply the attached style changes.

Patch attached with submission follows:

Index: ntfs.h
===================================================================
RCS file: /home/ncvs/src/sys/fs/ntfs/ntfs.h,v
retrieving revision 1.20
diff -u -r1.20 ntfs.h
--- ntfs.h	11 Sep 2005 15:57:07 -0000	1.20
+++ ntfs.h	9 Feb 2008 19:43:13 -0000
@@ -28,8 +28,6 @@
  * $FreeBSD: src/sys/fs/ntfs/ntfs.h,v 1.20 2005/09/11 15:57:07 rodrigc Exp $
  */
 
-/*#define NTFS_DEBUG 1*/
-
 typedef u_int64_t cn_t;
 typedef u_int16_t wchar;
 
@@ -285,20 +283,25 @@
 #define	ntfs_bpbl	(daddr_t)((ntmp)->ntm_bps)
 
 #ifdef MALLOC_DECLARE
+MALLOC_DECLARE(M_NTFSMNT);
 MALLOC_DECLARE(M_NTFSNTNODE);
 MALLOC_DECLARE(M_NTFSFNODE);
 MALLOC_DECLARE(M_NTFSDIR);
 MALLOC_DECLARE(M_NTFSNTHASH);
+MALLOC_DECLARE(M_NTFSNTVATTR);
+MALLOC_DECLARE(M_NTFSRDATA);
+MALLOC_DECLARE(M_NTFSDECOMP);
+MALLOC_DECLARE(M_NTFSRUN);
 #endif
 
-#if defined(NTFS_DEBUG)
-#define dprintf(a) printf a
-#if NTFS_DEBUG > 1
-#define ddprintf(a) printf a
-#else
-#define ddprintf(a)
-#endif
-#else
+#define NTFS_DEBUG
+#ifdef NTFS_DEBUG
+extern int ntfs_debug;
+#define DPRINTF(X, Y) do { if(ntfs_debug >= (X)) printf Y; } while(0)
+#define dprintf(a) DPRINTF(1, a)
+#define ddprintf(a) DPRINTF(2, a)
+#else /* NTFS_DEBUG */
+#define DPRINTF(X, Y)
 #define dprintf(a)
 #define ddprintf(a)
 #endif
Index: ntfs_compr.c
===================================================================
RCS file: /home/ncvs/src/sys/fs/ntfs/ntfs_compr.c,v
retrieving revision 1.13
diff -u -r1.13 ntfs_compr.c
--- ntfs_compr.c	26 Nov 2001 23:45:12 -0000	1.13
+++ ntfs_compr.c	9 Feb 2008 19:43:13 -0000
@@ -42,7 +42,7 @@
 
 int
 ntfs_uncompblock(
-	u_int8_t * buf,
+	u_int8_t * dbuf,
 	u_int8_t * cbuf)
 {
 	u_int32_t       ctag;
@@ -60,8 +60,8 @@
 			dprintf(("ntfs_uncompblock: len: %x instead of %d\n",
 			    len, 0xfff));
 		}
-		memcpy(buf, cbuf + 2, len + 1);
-		bzero(buf + len + 1, NTFS_COMPBLOCK_SIZE - 1 - len);
+		memcpy(dbuf, cbuf + 2, len + 1);
+		bzero(dbuf + len + 1, NTFS_COMPBLOCK_SIZE - 1 - len);
 		return len + 3;
 	}
 	cpos = 2;
@@ -78,12 +78,12 @@
 				boff = -1 - (GET_UINT16(cbuf + cpos) >> dshift);
 				blen = 3 + (GET_UINT16(cbuf + cpos) & lmask);
 				for (j = 0; (j < blen) && (pos < NTFS_COMPBLOCK_SIZE); j++) {
-					buf[pos] = buf[pos + boff];
+					dbuf[pos] = dbuf[pos + boff];
 					pos++;
 				}
 				cpos += 2;
 			} else {
-				buf[pos++] = cbuf[cpos++];
+				dbuf[pos++] = cbuf[cpos++];
 			}
 			ctag >>= 1;
 		}
Index: ntfs_ihash.c
===================================================================
RCS file: /home/ncvs/src/sys/fs/ntfs/ntfs_ihash.c,v
retrieving revision 1.23
diff -u -r1.23 ntfs_ihash.c
--- ntfs_ihash.c	13 Nov 2007 19:34:06 -0000	1.23
+++ ntfs_ihash.c	9 Feb 2008 19:43:13 -0000
@@ -88,11 +88,14 @@
 	ino_t inum;
 {
 	struct ntnode *ip;
+	struct nthashhead *ipp;
 
 	mtx_lock(&ntfs_nthash_mtx);
-	LIST_FOREACH(ip, NTNOHASH(dev, inum), i_hash)
+	ipp = NTNOHASH(dev, inum);
+	LIST_FOREACH(ip, ipp, i_hash) {
 		if (inum == ip->i_number && dev == ip->i_dev)
 			break;
+	}
 	mtx_unlock(&ntfs_nthash_mtx);
 
 	return (ip);
Index: ntfs_inode.h
===================================================================
RCS file: /home/ncvs/src/sys/fs/ntfs/ntfs_inode.h,v
retrieving revision 1.12
diff -u -r1.12 ntfs_inode.h
--- ntfs_inode.h	16 Jun 2004 09:47:04 -0000	1.12
+++ ntfs_inode.h	9 Feb 2008 19:43:13 -0000
@@ -97,5 +97,6 @@
         u_int16_t ntfid_len;     /* Length of structure. */
         u_int16_t ntfid_pad;     /* Force 32-bit alignment. */
         ino_t     ntfid_ino;     /* File number (ino). */
+	u_int8_t  ntfid_attr;    /* Attribute identifier */
         int32_t   ntfid_gen;     /* Generation number. */
 };
Index: ntfs_subr.c
===================================================================
RCS file: /home/ncvs/src/sys/fs/ntfs/ntfs_subr.c,v
retrieving revision 1.44
diff -u -r1.44 ntfs_subr.c
--- ntfs_subr.c	24 Jan 2008 12:34:26 -0000	1.44
+++ ntfs_subr.c	9 Feb 2008 19:43:13 -0000
@@ -42,7 +42,6 @@
 #include <sys/lock.h>
 #include <sys/iconv.h>
 
-/* #define NTFS_DEBUG 1 */
 #include <fs/ntfs/ntfs.h>
 #include <fs/ntfs/ntfsmount.h>
 #include <fs/ntfs/ntfs_inode.h>
@@ -139,9 +138,9 @@
 }
 
 /*
- * Search attribute specifed in ntnode (load ntnode if nessecary).
- * If not found but ATTR_A_ATTRLIST present, read it in and search throught.
- * VOP_VGET node needed, and lookup througth it's ntnode (load if nessesary).
+ * Search attribute specified in ntnode (load ntnode if nessecary).
+ * If not found but ATTR_A_ATTRLIST present, read it in and search through.
+ * VOP_VGET node needed, and lookup through it's ntnode (load if nessesary).
  *
  * ntnode should be locked
  */
@@ -200,6 +199,9 @@
 	nextaalp = NULL;
 
 	for(; len > 0; aalp = nextaalp) {
+/*
+		KASSERT(aalp != NULL);
+ */
 		dprintf(("ntfs_ntvattrget: " \
 			 "attrlist: ino: %d, attr: 0x%x, vcn: %d\n", \
 			 aalp->al_inumber, aalp->al_type, \
@@ -344,7 +346,7 @@
 	FREE(mfrp, M_TEMP);
 	return (error);
 }
-		
+
 /*
  * Routine locks ntnode and increase usecount, just opposite of
  * ntfs_ntput().
@@ -470,7 +472,7 @@
 }
 
 /*
- * increment usecount of ntnode 
+ * increment usecount of ntnode
  */
 void
 ntfs_ntref(ip)
@@ -581,7 +583,7 @@
 		memcpy(vap->va_datap, (caddr_t) rap + rap->a_r.a_dataoff,
 		       rap->a_r.a_datalen);
 	}
-	ddprintf((", len: %d", vap->va_datalen));
+	ddprintf((", len: %jd", vap->va_datalen));
 
 	if (error)
 		FREE(vap, M_NTFSNTVATTR);
@@ -735,7 +737,7 @@
 	return (ustrlen - mbstrlen);
 }
 
-/* 
+/*
  * Search fnode in ntnode, if not found allocate and preinitialize.
  *
  * ntnode should be locked on entry.
@@ -815,9 +817,9 @@
 }
 
 /*
- * Lookup attribute name in format: [[:$ATTR_TYPE]:$ATTR_NAME], 
+ * Lookup attribute name in format: [[:$ATTR_TYPE]:$ATTR_NAME],
  * $ATTR_TYPE is searched in attrdefs read from $AttrDefs.
- * If $ATTR_TYPE nott specifed, ATTR_A_DATA assumed.
+ * If $ATTR_TYPE not specifed, ATTR_A_DATA assumed.
  */
 static int
 ntfs_ntlookupattr(
@@ -848,7 +850,7 @@
 
 		adp = ntmp->ntm_ad;
 		for (i = 0; i < ntmp->ntm_adnum; i++, adp++){
-			if (syslen != adp->ad_namelen || 
+			if (syslen != adp->ad_namelen ||
 			   strncmp(sys, adp->ad_name, syslen) != 0)
 				continue;
 
@@ -870,7 +872,7 @@
 }
 
 /*
- * Lookup specifed node for filename, matching cnp,
+ * Lookup specified node for filename, matching cnp,
  * return fnode filled.
  */
 int
@@ -946,7 +948,7 @@
 				  (u_int32_t) iep->ie_number,
 				  (u_int32_t) iep->ie_fnametype));
 
-			/* check the name - the case-insensitible check
+			/* check the name - the case-insensitive check
 			 * has to come first, to break from this for loop
 			 * if needed, so we can dive correctly */
 			res = NTFS_UASTRICMP(iep->ie_fname, iep->ie_fnamelen,
@@ -1012,9 +1014,9 @@
 			if((nfp->f_fflag & NTFS_FFLAG_DIR) &&
 			   (nfp->f_attrtype == NTFS_A_DATA) &&
 			   (nfp->f_attrname == NULL))
-				f_type = VDIR;	
+				f_type = VDIR;
 			else
-				f_type = VREG;	
+				f_type = VREG;
 
 			nvp->v_type = f_type;
 
@@ -1105,8 +1107,8 @@
 /*
  * Read ntfs dir like stream of attr_indexentry, not like btree of them.
  * This is done by scaning $BITMAP:$I30 for busy clusters and reading them.
- * Ofcouse $INDEX_ROOT:$I30 is read before. Last read values are stored in
- * fnode, so we can skip toward record number num almost immediatly.
+ * Of course $INDEX_ROOT:$I30 is read before. Last read values are stored in
+ * fnode, so we can skip toward record number num almost immediately.
  * Anyway this is rather slow routine. The problem is that we don't know
  * how many records are there in $INDEX_ALLOCATION:$I30 block.
  */
@@ -1319,8 +1321,8 @@
 }
 
 /*
- * Get file sizes from corresponding attribute. 
- * 
+ * Get file sizes from corresponding attribute.
+ *
  * ntnode under fnode should be locked.
  */
 int
@@ -1365,7 +1367,7 @@
 ntfs_writeattr_plain(
 	struct ntfsmount * ntmp,
 	struct ntnode * ip,
-	u_int32_t attrnum,	
+	u_int32_t attrnum,
 	char *attrname,
 	off_t roff,
 	size_t rsize,
@@ -1394,12 +1396,12 @@
 					 off - ntfs_cntob(vap->va_vcnstart),
 					 towrite, data, &init, uio);
 		if (error) {
-			printf("ntfs_writeattr_plain: " \
+			dprintf(("ntfs_writeattr_plain: " \
 			       "ntfs_writentvattr_plain failed: o: %d, s: %d\n",
-			       (u_int32_t) off, (u_int32_t) towrite);
-			printf("ntfs_writeattr_plain: attrib: %d - %d\n",
+			       (u_int32_t) off, (u_int32_t) towrite));
+			dprintf(("ntfs_writeattr_plain: attrib: %d - %d\n",
 			       (u_int32_t) vap->va_vcnstart, 
-			       (u_int32_t) vap->va_vcnend);
+			       (u_int32_t) vap->va_vcnend));
 			ntfs_ntvattrrele(vap);
 			break;
 		}
@@ -1440,7 +1442,7 @@
 	*initp = 0;
 
 	if ((vap->va_flag & NTFS_AF_INRUN) == 0) {
-		printf("ntfs_writevattr_plain: CAN'T WRITE RES. ATTRIBUTE\n");
+		dprintf(("ntfs_writevattr_plain: CAN'T WRITE RES. ATTRIBUTE\n"));
 		return ENOTTY;
 	}
 
@@ -1638,7 +1640,7 @@
 					size_t remains = tocopy;
 					for(; remains; remains--)
 						uiomove("", 1, uio);
-				} else 
+				} else
 					bzero(data, tocopy);
 				data = data + tocopy;
 			}
@@ -1650,7 +1652,7 @@
 		}
 	} else {
 		ddprintf(("ntfs_readnvattr_plain: data is in mft record\n"));
-		if (uio) 
+		if (uio)
 			uiomove(vap->va_datap + roff, rsize, uio);
 		else
 			memcpy(rdata, vap->va_datap + roff, rsize);
@@ -1667,8 +1669,8 @@
 ntfs_readattr_plain(
 	struct ntfsmount * ntmp,
 	struct ntnode * ip,
-	u_int32_t attrnum,	
-	char *attrname,
+	u_int32_t attrnum,
+	const char *attrname,
 	off_t roff,
 	size_t rsize,
 	void *rdata,
@@ -1723,7 +1725,7 @@
 	struct ntfsmount * ntmp,
 	struct ntnode * ip,
 	u_int32_t attrnum,
-	char *attrname,
+	const char *attrname,
 	off_t roff,
 	size_t rsize,
 	void *rdata,
@@ -1742,7 +1744,9 @@
 
 	if ((roff > vap->va_datalen) ||
 	    (roff + rsize > vap->va_datalen)) {
-		ddprintf(("ntfs_readattr: offset too big\n"));
+		ddprintf(("ntfs_readattr: offset too big: %d (%d) > %d\n",
+			   (u_int32_t) roff, (u_int32_t) (roff + rsize),
+			   (u_int32_t) vap->va_datalen));
 		ntfs_ntvattrrele(vap);
 		return (E2BIG);
 	}
@@ -1905,7 +1909,7 @@
 #if 0
 int
 ntfs_runtocn(
-	     cn_t * cn,	
+	     cn_t * cn,
 	     struct ntfsmount * ntmp,
 	     u_int8_t * run,
 	     u_long len,
@@ -1916,14 +1920,16 @@
 	u_long          off = 0;
 	int             error = 0;
 
-#if NTFS_DEBUG
-	int             i;
-	printf("ntfs_runtocn: run: %p, %ld bytes, vcn:%ld\n",
-		run, len, (u_long) vcn);
-	printf("ntfs_runtocn: run: ");
-	for (i = 0; i < len; i++)
-		printf("0x%02x ", run[i]);
-	printf("\n");
+#ifdef NTFS_DEBUG
+	if (ntfs_debug > 0) {
+		int	i;
+		printf("ntfs_runtocn: run: %p, %ld bytes, vcn:%ld\n",
+			run, len, (u_long) vcn);
+		printf("ntfs_runtocn: run: ");
+		for (i = 0; i < len; i++)
+			printf("0x%02x ", run[i]);
+		printf("\n");
+	}
 #endif
 
 	if (NULL == run) {
@@ -2200,4 +2206,3 @@
 
 	return ('?');
 }
-
Index: ntfs_subr.h
===================================================================
RCS file: /home/ncvs/src/sys/fs/ntfs/ntfs_subr.h,v
retrieving revision 1.14
diff -u -r1.14 ntfs_subr.h
--- ntfs_subr.h	20 Nov 2006 19:28:36 -0000	1.14
+++ ntfs_subr.h	9 Feb 2008 19:43:13 -0000
@@ -74,38 +74,50 @@
 struct fnode;
 struct uio;
 
-int ntfs_procfixups( struct ntfsmount *, u_int32_t, caddr_t, size_t );
-int ntfs_parserun( cn_t *, cn_t *, u_int8_t *, u_long, u_long *);
-int ntfs_runtocn( cn_t *, struct ntfsmount *, u_int8_t *, u_long, cn_t);
-int ntfs_readntvattr_plain( struct ntfsmount *, struct ntnode *, struct ntvattr *, off_t, size_t, void *,size_t *, struct uio *);
-int ntfs_readattr_plain( struct ntfsmount *, struct ntnode *, u_int32_t, char *, off_t, size_t, void *,size_t *, struct uio *);
-int ntfs_readattr( struct ntfsmount *, struct ntnode *, u_int32_t, char *, off_t, size_t, void *, struct uio *);
-int ntfs_filesize( struct ntfsmount *, struct fnode *, u_int64_t *, u_int64_t *);
-int ntfs_times( struct ntfsmount *, struct ntnode *, ntfs_times_t *);
-struct timespec	ntfs_nttimetounix( u_int64_t );
-int ntfs_ntreaddir( struct ntfsmount *, struct fnode *, u_int32_t, struct attr_indexentry **);
-int ntfs_runtovrun( cn_t **, cn_t **, u_long *, u_int8_t *);
-int ntfs_attrtontvattr( struct ntfsmount *, struct ntvattr **, struct attr * );
-void ntfs_freentvattr( struct ntvattr * );
-int ntfs_loadntvattrs( struct ntfsmount *, struct vnode *, caddr_t, struct ntvattr **);
-struct ntvattr * ntfs_findntvattr( struct ntfsmount *, struct ntnode *, u_int32_t, cn_t );
-int ntfs_ntlookupfile(struct ntfsmount *, struct vnode *, struct componentname *, struct vnode **);
-int ntfs_isnamepermitted(struct ntfsmount *, struct attr_indexentry * );
-int ntfs_ntvattrrele(struct ntvattr * );
-int ntfs_ntvattrget(struct ntfsmount *, struct ntnode *, u_int32_t, const char *, cn_t , struct ntvattr **);
+int ntfs_procfixups(struct ntfsmount *, u_int32_t, caddr_t, size_t);
+int ntfs_parserun(cn_t *, cn_t *, u_int8_t *, u_long, u_long *);
+int ntfs_runtocn(cn_t *, struct ntfsmount *, u_int8_t *, u_long, cn_t);
+int ntfs_readntvattr_plain(struct ntfsmount *, struct ntnode *,
+	struct ntvattr *, off_t, size_t, void *,size_t *, struct uio *);
+int ntfs_readattr_plain(struct ntfsmount *, struct ntnode *, u_int32_t,
+	const char *, off_t, size_t, void *,size_t *, struct uio *);
+int ntfs_readattr(struct ntfsmount *, struct ntnode *, u_int32_t,
+	const char *, off_t, size_t, void *, struct uio *);
+int ntfs_filesize(struct ntfsmount *, struct fnode *, u_int64_t *,
+	u_int64_t *);
+int ntfs_times(struct ntfsmount *, struct ntnode *, ntfs_times_t *);
+struct timespec	ntfs_nttimetounix(u_int64_t);
+int ntfs_ntreaddir(struct ntfsmount *, struct fnode *, u_int32_t,
+	struct attr_indexentry **);
+int ntfs_runtovrun(cn_t **, cn_t **, u_long *, u_int8_t *);
+int ntfs_attrtontvattr(struct ntfsmount *, struct ntvattr **, struct attr *);
+void ntfs_freentvattr(struct ntvattr *);
+int ntfs_loadntvattrs(struct ntfsmount *, struct vnode *, caddr_t,
+	struct ntvattr **);
+struct ntvattr * ntfs_findntvattr(struct ntfsmount *, struct ntnode *,
+	u_int32_t, cn_t);
+int ntfs_ntlookupfile(struct ntfsmount *, struct vnode *,
+	struct componentname *, struct vnode **);
+int ntfs_isnamepermitted(struct ntfsmount *, struct attr_indexentry *);
+int ntfs_ntvattrrele(struct ntvattr *);
+int ntfs_ntvattrget(struct ntfsmount *, struct ntnode *, u_int32_t,
+	const char *, cn_t , struct ntvattr **);
 int ntfs_ntlookup(struct ntfsmount *, ino_t, struct ntnode **);
 int ntfs_ntget(struct ntnode *);
 void ntfs_ntref(struct ntnode *);
 void ntfs_ntrele(struct ntnode *);
 void ntfs_ntput(struct ntnode *);
-int ntfs_loadntnode( struct ntfsmount *, struct ntnode * );
-int ntfs_writentvattr_plain(struct ntfsmount *, struct ntnode *, struct ntvattr *, off_t, size_t, void *, size_t *, struct uio *);
-int ntfs_writeattr_plain(struct ntfsmount *, struct ntnode *, u_int32_t, char *, off_t, size_t, void *, size_t *, struct uio *);
+int ntfs_loadntnode(struct ntfsmount *, struct ntnode *);
+int ntfs_writentvattr_plain(struct ntfsmount *, struct ntnode *,
+	struct ntvattr *, off_t, size_t, void *, size_t *, struct uio *);
+int ntfs_writeattr_plain(struct ntfsmount *, struct ntnode *, u_int32_t,
+	char *, off_t, size_t, void *, size_t *, struct uio *);
 void ntfs_toupper_init(void);
 void ntfs_toupper_destroy(void);
 int ntfs_toupper_use(struct mount *, struct ntfsmount *);
 void ntfs_toupper_unuse(void);
-int ntfs_fget(struct ntfsmount *, struct ntnode *, int, char *, struct fnode **);
+int ntfs_fget(struct ntfsmount *, struct ntnode *, int, char *,
+	struct fnode **);
 void ntfs_frele(struct fnode *);
 
 int ntfs_u28_init(struct ntfsmount *ntmp, wchar *u2w, char *cs_local, char *cs_ntfs);
Index: ntfs_vfsops.c
===================================================================
RCS file: /home/ncvs/src/sys/fs/ntfs/ntfs_vfsops.c,v
retrieving revision 1.92
diff -u -r1.92 ntfs_vfsops.c
--- ntfs_vfsops.c	13 Jan 2008 14:44:04 -0000	1.92
+++ ntfs_vfsops.c	9 Feb 2008 19:43:13 -0000
@@ -53,7 +53,8 @@
 #include <vm/vm_object.h>
 #include <vm/vm_extern.h>
 
-/*#define NTFS_DEBUG 1*/
+#include <sys/sysctl.h>
+
 #include <fs/ntfs/ntfs.h>
 #include <fs/ntfs/ntfs_inode.h>
 #include <fs/ntfs/ntfs_subr.h>
@@ -61,7 +62,13 @@
 #include <fs/ntfs/ntfs_ihash.h>
 #include <fs/ntfs/ntfsmount.h>
 
-static MALLOC_DEFINE(M_NTFSMNT, "ntfs_mount", "NTFS mount structure");
+#ifdef NTFS_DEBUG
+int ntfs_debug = 0;
+SYSCTL_INT(_debug, OID_AUTO, ntfs, CTLFLAG_RW, &ntfs_debug, 0,
+	"ntfs debug level");
+#endif
+
+MALLOC_DEFINE(M_NTFSMNT, "ntfs_mount", "NTFS mount structure");
 MALLOC_DEFINE(M_NTFSNTNODE,"ntfs_ntnode",  "NTFS ntnode information");
 MALLOC_DEFINE(M_NTFSFNODE,"ntfs_fnode",  "NTFS fnode information");
 MALLOC_DEFINE(M_NTFSDIR,"ntfs_dir",  "NTFS dir buffer");
@@ -70,7 +77,6 @@
 
 static int	ntfs_mountfs(register struct vnode *, struct mount *, 
 				  struct thread *);
-static int	ntfs_calccfree(struct ntfsmount *ntmp, cn_t *cfreep);
 
 static vfs_init_t       ntfs_init;
 static vfs_uninit_t     ntfs_uninit;
@@ -488,7 +494,7 @@
 	dprintf(("ntfs_unmount: vflushing...\n"));
 	error = vflush(mp, 0, flags | SKIPSYSTEM, td);
 	if (error) {
-		printf("ntfs_unmount: vflush failed: %d\n",error);
+		dprintf(("ntfs_unmount: vflush failed: %d\n",error));
 		return (error);
 	}
 
@@ -553,7 +559,7 @@
 	return (0);
 }
 
-static int
+int
 ntfs_calccfree(
 	struct ntfsmount *ntmp,
 	cn_t *cfreep)
@@ -695,9 +701,9 @@
 			f_type = VNON;
 			fp->f_size = fp->f_allocated = 0;
 		} else {
-			f_type = VREG;	
+			f_type = VREG;
 
-			error = ntfs_filesize(ntmp, fp, 
+			error = ntfs_filesize(ntmp, fp,
 					      &fp->f_size, &fp->f_allocated);
 			if (error) {
 				ntfs_ntput(ip);
Index: ntfs_vfsops.h
===================================================================
RCS file: /home/ncvs/src/sys/fs/ntfs/ntfs_vfsops.h,v
retrieving revision 1.8
diff -u -r1.8 ntfs_vfsops.h
--- ntfs_vfsops.h	10 Feb 2005 12:09:49 -0000	1.8
+++ ntfs_vfsops.h	9 Feb 2008 19:43:13 -0000
@@ -41,3 +41,4 @@
 
 int ntfs_vgetex(struct mount *, ino_t, u_int32_t, char *, u_long, u_long,
 		struct thread *, struct vnode **);
+int ntfs_calccfree(struct ntfsmount *, cn_t *);
Index: ntfs_vnops.c
===================================================================
RCS file: /home/ncvs/src/sys/fs/ntfs/ntfs_vnops.c,v
retrieving revision 1.62
diff -u -r1.62 ntfs_vnops.c
--- ntfs_vnops.c	13 Jan 2008 14:44:04 -0000	1.62
+++ ntfs_vnops.c	9 Feb 2008 19:43:13 -0000
@@ -59,7 +59,6 @@
 
 #include <sys/sysctl.h>
 
-/*#define NTFS_DEBUG 1*/
 #include <fs/ntfs/ntfs.h>
 #include <fs/ntfs/ntfs_inode.h>
 #include <fs/ntfs/ntfs_subr.h>
@@ -217,9 +216,9 @@
 	register struct vnode *vp = ap->a_vp;
 #ifdef NTFS_DEBUG
 	register struct ntnode *ip = VTONT(vp);
-#endif
 
 	dprintf(("ntfs_inactive: vnode: %p, ntnode: %d\n", vp, ip->i_number));
+#endif
 
 	if (ntfs_prtactive && vrefcnt(vp) != 0)
 		vprint("ntfs_inactive: pushing active", vp);
@@ -376,7 +375,7 @@
 		fp->f_attrname, uio->uio_offset, towrite, NULL, &written, uio);
 #ifdef NTFS_DEBUG
 	if (error)
-		printf("ntfs_write: ntfs_writeattr failed: %d\n", error);
+		dprintf(("ntfs_write: ntfs_writeattr failed: %d\n", error));
 #endif
 
 	return (error);
@@ -443,7 +442,7 @@
 	register struct vnode *vp = ap->a_vp;
 	register struct ntnode *ip = VTONT(vp);
 
-	printf("ntfs_open: %d\n",ip->i_number);
+	dprintf(("ntfs_open: %d\n",ip->i_number));
 #endif
 
 	vnode_create_vobject(ap->a_vp, VTOF(ap->a_vp)->f_size, ap->a_td);
@@ -474,7 +473,7 @@
 	register struct vnode *vp = ap->a_vp;
 	register struct ntnode *ip = VTONT(vp);
 
-	printf("ntfs_close: %d\n",ip->i_number);
+	dprintf(("ntfs_close: %d\n",ip->i_number));
 #endif
 
 	return (0);


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list