Blame view

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

531b1094b   Latchesar Ionkov   [PATCH] v9fs: zer...
57
58
59
60
61
62
63
64
65
66
67
68
  	n = 0;
  	i = 0;
  	while (i < datalen) {
  		n += snprintf(buf+n, sizeof(buf)-n, "%02x", data[i++]);
  		if (i%4 == 0)
  			n += snprintf(buf+n, sizeof(buf)-n, " ");
  
  		if (i%16 == 0) {
  			dprintk(DEBUG_ERROR, "%s
  ", buf);
  			n = 0;
  		}
3ed8491c8   Eric Van Hensbergen   [PATCH] v9fs: deb...
69
  	}
531b1094b   Latchesar Ionkov   [PATCH] v9fs: zer...
70
71
72
  
  	dprintk(DEBUG_ERROR, "%s
  ", buf);
3ed8491c8   Eric Van Hensbergen   [PATCH] v9fs: deb...
73
74
75
76
77
78
79
  }
  #else				/* DEBUG_DUMP_PKT */
  static inline void dump_data(const unsigned char *data, unsigned int datalen)
  {
  
  }
  #endif				/* DEBUG_DUMP_PKT */