changeset 342:ce702882929d

Move tracing out of yportenv.h
author charles <charles>
date Mon, 11 Jan 2010 04:06:46 +0000
parents 89e691a21fd1
children 1d1b453d8b57
files direct/Makefile direct/python/Makefile direct/python/yaffs_python_helper.c direct/tests/Makefile direct/tests/yaffs_test.c direct/yaffs_fileem.c direct/yaffs_fileem2k.c direct/yaffs_norif1.c direct/yaffs_ramdisk.c direct/yaffs_ramem2k.c direct/yaffscfg2k.c direct/yaffsfs.c yaffs_fs.c yaffs_getblockinfo.h yaffs_guts.c yaffs_mtdif1.c yaffs_mtdif2.c yaffs_packedtags2.c yaffs_tagscompat.c yaffs_trace.h yportenv.h
diffstat 21 files changed, 98 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/direct/Makefile
+++ b/direct/Makefile
@@ -14,7 +14,7 @@
 #
 # NB Warning this Makefile does not include header dependencies.
 #
-# $Id: Makefile,v 1.22 2009-01-04 21:44:24 charles Exp $
+# $Id: Makefile,v 1.23 2010-01-11 04:06:47 charles Exp $
 
 #EXTRA_COMPILE_FLAGS = -DYAFFS_IGNORE_TAGS_ECC
 
@@ -48,7 +48,7 @@ SYMLINKS = devextras.h yaffs_ecc.c yaffs
           yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h  yaffs_nandemul2k.h \
           yaffs_nand.c yaffs_nand.h yaffs_getblockinfo.h \
           yaffs_tagsvalidity.c yaffs_tagsvalidity.h yaffs_checkptrw.h yaffs_checkptrw.c \
-          yaffs_qsort.c yaffs_qsort.h
+          yaffs_qsort.c yaffs_qsort.h yaffs_trace.h
 
 #all: directtest2k boottest
 
--- a/direct/python/Makefile
+++ b/direct/python/Makefile
@@ -14,7 +14,7 @@
 #
 # NB Warning this Makefile does not include header dependencies.
 #
-# $Id: Makefile,v 1.4 2009-10-12 23:05:49 charles Exp $
+# $Id: Makefile,v 1.5 2010-01-11 04:06:47 charles Exp $
 
 #EXTRA_COMPILE_FLAGS = -DYAFFS_IGNORE_TAGS_ECC
 
@@ -50,7 +50,7 @@ YAFFSDIRECTSYMLINKS =  yaffscfg2k.c yaff
 		       yaffs_fileem2k.h yaffsfs.h yaffs_malloc.h yaffs_ramdisk.h ydirectenv.h \
 		       yaffscfg.h yaffs_fileem.c yaffs_flashif.c yaffs_ramdisk.c yaffs_ramem2k.c\
 		       yaffs_norif1.c yaffs_norif1.h ynorsim.c ynorsim.h \
-		       yaffs_nandif.c yaffs_nandif.h
+		       yaffs_nandif.c yaffs_nandif.h yaffs_trace.h
 
 
 SYMLINKS = $(YAFFSSYMLINKS) $(YAFFSDIRECTSYMLINKS)
--- a/direct/python/yaffs_python_helper.c
+++ b/direct/python/yaffs_python_helper.c
@@ -22,6 +22,7 @@
  */
  
 #include "yaffsfs.h"
+#include "yaffs_trace.h"
 
 int simulate_power_failure;
 int random_seed;
--- a/direct/tests/Makefile
+++ b/direct/tests/Makefile
@@ -14,7 +14,7 @@
 #
 # NB Warning this Makefile does not include header dependencies.
 #
-# $Id: Makefile,v 1.5 2009-12-14 19:46:27 charles Exp $
+# $Id: Makefile,v 1.6 2010-01-11 04:06:47 charles Exp $
 
 #EXTRA_COMPILE_FLAGS = -DYAFFS_IGNORE_TAGS_ECC
 
@@ -48,7 +48,7 @@ YAFFSSYMLINKS = devextras.h yaffs_ecc.c 
           yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h  yaffs_nandemul2k.h \
           yaffs_nand.c yaffs_nand.h yaffs_getblockinfo.h \
           yaffs_tagsvalidity.c yaffs_tagsvalidity.h yaffs_checkptrw.h yaffs_checkptrw.c \
