~ubuntu-branches/ubuntu/vivid/linux-ti-omap/vivid

« back to all changes in this revision

Viewing changes to ubuntu/aufs/debug.h

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Bader, Amit Kucheria
  • Date: 2010-03-23 18:05:12 UTC
  • Revision ID: james.westby@ubuntu.com-20100323180512-iavj906ocnphdubp
Tags: 2.6.33-500.3
[ Amit Kucheria ]

* [Config] Fix the debug package name to end in -dbgsym
* SAUCE: Add the ubuntu/ drivers to omap
* SAUCE: Re-export the symbols for aufs
* [Config] Enable AUFS and COMPCACHE

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2005-2009 Junjiro R. Okajima
 
3
 *
 
4
 * This program, aufs is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
17
 */
 
18
 
 
19
/*
 
20
 * debug print functions
 
21
 */
 
22
 
 
23
#ifndef __AUFS_DEBUG_H__
 
24
#define __AUFS_DEBUG_H__
 
25
 
 
26
#ifdef __KERNEL__
 
27
 
 
28
#include <asm/system.h>
 
29
#include <linux/bug.h>
 
30
/* #include <linux/err.h> */
 
31
#include <linux/init.h>
 
32
/* #include <linux/kernel.h> */
 
33
#include <linux/delay.h>
 
34
/* #include <linux/kd.h> */
 
35
/* #include <linux/vt_kern.h> */
 
36
#include <linux/sysrq.h>
 
37
#include <linux/aufs_type.h>
 
38
 
 
39
#include <asm/system.h>
 
40
 
 
41
#ifdef CONFIG_AUFS_DEBUG
 
42
#define AuDebugOn(a)            BUG_ON(a)
 
43
 
 
44
/* module parameter */
 
45
extern int aufs_debug;
 
46
static inline void au_debug(int n)
 
47
{
 
48
        aufs_debug = n;
 
49
        smp_mb();
 
50
}
 
51
 
 
52
static inline int au_debug_test(void)
 
53
{
 
54
        return aufs_debug;
 
55
}
 
56
#else
 
57
#define AuDebugOn(a)            do {} while (0)
 
58
#define au_debug()              do {} while (0)
 
59
static inline int au_debug_test(void)
 
60
{
 
61
        return 0;
 
62
}
 
63
#endif /* CONFIG_AUFS_DEBUG */
 
64
 
 
65
/* ---------------------------------------------------------------------- */
 
66
 
 
67
/* debug print */
 
68
 
 
69
#define AuDbg(fmt, ...) do { \
 
70
        if (au_debug_test()) \
 
71
                pr_debug("DEBUG: " fmt, ##__VA_ARGS__); \
 
72
} while (0)
 
73
#define AuLabel(l)              AuDbg(#l "\n")
 
74
#define AuIOErr(fmt, ...)       pr_err("I/O Error, " fmt, ##__VA_ARGS__)
 
75
#define AuWarn1(fmt, ...) do { \
 
76
        static unsigned char _c; \
 
77
        if (!_c++) \
 
78
                pr_warning(fmt, ##__VA_ARGS__); \
 
79
} while (0)
 
80
 
 
81
#define AuErr1(fmt, ...) do { \
 
82
        static unsigned char _c; \
 
83
        if (!_c++) \
 
84
                pr_err(fmt, ##__VA_ARGS__); \
 
85
} while (0)
 
86
 
 
87
#define AuIOErr1(fmt, ...) do { \
 
88
        static unsigned char _c; \
 
89
        if (!_c++) \
 
90
                AuIOErr(fmt, ##__VA_ARGS__); \
 
91
} while (0)
 
92
 
 
93
#define AuUnsupportMsg  "This operation is not supported." \
 
94
                        " Please report this application to aufs-users ML."
 
95
#define AuUnsupport(fmt, ...) do { \
 
96
        pr_err(AuUnsupportMsg "\n" fmt, ##__VA_ARGS__); \
 
97
        dump_stack(); \
 
98
} while (0)
 
99
 
 
100
#define AuTraceErr(e) do { \
 
101
        if (unlikely((e) < 0)) \
 
102
                AuDbg("err %d\n", (int)(e)); \
 
103
} while (0)
 
104
 
 
105
#define AuTraceErrPtr(p) do { \
 
106
        if (IS_ERR(p)) \
 
107
                AuDbg("err %ld\n", PTR_ERR(p)); \
 
108
} while (0)
 
109
 
 
110
/* dirty macros for debug print, use with "%.*s" and caution */
 
111
#define AuLNPair(qstr)          (qstr)->len, (qstr)->name
 
112
#define AuDLNPair(d)            AuLNPair(&(d)->d_name)
 
113
 
 
114
/* ---------------------------------------------------------------------- */
 
115
 
 
116
struct au_sbinfo;
 
117
struct au_finfo;
 
118
struct dentry;
 
119
#ifdef CONFIG_AUFS_DEBUG
 
120
extern char *au_plevel;
 
121
struct au_nhash;
 
122
void au_dpri_whlist(struct au_nhash *whlist);
 
123
struct au_vdir;
 
124
void au_dpri_vdir(struct au_vdir *vdir);
 
125
struct inode;
 
126
void au_dpri_inode(struct inode *inode);
 
127
void au_dpri_dentry(struct dentry *dentry);
 
128
struct file;
 
129
void au_dpri_file(struct file *filp);
 
130
struct super_block;
 
131
void au_dpri_sb(struct super_block *sb);
 
