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_cvirt;
30 #define VX_LOGLEVEL "vxD: "
31 #define VX_WARNLEVEL KERN_WARNING "vxW: "
33 #define vxdprintk(c,f,x...) \
36 printk(VX_LOGLEVEL f "\n" , ##x); \
39 #define vxlprintk(c,f,x...) \
42 printk(VX_LOGLEVEL f " @%s:%d\n", x); \
45 #define vxfprintk(c,f,x...) \
48 printk(VX_LOGLEVEL f " %s@%s:%d\n", x); \
52 #define vxwprintk(c,f,x...) \
55 printk(VX_WARNLEVEL f "\n" , ##x); \
59 #define vxd_path(d,m) \
60 ({ static char _buffer[PATH_MAX]; \
61 d_path((d), (m), _buffer, sizeof(_buffer)); })
63 #else /* CONFIG_VSERVER_DEBUG */
65 #define vx_debug_switch 0
66 #define vx_debug_xid 0
67 #define vx_debug_nid 0
68 #define vx_debug_net 0
69 #define vx_debug_limit 0
70 #define vx_debug_dlim 0
71 #define vx_debug_cvirt 0
73 #define vxdprintk(x...) do { } while (0)
74 #define vxlprintk(x...) do { } while (0)
75 #define vxfprintk(x...) do { } while (0)
76 #define vxwprintk(x...) do { } while (0)
78 #define vxd_path "<none>"
80 #endif /* CONFIG_VSERVER_DEBUG */
85 #ifdef CONFIG_VSERVER_HISTORY
88 extern unsigned volatile int vxh_active;
97 struct _vxhe_set_clr {
101 struct _vxhe_loc_lookup {
125 struct _vx_hist_entry {
129 struct _vxhe_vxi vxi;
131 struct _vxhe_set_clr sc;
132 struct _vxhe_loc_lookup ll;
136 struct _vx_hist_entry *vxh_advance(void *loc);
145 static inline void __vxh_copy_vxi(struct _vx_hist_entry *entry, struct vx_info *vxi)
147 entry->vxi.ptr = vxi;
149 entry->vxi.usecnt = atomic_read(&vxi->vx_usecnt);
150 entry->vxi.tasks = atomic_read(&vxi->vx_tasks);
151 entry->vxi.xid = vxi->vx_id;
155 static inline void vxh_throw_oops(void)
157 struct _vx_hist_entry *entry;
160 entry = vxh_advance(VXH_HERE());
161 entry->type = VXH_THROW_OOPS;
164 /* prevent further acquisition */
168 static inline void vxh_get_vx_info(struct vx_info *vxi)
170 struct _vx_hist_entry *entry;
173 entry = vxh_advance(VXH_HERE());
174 __vxh_copy_vxi(entry, vxi);
175 entry->type = VXH_GET_VX_INFO;
179 static inline void vxh_put_vx_info(struct vx_info *vxi)
181 struct _vx_hist_entry *entry;
184 entry = vxh_advance(VXH_HERE());
185 __vxh_copy_vxi(entry, vxi);
186 entry->type = VXH_PUT_VX_INFO;
190 static inline void vxh_init_vx_info(struct vx_info *vxi, void *data)
192 struct _vx_hist_entry *entry;
195 entry = vxh_advance(VXH_HERE());
196 __vxh_copy_vxi(entry, vxi);
197 entry->sc.data = data;
198 entry->type = VXH_INIT_VX_INFO;
202 static inline void vxh_set_vx_info(struct vx_info *vxi, void *data)
204 struct _vx_hist_entry *entry;
207 entry = vxh_advance(VXH_HERE());
208 __vxh_copy_vxi(entry, vxi);
209 entry->sc.data = data;
210 entry->type = VXH_SET_VX_INFO;
214 static inline void vxh_clr_vx_info(struct vx_info *vxi, void *data)
216 struct _vx_hist_entry *entry;
219 entry = vxh_advance(VXH_HERE());
220 __vxh_copy_vxi(entry, vxi);
221 entry->sc.data = data;
222 entry->type = VXH_CLR_VX_INFO;
226 static inline void vxh_claim_vx_info(struct vx_info *vxi, void *data)
228 struct _vx_hist_entry *entry;
231 entry = vxh_advance(VXH_HERE());
232 __vxh_copy_vxi(entry, vxi);
233 entry->sc.data = data;
234 entry->type = VXH_CLAIM_VX_INFO;
238 static inline void vxh_release_vx_info(struct vx_info *vxi, void *data)
240 struct _vx_hist_entry *entry;
243 entry = vxh_advance(VXH_HERE());
244 __vxh_copy_vxi(entry, vxi);
245 entry->sc.data = data;
246 entry->type = VXH_RELEASE_VX_INFO;
250 static inline void vxh_alloc_vx_info(struct vx_info *vxi)
252 struct _vx_hist_entry *entry;
255 entry = vxh_advance(VXH_HERE());
256 __vxh_copy_vxi(entry, vxi);
257 entry->type = VXH_ALLOC_VX_INFO;
261 static inline void vxh_dealloc_vx_info(struct vx_info *vxi)
263 struct _vx_hist_entry *entry;
266 entry = vxh_advance(VXH_HERE());
267 __vxh_copy_vxi(entry, vxi);
268 entry->type = VXH_DEALLOC_VX_INFO;
272 static inline void vxh_hash_vx_info(struct vx_info *vxi)
274 struct _vx_hist_entry *entry;
277 entry = vxh_advance(VXH_HERE());
278 __vxh_copy_vxi(entry, vxi);
279 entry->type = VXH_HASH_VX_INFO;
283 static inline void vxh_unhash_vx_info(struct vx_info *vxi)
285 struct _vx_hist_entry *entry;
288 entry = vxh_advance(VXH_HERE());
289 __vxh_copy_vxi(entry, vxi);
290 entry->type = VXH_UNHASH_VX_INFO;
294 static inline void vxh_loc_vx_info(unsigned arg, struct vx_info *vxi)
296 struct _vx_hist_entry *entry;
299 entry = vxh_advance(VXH_HERE());
300 __vxh_copy_vxi(entry, vxi);
302 entry->type = VXH_LOC_VX_INFO;
306 static inline void vxh_lookup_vx_info(unsigned arg, struct vx_info *vxi)
308 struct _vx_hist_entry *entry;
311 entry = vxh_advance(VXH_HERE());
312 __vxh_copy_vxi(entry, vxi);
314 entry->type = VXH_LOOKUP_VX_INFO;
318 static inline void vxh_create_vx_info(unsigned arg, struct vx_info *vxi)
320 struct _vx_hist_entry *entry;
323 entry = vxh_advance(VXH_HERE());
324 __vxh_copy_vxi(entry, vxi);
326 entry->type = VXH_CREATE_VX_INFO;
331 extern void vxh_dump_history(void);
333 #else /* CONFIG_VSERVER_HISTORY */
335 #define vxh_throw_oops() do { } while (0)
337 #define vxh_get_vx_info(v) do { } while (0)
338 #define vxh_put_vx_info(v) do { } while (0)
340 #define vxh_init_vx_info(v,d) do { } while (0)
341 #define vxh_set_vx_info(v,d) do { } while (0)
342 #define vxh_clr_vx_info(v,d) do { } while (0)
344 #define vxh_claim_vx_info(v,d) do { } while (0)
345 #define vxh_release_vx_info(v,d) do { } while (0)
347 #define vxh_alloc_vx_info(v) do { } while (0)
348 #define vxh_dealloc_vx_info(v) do { } while (0)
350 #define vxh_hash_vx_info(v) do { } while (0)
351 #define vxh_unhash_vx_info(v) do { } while (0)
353 #define vxh_loc_vx_info(a,v) do { } while (0)
354 #define vxh_lookup_vx_info(a,v) do { } while (0)
355 #define vxh_create_vx_info(a,v) do { } while (0)
357 #define vxh_dump_history() do { } while (0)
360 #endif /* CONFIG_VSERVER_HISTORY */
363 #ifdef CONFIG_VSERVER_DEBUG
364 #define vxd_assert_lock(l) assert_spin_locked(l)
366 #define vxd_assert_lock(l) do { } while (0)
370 #endif /* _VX_DEBUG_H */