-          yaffs_qsort.c yaffs_qsort.h
+          yaffs_qsort.c yaffs_qsort.h yaffs_trace.h
 
 YAFFSDIRECTSYMLINKS =  yaffscfg2k.c yaffs_fileem2k.c yaffsfs.c yaffs_flashif.h yaffs_flashif2.h\
 		       yaffs_fileem2k.h yaffsfs.h yaffs_malloc.h yaffs_ramdisk.h ydirectenv.h \
--- a/direct/tests/yaffs_test.c
+++ b/direct/tests/yaffs_test.c
@@ -24,6 +24,8 @@
 
 #include "yaffsfs.h"
 
+#include "yaffs_trace.h"
+
 #include "nor_stress.h"
 #include "yaffs_fsx.h"
 
--- a/direct/yaffs_fileem.c
+++ b/direct/yaffs_fileem.c
@@ -16,10 +16,11 @@
  * This is only intended as test code to test persistence etc.
  */
 
-const char *yaffs_flashif_c_version = "$Id: yaffs_fileem.c,v 1.5 2009-01-12 00:49:01 charles Exp $";
+const char *yaffs_flashif_c_version = "$Id: yaffs_fileem.c,v 1.6 2010-01-11 04:06:47 charles Exp $";
 
 
 #include "yportenv.h"
+#include "yaffs_trace.h"
 
 #include "yaffs_flashif.h"
 #include "yaffs_guts.h"
--- a/direct/yaffs_fileem2k.c
+++ b/direct/yaffs_fileem2k.c
@@ -16,10 +16,11 @@
  * This is only intended as test code to test persistence etc.
  */
 
-const char *yaffs_flashif2_c_version = "$Id: yaffs_fileem2k.c,v 1.21 2009-11-07 22:35:15 charles Exp $";
+const char *yaffs_flashif2_c_version = "$Id: yaffs_fileem2k.c,v 1.22 2010-01-11 04:06:47 charles Exp $";
 
 
 #include "yportenv.h"
+#include "yaffs_trace.h"
 
 #include "yaffs_flashif2.h"
 #include "yaffs_guts.h"
--- a/direct/yaffs_norif1.c
+++ b/direct/yaffs_norif1.c
@@ -35,11 +35,12 @@
  *   
  */
 
-const char *yaffs_norif1_c_version = "$Id: yaffs_norif1.c,v 1.4 2009-01-09 02:54:14 charles Exp $";
+const char *yaffs_norif1_c_version = "$Id: yaffs_norif1.c,v 1.5 2010-01-11 04:06:47 charles Exp $";
 
 #include "yaffs_norif1.h"
 
 #include "yportenv.h"
+#include "yaffs_trace.h"
 
 #include "yaffs_flashif.h"
 #include "yaffs_guts.h"
--- a/direct/yaffs_ramdisk.c
+++ b/direct/yaffs_ramdisk.c
@@ -18,10 +18,11 @@
  * Use this with dev->useNANDECC enabled, then ECC overheads are not required.
  */
 
-const char *yaffs_ramdisk_c_version = "$Id: yaffs_ramdisk.c,v 1.5 2008-05-05 07:58:58 charles Exp $";
+const char *yaffs_ramdisk_c_version = "$Id: yaffs_ramdisk.c,v 1.6 2010-01-11 04:06:47 charles Exp $";
 
 
 #include "yportenv.h"
+#include "yaffs_trace.h"
 
 #include "yaffs_ramdisk.h"
 #include "yaffs_guts.h"
--- a/direct/yaffs_ramem2k.c
+++ b/direct/yaffs_ramem2k.c
@@ -16,7 +16,7 @@
  */
 
 
-const char *yaffs_ramem2k_c_version = "$Id: yaffs_ramem2k.c,v 1.5 2009-10-14 00:01:57 charles Exp $";
+const char *yaffs_ramem2k_c_version = "$Id: yaffs_ramem2k.c,v 1.6 2010-01-11 04:06:47 charles Exp $";
 
 #ifndef __KERNEL__
 #define CONFIG_YAFFS_RAM_ENABLED