132
 
 
133
void au_dbg_sleep_jiffy(int jiffy);
 
134
struct iattr;
 
135
void au_dbg_iattr(struct iattr *ia);
 
136
 
 
137
void au_dbg_verify_dir_parent(struct dentry *dentry, unsigned int sigen);
 
138
void au_dbg_verify_nondir_parent(struct dentry *dentry, unsigned int sigen);
 
139
void au_dbg_verify_gen(struct dentry *parent, unsigned int sigen);
 
140
void au_dbg_verify_hf(struct au_finfo *finfo);
 
141
void au_dbg_verify_kthread(void);
 
142
 
 
143
int __init au_debug_init(void);
 
144
void au_debug_sbinfo_init(struct au_sbinfo *sbinfo);
 
145
#define AuDbgWhlist(w) do { \
 
146
        AuDbg(#w "\n"); \
 
147
        au_dpri_whlist(w); \
 
148
} while (0)
 
149
 
 
150
#define AuDbgVdir(v) do { \
 
151
        AuDbg(#v "\n"); \
 
152
        au_dpri_vdir(v); \
 
153
} while (0)
 
154
 
 
155
#define AuDbgInode(i) do { \
 
156
        AuDbg(#i "\n"); \
 
157
        au_dpri_inode(i); \
 
158
} while (0)
 
159
 
 
160
#define AuDbgDentry(d) do { \
 
161
        AuDbg(#d "\n"); \
 
162
        au_dpri_dentry(d); \
 
163
} while (0)
 
164
 
 
165
#define AuDbgFile(f) do { \
 
166
        AuDbg(#f "\n"); \
 
167
        au_dpri_file(f); \
 
168
} while (0)
 
169
 
 
170
#define AuDbgSb(sb) do { \
 
171
        AuDbg(#sb "\n"); \
 
172
        au_dpri_sb(sb); \
 
173
} while (0)
 
174
 
 
175
#define AuDbgSleep(sec) do { \
 
176
        AuDbg("sleep %d sec\n", sec); \
 
177
        ssleep(sec); \
 
178
} while (0)
 
179
 
 
180
#define AuDbgSleepJiffy(jiffy) do { \
 
181
        AuDbg("sleep %d jiffies\n", jiffy); \
 
182
        au_dbg_sleep_jiffy(jiffy); \
 
183
} while (0)
 
184
 
 
185
#define AuDbgIAttr(ia) do { \
 
186
        AuDbg("ia_valid 0x%x\n", (ia)->ia_valid); \
 
187
        au_dbg_iattr(ia); \
 
188
} while (0)
 
189
#else
 
190
static inline void au_dbg_verify_dir_parent(struct dentry *dentry,
 
191
                                            unsigned int sigen)
 
192
{
 
193
        /* empty */
 
194
}
 
195
static inline void au_dbg_verify_nondir_parent(struct dentry *dentry,
 
196
                                               unsigned int sigen)
 
197
{
 
198
        /* empty */
 
199
}
 
200
static inline void au_dbg_verify_gen(struct dentry *parent, unsigned int sigen)
 
201
{
 
202
        /* empty */
 
203
}
 
204
static inline void au_dbg_verify_hf(struct au_finfo *finfo)
 
205
{
 
206
        /* empty */
 
207
}
 
208
static inline void au_dbg_verify_kthread(void)
 
209
{
 
210
        /* empty */
 
211
}
 
212
 
 
213
static inline int au_debug_init(void)
 
214
{
 
215
        return 0;
 
216
}
 
217
static inline void au_debug_sbinfo_init(struct au_sbinfo *sbinfo)
 
218
{
 
219
        /* empty */
 
220
}
 
221
#define AuDbgWhlist(w)          do {} while (0)
 
222
#define AuDbgVdir(v)            do {} while (0)
 
223
#define AuDbgInode(i)           do {} while (0)
 
224
#define AuDbgDentry(d)          do {} while (0)
 
225
#define AuDbgFile(f)            do {} while (0)
 
226
#define AuDbgSb(sb)             do {} while (0)
 
227
#define AuDbgSleep(sec)         do {} while (0)
 
228
#define AuDbgSleepJiffy(jiffy)  do {} while (0)
 
229
#define AuDbgIAttr(ia)          do {} while (0)
 
230
#endif /* CONFIG_AUFS_DEBUG */
 
231
 
 
232
/* ---------------------------------------------------------------------- */
 
233
 
 
234
#ifdef CONFIG_AUFS_MAGIC_SYSRQ
 
235
int __init au_sysrq_init(void);
 
236
void au_sysrq_fin(void);
 
237
 
 
238
#ifdef CONFIG_HW_CONSOLE
 
239
#define au_dbg_blocked() do { \
 
240
        WARN_ON(1); \
 
241
        handle_sysrq('w', vc_cons[fg_console].d->vc_tty); \
 
242
} while (0)
 
243
#else
 
244
#define au_dbg_blocked()        do {} while (0)
 
245
#endif
 
246
 
 
247
#else
 
248
static inline int au_sysrq_init(void)
 
249
{
 
250
        return 0;
 
251
}
 
252
#define au_sysrq_fin()          do {} while (0)
 
253
#define au_dbg_blocked()        do {} while (0)
 
254
#endif /* CONFIG_AUFS_MAGIC_SYSRQ */
 
255
 
 
256
#endif /* __KERNEL__ */
 
257
#endif /* __AUFS_DEBUG_H__ */