5 #warning config options missing
8 #define VXD_CBIT(n,m) (vx_debug_ ## n & (1 << (m)))
9 #define VXD_CMIN(n,m) (vx_debug_ ## n > (m))
10 #define VXD_MASK(n,m) (vx_debug_ ## n & (m))
12 #define VXD_QPOS(v,p) (((uint32_t)(v) >> ((p)*8)) & 0xFF)
13 #define VXD_QUAD(v) VXD_QPOS(v,0), VXD_QPOS(v,1), \
14 VXD_QPOS(v,2), VXD_QPOS(v,3)
16 #define __FUNC__ __func__
19 #ifdef CONFIG_VSERVER_DEBUG
21 extern unsigned int vx_debug_switch;
22 extern unsigned int vx_debug_xid;
23 extern unsigned int vx_debug_nid;
24 extern unsigned int vx_debug_net;
25 extern unsigned int vx_debug_limit;
26 extern unsigned int vx_debug_dlim;
27 extern unsigned int vx_debug_quota;
28 extern unsigned int vx_debug_cvirt;
29 extern unsigned int vx_debug_misc;
32 #define VX_LOGLEVEL "vxD: "
33 #define VX_WARNLEVEL KERN_WARNING "vxW: "
35 #define vxdprintk(c,f,x...) \
38 printk(VX_LOGLEVEL f "\n" , ##x); \
41 #define vxlprintk(c,f,x...) \
44 printk(VX_LOGLEVEL f " @%s:%d\n", x); \
47 #define vxfprintk(c,f,x...) \
50 printk(VX_LOGLEVEL f " %s@%s:%d\n", x); \
54 #define vxwprintk(c,f,x...) \
57 printk(VX_WARNLEVEL f "\n" , ##x); \
61 #define vxd_path(d,m) \
62 ({ static char _buffer[PATH_MAX]; \
63 d_path((d), (m), _buffer, sizeof(_buffer)); })
66 void dump_vx_info(struct vx_info *, int);
67 void dump_vx_info_inactive(int);
69 #else /* CONFIG_VSERVER_DEBUG */
71 #define vx_debug_switch 0
72 #define vx_debug_xid 0
73 #define vx_debug_nid 0
74 #define vx_debug_net 0
75 #define vx_debug_limit 0
76 #define vx_debug_dlim 0
77 #define vx_debug_cvirt 0
79 #define vxdprintk(x...) do { } while (0)
80 #define vxlprintk(x...) do { } while (0)
81 #define vxfprintk(x...) do { } while (0)
82 #define vxwprintk(x...) do { } while (0)
84 #define vxd_path "<none>"
87 #endif /* CONFIG_VSERVER_DEBUG */
92 #ifdef CONFIG_VSERVER_HISTORY
95 extern unsigned volatile int vxh_active;
104 struct _vxhe_set_clr {
108 struct _vxhe_loc_lookup {
132 struct _vx_hist_entry {
136 struct _vxhe_vxi vxi;
138 struct _vxhe_set_clr sc;
139 struct _vxhe_loc_lookup ll;
143 struct _vx_hist_entry *vxh_advance(void *loc);
147 void __vxh_copy_vxi(struct _vx_hist_entry *entry, struct vx_info *vxi)
149 entry->vxi.ptr = vxi;
151 entry->vxi.usecnt = atomic_read(&vxi->vx_usecnt);
152 entry->vxi.tasks = atomic_read(&vxi->vx_tasks);
153 entry->vxi.xid = vxi->vx_id;
159 ({ __label__ __vxh_label; __vxh_label:; &&__vxh_label; })
161 #define __VXH_BODY(__type, __data, __here) \
162 struct _vx_hist_entry *entry; \
165 entry = vxh_advance(__here); \
167 entry->type = __type; \
174 __vxh_copy_vxi(entry, vxi)
177 void __vxh_smpl(struct vx_info *vxi, int __type, void *__here)
179 __VXH_BODY(__type, __VXH_SMPL, __here)
182 /* pass vxi and data (void *) */
185 __vxh_copy_vxi(entry, vxi); \
186 entry->sc.data = data
189 void __vxh_data(struct vx_info *vxi, void *data,
190 int __type, void *__here)
192 __VXH_BODY(__type, __VXH_DATA, __here)
195 /* pass vxi and arg (long) */
198 __vxh_copy_vxi(entry, vxi); \
202 void __vxh_long(struct vx_info *vxi, long arg,
203 int __type, void *__here)
205 __VXH_BODY(__type, __VXH_LONG, __here)
210 void __vxh_throw_oops(void *__here)
212 __VXH_BODY(VXH_THROW_OOPS, {}, __here);
213 /* prevent further acquisition */
218 #define vxh_throw_oops() __vxh_throw_oops(__HERE__);
220 #define __vxh_get_vx_info(v,h) __vxh_smpl(v, VXH_GET_VX_INFO, h);
221 #define __vxh_put_vx_info(v,h) __vxh_smpl(v, VXH_PUT_VX_INFO, h);
223 #define __vxh_init_vx_info(v,d,h) \
224 __vxh_data(v,d, VXH_INIT_VX_INFO, h);
225 #define __vxh_set_vx_info(v,d,h) \
226 __vxh_data(v,d, VXH_SET_VX_INFO, h);
227 #define __vxh_clr_vx_info(v,d,h) \
228 __vxh_data(v,d, VXH_CLR_VX_INFO, h);
230 #define __vxh_claim_vx_info(v,d,h) \
231 __vxh_data(v,d, VXH_CLAIM_VX_INFO, h);
232 #define __vxh_release_vx_info(v,d,h) \
233 __vxh_data(v,d, VXH_RELEASE_VX_INFO, h);
235 #define vxh_alloc_vx_info(v) \
236 __vxh_smpl(v, VXH_ALLOC_VX_INFO, __HERE__);
237 #define vxh_dealloc_vx_info(v) \
238 __vxh_smpl(v, VXH_DEALLOC_VX_INFO, __HERE__);
240 #define vxh_hash_vx_info(v) \
241 __vxh_smpl(v, VXH_HASH_VX_INFO, __HERE__);
242 #define vxh_unhash_vx_info(v) \
243 __vxh_smpl(v, VXH_UNHASH_VX_INFO, __HERE__);
245 #define vxh_loc_vx_info(v,l) \
246 __vxh_long(v,l, VXH_LOC_VX_INFO, __HERE__);
247 #define vxh_lookup_vx_info(v,l) \
248 __vxh_long(v,l, VXH_LOOKUP_VX_INFO, __HERE__);
249 #define vxh_create_vx_info(v,l) \
250 __vxh_long(v,l, VXH_CREATE_VX_INFO, __HERE__);
252 extern void vxh_dump_history(void);
255 #else /* CONFIG_VSERVER_HISTORY */
259 #define vxh_throw_oops() do { } while (0)
261 #define __vxh_get_vx_info(v,h) do { } while (0)
262 #define __vxh_put_vx_info(v,h) do { } while (0)
264 #define __vxh_init_vx_info(v,d,h) do { } while (0)
265 #define __vxh_set_vx_info(v,d,h) do { } while (0)
266 #define __vxh_clr_vx_info(v,d,h) do { } while (0)
268 #define __vxh_claim_vx_info(v,d,h) do { } while (0)
269 #define __vxh_release_vx_info(v,d,h) do { } while (0)
271 #define vxh_alloc_vx_info(v) do { } while (0)
272 #define vxh_dealloc_vx_info(v) do { } while (0)
274 #define vxh_hash_vx_info(v) do { } while (0)
275 #define vxh_unhash_vx_info(v) do { } while (0)
277 #define vxh_loc_vx_info(a,v) do { } while (0)
278 #define vxh_lookup_vx_info(a,v) do { } while (0)
279 #define vxh_create_vx_info(a,v) do { } while (0)
281 #define vxh_dump_history() do { } while (0)
284 #endif /* CONFIG_VSERVER_HISTORY */
287 #ifdef CONFIG_VSERVER_DEBUG
288 #define vxd_assert_lock(l) assert_spin_locked(l)
289 #define vxd_assert(c,f,x...) vxlprintk(!(c), \
290 "assertion [" f "] failed.", ##x, __FILE__, __LINE__)
292 #define vxd_assert_lock(l) do { } while (0)
293 #define vxd_assert(c,f,x...) do { } while (0)
297 #endif /* _VX_DEBUG_H */