@@ -27,6 +27,7 @@ const char *yaffs_ramem2k_c_version = "$
 #ifdef CONFIG_YAFFS_RAM_ENABLED
 
 #include "yportenv.h"
+#include "yaffs_trace.h"
 
 #include "yaffs_nandemul2k.h"
 #include "yaffs_guts.h"
--- a/direct/yaffscfg2k.c
+++ b/direct/yaffscfg2k.c
@@ -23,6 +23,7 @@
 #include "yaffs_fileem2k.h"
 #include "yaffs_nandemul2k.h"
 #include "yaffs_norif1.h"
+#include "yaffs_trace.h"
 
 #include <errno.h>
 
--- a/direct/yaffsfs.c
+++ b/direct/yaffsfs.c
@@ -14,8 +14,10 @@
 #include "yaffsfs.h"
 #include "yaffs_guts.h"
 #include "yaffscfg.h"
+#include "yportenv.h"
+#include "yaffs_trace.h"
+
 #include <string.h> // for memset
-#include "yportenv.h"
 
 #define YAFFSFS_MAX_SYMLINK_DEREFERENCES 5
 
@@ -24,7 +26,7 @@
 #endif
 
 
-const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.30 2010-01-06 04:00:23 charles Exp $";
+const char *yaffsfs_c_version="$Id: yaffsfs.c,v 1.31 2010-01-11 04:06:47 charles Exp $";
 
 // configurationList is the list of devices that are supported
 static yaffsfs_DeviceConfiguration *yaffsfs_configurationList;
--- a/yaffs_fs.c
+++ b/yaffs_fs.c
@@ -32,7 +32,7 @@
  */
 
 const char *yaffs_fs_c_version =
-    "$Id: yaffs_fs.c,v 1.90 2009-12-23 03:14:17 charles Exp $";
+    "$Id: yaffs_fs.c,v 1.91 2010-01-11 04:06:46 charles Exp $";
 extern const char *yaffs_guts_c_version;
 
 #include <linux/version.h>
