jfs_debug.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  *   Copyright (c) International Business Machines Corp., 2000-2002
  3.  *   Portions Copyright (c) Christoph Hellwig, 2001-2002
  4.  *
  5.  *   This program is free software;  you can redistribute it and/or modify
  6.  *   it under the terms of the GNU General Public License as published by
  7.  *   the Free Software Foundation; either version 2 of the License, or
  8.  *   (at your option) any later version.
  9.  *
  10.  *   This program is distributed in the hope that it will be useful,
  11.  *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
  12.  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
  13.  *   the GNU General Public License for more details.
  14.  *
  15.  *   You should have received a copy of the GNU General Public License
  16.  *   along with this program;  if not, write to the Free Software
  17.  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18.  */
  19. #ifndef _H_JFS_DEBUG
  20. #define _H_JFS_DEBUG
  21. /*
  22.  * jfs_debug.h
  23.  *
  24.  * global debug message, data structure/macro definitions
  25.  * under control of CONFIG_JFS_DEBUG, CONFIG_JFS_STATISTICS;
  26.  */
  27. /*
  28.  * Create /proc/fs/jfs if procfs is enabled andeither
  29.  * CONFIG_JFS_DEBUG or CONFIG_JFS_STATISTICS is defined
  30.  */
  31. #if defined(CONFIG_PROC_FS) && (defined(CONFIG_JFS_DEBUG) || defined(CONFIG_JFS_STATISTICS))
  32. #define PROC_FS_JFS
  33. #endif
  34. /*
  35.  * assert with traditional printf/panic
  36.  */
  37. #ifdef CONFIG_KERNEL_ASSERTS
  38. /* kgdb stuff */
  39. #define assert(p) KERNEL_ASSERT(#p, p)
  40. #else
  41. #define assert(p) {
  42. if (!(p))
  43. {
  44. printk("assert(%s)n",#p);
  45. BUG();
  46. }
  47. }
  48. #endif
  49. /*
  50.  * debug ON
  51.  * --------
  52.  */
  53. #ifdef CONFIG_JFS_DEBUG
  54. #define ASSERT(p) assert(p)
  55. /* dump memory contents */
  56. extern void dump_mem(char *label, void *data, int length);
  57. extern int jfsloglevel;
  58. /* information message: e.g., configuration, major event */
  59. #define jFYI(button, prspec) 
  60. do { if (button && jfsloglevel > 1) printk prspec; } while (0)
  61. /* error event message: e.g., i/o error */
  62. extern int jfsERROR;
  63. #define jERROR(button, prspec) 
  64. do { if (button && jfsloglevel > 0) { printk prspec; } } while (0)
  65. /* debug event message: */
  66. #define jEVENT(button,prspec) 
  67. do { if (button) printk prspec; } while (0)
  68. /*
  69.  * debug OFF
  70.  * ---------
  71.  */
  72. #else /* CONFIG_JFS_DEBUG */
  73. #define dump_mem(label,data,length)
  74. #define ASSERT(p)
  75. #define jEVENT(button,prspec)
  76. #define jERROR(button,prspec)
  77. #define jFYI(button,prspec)
  78. #endif /* CONFIG_JFS_DEBUG */
  79. /*
  80.  * statistics
  81.  * ----------
  82.  */
  83. #ifdef CONFIG_JFS_STATISTICS
  84. #define INCREMENT(x) ((x)++)
  85. #define DECREMENT(x) ((x)--)
  86. #define HIGHWATERMARK(x,y) ((x) = max((x), (y)))
  87. #else
  88. #define INCREMENT(x)
  89. #define DECREMENT(x)
  90. #define HIGHWATERMARK(x,y)
  91. #endif /* CONFIG_JFS_STATISTICS */
  92. #endif /* _H_JFS_DEBUG */