From 7f0f2c68474e11183cfbaebfd7c21ba48228f05e Mon Sep 17 00:00:00 2001 From: charles Date: Mon, 11 Jan 2010 04:06:46 +0000 Subject: [PATCH] Move tracing out of yportenv.h --- direct/Makefile | 4 +- direct/python/Makefile | 4 +- direct/python/yaffs_python_helper.c | 1 + direct/tests/Makefile | 4 +- direct/tests/yaffs_test.c | 2 + direct/yaffs_fileem.c | 3 +- direct/yaffs_fileem2k.c | 3 +- direct/yaffs_norif1.c | 3 +- direct/yaffs_ramdisk.c | 3 +- direct/yaffs_ramem2k.c | 3 +- direct/yaffscfg2k.c | 1 + direct/yaffsfs.c | 6 ++- yaffs_fs.c | 12 +++--- yaffs_getblockinfo.h | 1 + yaffs_guts.c | 3 +- yaffs_mtdif1.c | 3 +- yaffs_mtdif2.c | 4 +- yaffs_packedtags2.c | 1 + yaffs_tagscompat.c | 1 + yaffs_trace.h | 58 +++++++++++++++++++++++++++++ yportenv.h | 37 ------------------ 21 files changed, 98 insertions(+), 59 deletions(-) create mode 100644 yaffs_trace.h diff --git a/direct/Makefile b/direct/Makefile index ead70e1..0f2b7ed 100644 --- 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_ecc.h yaffs_guts.c yaffs_guts.h yaffsin 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 diff --git a/direct/python/Makefile b/direct/python/Makefile index f9f42b8..888854f 100644 --- 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 yaffs_fileem2k.c yaffsfs.c yaffs_flashif.h y 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) diff --git a/direct/python/yaffs_python_helper.c b/direct/python/yaffs_python_helper.c index cbb434c..0a523e6 100644 --- 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; diff --git a/direct/tests/Makefile b/direct/tests/Makefile index f4b3974..fe12adf 100644 --- 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_ecc.h yaffs_guts.c yaffs_guts.h ya 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 \ diff --git a/direct/tests/yaffs_test.c b/direct/tests/yaffs_test.c index 9b36e08..faf5bef 100644 --- 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" diff --git a/direct/yaffs_fileem.c b/direct/yaffs_fileem.c index 6f93972..6953a68 100644 --- 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" diff --git a/direct/yaffs_fileem2k.c b/direct/yaffs_fileem2k.c index 9ef488e..a4a652f 100644 --- 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" diff --git a/direct/yaffs_norif1.c b/direct/yaffs_norif1.c index 06bea3d..8753e4e 100644 --- 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" diff --git a/direct/yaffs_ramdisk.c b/direct/yaffs_ramdisk.c index fa76b6c..0889fb2 100644 --- 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" diff --git a/direct/yaffs_ramem2k.c b/direct/yaffs_ramem2k.c index 767dcea..6ebb75a 100644 --- 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 = "$Id: yaffs_ramem2k.c,v 1.5 2009-10-14 00: #ifdef CONFIG_YAFFS_RAM_ENABLED #include "yportenv.h" +#include "yaffs_trace.h" #include "yaffs_nandemul2k.h" #include "yaffs_guts.h" diff --git a/direct/yaffscfg2k.c b/direct/yaffscfg2k.c index 41048bc..3118fa0 100644 --- 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 diff --git a/direct/yaffsfs.c b/direct/yaffsfs.c index 645db71..cc7eb64 100644 --- a/direct/yaffsfs.c +++ b/direct/yaffsfs.c @@ -14,8 +14,10 @@ #include "yaffsfs.h" #include "yaffs_guts.h" #include "yaffscfg.h" -#include // for memset #include "yportenv.h" +#include "yaffs_trace.h" + +#include // for memset #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; diff --git a/yaffs_fs.c b/yaffs_fs.c index a62724f..39de074 100644 --- 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 @@ -114,6 +114,7 @@ static uint32_t YCALCBLOCKS(uint64_t partition_size, uint32_t block_size) #include #include "yportenv.h" +#include "yaffs_trace.h" #include "yaffs_guts.h" #include @@ -1585,7 +1586,7 @@ static int yaffs_sync_object(struct file *file, struct dentry *dentry, 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_block *sb) { 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 super_block *sb) #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_block *sb, int wait) 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}, diff --git a/yaffs_getblockinfo.h b/yaffs_getblockinfo.h index 5b0a1ac..c8ff777 100644 --- 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) diff --git a/yaffs_guts.c b/yaffs_guts.c index f9819f0..6658918 100644 --- 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" diff --git a/yaffs_mtdif1.c b/yaffs_mtdif1.c index 00fa4f2..990e0fb 100644 --- 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 diff --git a/yaffs_mtdif2.c b/yaffs_mtdif2.c index 918f8de..b814b47 100644 --- 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" diff --git a/yaffs_packedtags2.c b/yaffs_packedtags2.c index e0c5586..e33e8a3 100644 --- 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 diff --git a/yaffs_tagscompat.c b/yaffs_tagscompat.c index e3173cc..020eee5 100644 --- 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 diff --git a/yaffs_trace.h b/yaffs_trace.h new file mode 100644 index 0000000..5ddb977 --- /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 + * + * 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 diff --git a/yportenv.h b/yportenv.h index 1967cb1..e1f61f4 100644 --- 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) -- 2.30.2