@@ -114,6 +114,7 @@ static uint32_t YCALCBLOCKS(uint64_t par
 #include <linux/uaccess.h>
 
 #include "yportenv.h"
+#include "yaffs_trace.h"
 #include "yaffs_guts.h"
 
 #include <linux/mtd/mtd.h>
@@ -1585,7 +1586,7 @@ static int yaffs_sync_object(struct file
 
 	dev = obj->myDev;
 
-	T(YAFFS_TRACE_OS, ("yaffs_sync_object\n"));
+	T(YAFFS_TRACE_OS | YAFFS_TRACE_SYNC, ("yaffs_sync_object\n"));
 	yaffs_GrossLock(dev);
 	yaffs_FlushFile(obj, 1, datasync);
 	yaffs_GrossUnlock(dev);
@@ -1776,7 +1777,7 @@ static int yaffs_do_sync_fs(struct super
 {
 
 	yaffs_Device *dev = yaffs_SuperToDevice(sb);
-	T(YAFFS_TRACE_OS, ("yaffs_do_sync_fs\n"));
+	T(YAFFS_TRACE_OS | YAFFS_TRACE_SYNC, ("yaffs_do_sync_fs\n"));
 
 	if (sb->s_dirt) {
 		yaffs_GrossLock(dev);
@@ -1802,7 +1803,7 @@ static int yaffs_write_super(struct supe
 #endif
 {
 
-	T(YAFFS_TRACE_OS, ("yaffs_write_super\n"));
+	T(YAFFS_TRACE_OS | YAFFS_TRACE_SYNC, ("yaffs_write_super\n"));
 	if (yaffs_auto_checkpoint >= 2)
 		yaffs_do_sync_fs(sb);
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18))
@@ -1817,7 +1818,7 @@ static int yaffs_sync_fs(struct super_bl
 static int yaffs_sync_fs(struct super_block *sb)
 #endif
 {
-	T(YAFFS_TRACE_OS, ("yaffs_sync_fs\n"));
+	T(YAFFS_TRACE_OS | YAFFS_TRACE_SYNC, ("yaffs_sync_fs\n"));
 
 	if (yaffs_auto_checkpoint >= 1)
 		yaffs_do_sync_fs(sb);
@@ -2593,6 +2594,7 @@ static struct {
 	{"scan_debug", YAFFS_TRACE_SCAN_DEBUG},
 	{"scan", YAFFS_TRACE_SCAN},
 	{"tracing", YAFFS_TRACE_TRACING},
+	{"sync", YAFFS_TRACE_SYNC},
 
 	{"verify", YAFFS_TRACE_VERIFY},
 	{"verify_nand", YAFFS_TRACE_VERIFY_NAND},
--- a/yaffs_getblockinfo.h
+++ b/yaffs_getblockinfo.h
@@ -17,6 +17,7 @@
 #define __YAFFS_GETBLOCKINFO_H__
 
 #include "yaffs_guts.h"
+#include "yaffs_trace.h"
 
 /* Function to manipulate block info */
 static Y_INLINE yaffs_BlockInfo *yaffs_GetBlockInfo(yaffs_Device * dev, int blk)
--- a/yaffs_guts.c
+++ b/yaffs_guts.c
@@ -12,9 +12,10 @@
  */
 
 const char *yaffs_guts_c_version =
-    "$Id: yaffs_guts.c,v 1.105 2010-01-06 04:02:12 charles Exp $";
+    "$Id: yaffs_guts.c,v 1.106 2010-01-11 04:06:46 charles Exp $";
 
 #include "yportenv.h"
+#include "yaffs_trace.h"
 
 #include "yaffsinterface.h"
 #include "yaffs_guts.h"
--- a/yaffs_mtdif1.c
+++ b/yaffs_mtdif1.c
@@ -24,6 +24,7 @@
  */
 
 #include "yportenv.h"
+#include "yaffs_trace.h"
 #include "yaffs_guts.h"
 #include "yaffs_packedtags1.h"
 #include "yaffs_tagscompat.h"	/* for yaffs_CalcTagsECC */
@@ -36,7 +37,7 @@
 /* Don't compile this module if we don't have MTD's mtd_oob_ops interface */
 #if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17))
 
-const char *yaffs_mtdif1_c_version = "$Id: yaffs_mtdif1.c,v 1.11 2009-09-09 03:03:01 charles Exp $";
+const char *yaffs_mtdif1_c_version = "$Id: yaffs_mtdif1.c,v 1.12 2010-01-11 04:06:46 charles Exp $";
 
 #ifndef CONFIG_YAFFS_9BYTE_TAGS
 # define YTAG1_SIZE 8
--- a/yaffs_mtdif2.c
+++ b/yaffs_mtdif2.c
@@ -14,10 +14,10 @@
 /* mtd interface for YAFFS2 */
 
 const char *yaffs_mtdif2_c_version =
-	"$Id: yaffs_mtdif2.c,v 1.24 2009-10-14 00:01:57 charles Exp $";
+	"$Id: yaffs_mtdif2.c,v 1.25 2010-01-11 04:06:46 charles Exp $";
 
 #include "yportenv.h"
-
+#include "yaffs_trace.h"
 
 #include "yaffs_mtdif2.h"
 
--- a/yaffs_packedtags2.c
+++ b/yaffs_packedtags2.c
@@ -13,6 +13,7 @@
 
 #include "yaffs_packedtags2.h"
 #include "yportenv.h"
+#include "yaffs_trace.h"
 #include "yaffs_tagsvalidity.h"
 
 /* This code packs a set of extended tags into a binary structure for
--- a/yaffs_tagscompat.c
+++ b/yaffs_tagscompat.c
@@ -15,6 +15,7 @@
 #include "yaffs_tagscompat.h"
 #include "yaffs_ecc.h"
 #include "yaffs_getblockinfo.h"
+#include "yaffs_trace.h"
 
 static void yaffs_HandleReadDataError(yaffs_Device *dev, int chunkInNAND);
 #ifdef NOTYET
new file mode 100644
--- /dev/null
+++ b/yaffs_trace.h
@@ -0,0 +1,58 @@
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
+ *
+ * Copyright (C) 2002-2007 Aleph One Ltd.
+ *   for Toby Churchill Ltd and Brightstar Engineering
+ *
+ * Created by Charles Manning <charles@aleph1.co.uk>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ *
+ * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
+ */
+
+
+#ifndef __YTRACE_H__
+#define __YTRACE_H__
+
+extern unsigned int yaffs_traceMask;
+extern unsigned int yaffs_wr_attempts;
+
+/*
+ * Tracing flags.
+ * The flags masked in YAFFS_TRACE_ALWAYS are always traced.
+ */
+
+#define YAFFS_TRACE_OS			0x00000002
+#define YAFFS_TRACE_ALLOCATE		0x00000004
+#define YAFFS_TRACE_SCAN		0x00000008
+#define YAFFS_TRACE_BAD_BLOCKS		0x00000010
+#define YAFFS_TRACE_ERASE		0x00000020
+#define YAFFS_TRACE_GC			0x00000040
+#define YAFFS_TRACE_WRITE		0x00000080
+#define YAFFS_TRACE_TRACING		0x00000100
+#define YAFFS_TRACE_DELETION		0x00000200
+#define YAFFS_TRACE_BUFFERS		0x00000400
+#define YAFFS_TRACE_NANDACCESS		0x00000800
+#define YAFFS_TRACE_GC_DETAIL		0x00001000
+#define YAFFS_TRACE_SCAN_DEBUG		0x00002000
+#define YAFFS_TRACE_MTD			0x00004000
+#define YAFFS_TRACE_CHECKPOINT		0x00008000
+
+#define YAFFS_TRACE_VERIFY		0x00010000
+#define YAFFS_TRACE_VERIFY_NAND		0x00020000
+#define YAFFS_TRACE_VERIFY_FULL		0x00040000
+#define YAFFS_TRACE_VERIFY_ALL		0x000F0000
+
+#define YAFFS_TRACE_SYNC		0x00100000
+
+#define YAFFS_TRACE_ERROR		0x40000000
+#define YAFFS_TRACE_BUG			0x80000000
+#define YAFFS_TRACE_ALWAYS		0xF0000000
+
+
+#define T(mask, p) do { if ((mask) & (yaffs_traceMask | YAFFS_TRACE_ALWAYS)) TOUT(p); } while (0)
+
+#endif
--- a/yportenv.h
+++ b/yportenv.h
@@ -158,43 +158,6 @@
 
 #endif
 
-/* see yaffs_fs.c */
-extern unsigned int yaffs_traceMask;
-extern unsigned int yaffs_wr_attempts;
-
-/*
- * Tracing flags.
- * The flags masked in YAFFS_TRACE_ALWAYS are always traced.
- */
-
-#define YAFFS_TRACE_OS			0x00000002
-#define YAFFS_TRACE_ALLOCATE		0x00000004
-#define YAFFS_TRACE_SCAN		0x00000008
-#define YAFFS_TRACE_BAD_BLOCKS		0x00000010
-#define YAFFS_TRACE_ERASE		0x00000020
-#define YAFFS_TRACE_GC			0x00000040
-#define YAFFS_TRACE_WRITE		0x00000080
-#define YAFFS_TRACE_TRACING		0x00000100
-#define YAFFS_TRACE_DELETION		0x00000200
-#define YAFFS_TRACE_BUFFERS		0x00000400
-#define YAFFS_TRACE_NANDACCESS		0x00000800
-#define YAFFS_TRACE_GC_DETAIL		0x00001000
-#define YAFFS_TRACE_SCAN_DEBUG		0x00002000
-#define YAFFS_TRACE_MTD			0x00004000
-#define YAFFS_TRACE_CHECKPOINT		0x00008000
-
-#define YAFFS_TRACE_VERIFY		0x00010000
-#define YAFFS_TRACE_VERIFY_NAND		0x00020000
-#define YAFFS_TRACE_VERIFY_FULL		0x00040000
-#define YAFFS_TRACE_VERIFY_ALL		0x000F0000
-
-
-#define YAFFS_TRACE_ERROR		0x40000000
-#define YAFFS_TRACE_BUG			0x80000000
-#define YAFFS_TRACE_ALWAYS		0xF0000000
-
-
-#define T(mask, p) do { if ((mask) & (yaffs_traceMask | YAFFS_TRACE_ALWAYS)) TOUT(p); } while (0)
 
 #ifndef YBUG
 #define YBUG() do {T(YAFFS_TRACE_BUG, (TSTR("==>> yaffs bug: " __FILE__ " %d" TENDSTR), __LINE__)); } while (0)