debug.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * linux/fs/9p/debug.h - V9FS Debug Definitions
  3. *
  4. * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com>
  5. * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to:
  19. * Free Software Foundation
  20. * 51 Franklin Street, Fifth Floor
  21. * Boston, MA 02111-1301 USA
  22. *
  23. */
  24. #define DEBUG_ERROR (1<<0)
  25. #define DEBUG_CURRENT (1<<1)
  26. #define DEBUG_9P (1<<2)
  27. #define DEBUG_VFS (1<<3)
  28. #define DEBUG_CONV (1<<4)
  29. #define DEBUG_MUX (1<<5)
  30. #define DEBUG_TRANS (1<<6)
  31. #define DEBUG_SLABS (1<<7)
  32. #define DEBUG_DUMP_PKT 0
  33. extern int v9fs_debug_level;
  34. #define dprintk(level, format, arg...) \
  35. do { \
  36. if((v9fs_debug_level & level)==level) \
  37. printk(KERN_NOTICE "-- %s (%d): " \
  38. format , __FUNCTION__, current->pid , ## arg); \
  39. } while(0)
  40. #define eprintk(level, format, arg...) \
  41. do { \
  42. printk(level "v9fs: %s (%d): " \
  43. format , __FUNCTION__, current->pid , ## arg); \
  44. } while(0)
  45. #if DEBUG_DUMP_PKT
  46. static inline void dump_data(const unsigned char *data, unsigned int datalen)
  47. {
  48. int i, j;
  49. int len = datalen;
  50. printk(KERN_DEBUG "data ");
  51. for (i = 0; i < len; i += 4) {
  52. for (j = 0; (j < 4) && (i + j < len); j++)
  53. printk(KERN_DEBUG "%02x", data[i + j]);
  54. printk(KERN_DEBUG " ");
  55. }
  56. printk(KERN_DEBUG "\n");
  57. }
  58. #else /* DEBUG_DUMP_PKT */
  59. static inline void dump_data(const unsigned char *data, unsigned int datalen)
  60. {
  61. }
  62. #endif /* DEBUG_DUMP_PKT */