5 #define VXD_CBIT(n,m) (vx_debug_ ## n & (1 << (m)))
6 #define VXD_CMIN(n,m) (vx_debug_ ## n > (m))
7 #define VXD_MASK(n,m) (vx_debug_ ## n & (m))
9 #define VXD_QPOS(v,p) (((uint32_t)(v) >> ((p)*8)) & 0xFF)
10 #define VXD_QUAD(v) VXD_QPOS(v,0), VXD_QPOS(v,1), \
11 VXD_QPOS(v,2), VXD_QPOS(v,3)
13 #define __FUNC__ __func__
16 #ifdef CONFIG_VSERVER_DEBUG
18 extern unsigned int vx_debug_switch;
19 extern unsigned int vx_debug_xid;
20 extern unsigned int vx_debug_nid;
21 extern unsigned int vx_debug_net;
22 extern unsigned int vx_debug_limit;
23 extern unsigned int vx_debug_dlim;
24 extern unsigned int vx_debug_cvirt;
27 #define VX_LOGLEVEL "vxD: "
28 #define VX_WARNLEVEL KERN_WARNING "vxW: "
30 #define vxdprintk(c,f,x...) \
33 printk(VX_LOGLEVEL f "\n" , ##x); \
36 #define vxlprintk(c,f,x...) \
39 printk(VX_LOGLEVEL f " @%s:%d\n", x); \
42 #define vxfprintk(c,f,x...) \
45 printk(VX_LOGLEVEL f " %s@%s:%d\n", x); \
49 #define vxwprintk(c,f,x...) \
52 printk(VX_WARNLEVEL f "\n" , ##x); \
56 #define vxd_path(d,m) \
57 ({ static char _buffer[PATH_MAX]; \
58 d_path((d), (m), _buffer, sizeof(_buffer)); })
60 #else /* CONFIG_VSERVER_DEBUG */
62 #define vx_debug_switch 0
63 #define vx_debug_xid 0
64 #define vx_debug_nid 0
65 #define vx_debug_net 0
66 #define vx_debug_limit 0
67 #define vx_debug_dlim 0
68 #define vx_debug_cvirt 0
70 #define vxdprintk(x...) do { } while (0)
71 #define vxlprintk(x...) do { } while (0)
72 #define vxfprintk(x...) do { } while (0)
73 #define vxwprintk(x...) do { } while (0)
75 #define vxd_path "<none>"
77 #endif /* CONFIG_VSERVER_DEBUG */
82 #ifdef CONFIG_VSERVER_HISTORY
85 extern unsigned volatile int vxh_active;
94 struct _vxhe_set_clr {
98 struct _vxhe_loc_lookup {
118 struct _vx_hist_entry {
122 struct _vxhe_vxi vxi;
124 struct _vxhe_set_clr sc;
125 struct _vxhe_loc_lookup ll;
129 struct _vx_hist_entry *vxh_advance(void *loc);
138 static inline void __vxh_copy_vxi(struct _vx_hist_entry *entry, struct vx_info *vxi)
140 entry->vxi.ptr = vxi;
142 entry->vxi.usecnt = atomic_read(&vxi->vx_usecnt);
143 entry->vxi.refcnt = atomic_read(&vxi->vx_refcnt);
144 entry->vxi.xid = vxi->vx_id;
148 static inline void vxh_throw_oops(void)
150 struct _vx_hist_entry *entry = vxh_advance(VXH_HERE());
152 entry->type = VXH_THROW_OOPS;
154 /* prevent further acquisition */
158 static inline void vxh_get_vx_info(struct vx_info *vxi)
160 struct _vx_hist_entry *entry = vxh_advance(VXH_HERE());
162 __vxh_copy_vxi(entry, vxi);
163 entry->type = VXH_GET_VX_INFO;
166 static inline void vxh_put_vx_info(struct vx_info *vxi)
168 struct _vx_hist_entry *entry = vxh_advance(VXH_HERE());
170 __vxh_copy_vxi(entry, vxi);
171 entry->type = VXH_PUT_VX_INFO;
174 static inline void vxh_set_vx_info(struct vx_info *vxi, void *data)
176 struct _vx_hist_entry *entry = vxh_advance(VXH_HERE());
178 __vxh_copy_vxi(entry, vxi);
179 entry->sc.data = data;
180 entry->type = VXH_SET_VX_INFO;
183 static inline void vxh_clr_vx_info(struct vx_info *vxi, void *data)
185 struct _vx_hist_entry *entry = vxh_advance(VXH_HERE());
187 __vxh_copy_vxi(entry, vxi);
188 entry->sc.data = data;
189 entry->type = VXH_CLR_VX_INFO;
192 static inline void vxh_alloc_vx_info(struct vx_info *vxi)
194 struct _vx_hist_entry *entry = vxh_advance(VXH_HERE());
196 __vxh_copy_vxi(entry, vxi);
197 entry->type = VXH_ALLOC_VX_INFO;
200 static inline void vxh_dealloc_vx_info(struct vx_info *vxi)
202 struct _vx_hist_entry *entry = vxh_advance(VXH_HERE());
204 __vxh_copy_vxi(entry, vxi);
205 entry->type = VXH_DEALLOC_VX_INFO;
208 static inline void vxh_hash_vx_info(struct vx_info *vxi)
210 struct _vx_hist_entry *entry = vxh_advance(VXH_HERE());
212 __vxh_copy_vxi(entry, vxi);
213 entry->type = VXH_HASH_VX_INFO;
216 static inline void vxh_unhash_vx_info(struct vx_info *vxi)
218 struct _vx_hist_entry *entry = vxh_advance(VXH_HERE());
220 __vxh_copy_vxi(entry, vxi);
221 entry->type = VXH_UNHASH_VX_INFO;
224 static inline void vxh_loc_vx_info(unsigned arg, struct vx_info *vxi)
226 struct _vx_hist_entry *entry = vxh_advance(VXH_HERE());
228 __vxh_copy_vxi(entry, vxi);
230 entry->type = VXH_LOC_VX_INFO;
233 static inline void vxh_lookup_vx_info(unsigned arg, struct vx_info *vxi)
235 struct _vx_hist_entry *entry = vxh_advance(VXH_HERE());
237 __vxh_copy_vxi(entry, vxi);
239 entry->type = VXH_LOOKUP_VX_INFO;
242 extern void vxh_dump_history(void);
244 #else /* CONFIG_VSERVER_HISTORY */
246 #define vxh_throw_oops() do { } while (0)
248 #define vxh_get_vx_info(v) do { } while (0)
249 #define vxh_put_vx_info(v) do { } while (0)
251 #define vxh_set_vx_info(v,d) do { } while (0)
252 #define vxh_clr_vx_info(v,d) do { } while (0)
254 #define vxh_alloc_vx_info(v) do { } while (0)
255 #define vxh_dealloc_vx_info(v) do { } while (0)
257 #define vxh_hash_vx_info(v) do { } while (0)
258 #define vxh_unhash_vx_info(v) do { } while (0)
260 #define vxh_loc_vx_info(a,v) do { } while (0)
261 #define vxh_lookup_vx_info(a,v) do { } while (0)
263 #define vxh_dump_history() do { } while (0)
266 #endif /* CONFIG_VSERVER_HISTORY */
268 #endif /* _VX_DEBUG_H */