xref: /titanic_41/usr/src/uts/common/sys/tnf_probe.h (revision 7c2fbfb345896881c631598ee3852ce9ce33fb07)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  *	Copyright (c) 1994, by Sun Microsytems, Inc.
24  */
25 
26 #ifndef _SYS_TNF_PROBE_H
27 #define	_SYS_TNF_PROBE_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <sys/tnf_writer.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * These macros are used to convert the __LINE__ directive to a
39  * string in the probe macros below.
40  */
41 
42 #define	TNF_STRINGIFY(x) #x
43 #define	TNF_STRINGVALUE(x) TNF_STRINGIFY(x)
44 
45 /*
46  * Alignment of tnf_ref32_t
47  */
48 
49 struct _tnf_ref32_align {
50 	char		c;
51 	tnf_ref32_t	t;
52 };
53 #define	TNF_REF32_ALIGN		TNF_OFFSETOF(struct _tnf_ref32_align, t)
54 
55 /*
56  * Probe versioning
57  */
58 
59 struct tnf_probe_version {
60 	size_t	version_size;		/* sizeof(struct tnf_probe_version) */
61 	size_t	probe_control_size;	/* sizeof(tnf_probe_control_t) */
62 };
63 
64 extern struct tnf_probe_version __tnf_probe_version_1;
65 #pragma weak __tnf_probe_version_1
66 
67 /*
68  * Typedefs
69  */
70 
71 typedef struct tnf_probe_control tnf_probe_control_t;
72 typedef struct tnf_probe_setup tnf_probe_setup_t;
73 
74 /* returns pointer to buffer */
75 typedef void * (*tnf_probe_test_func_t)(void *,
76 					tnf_probe_control_t *,
77 					tnf_probe_setup_t *);
78 
79 /* returns buffer pointer */
80 typedef void * (*tnf_probe_alloc_func_t)(tnf_ops_t *,	/* tpd	*/
81 					tnf_probe_control_t *,
82 					tnf_probe_setup_t *);
83 
84 typedef void (*tnf_probe_func_t)(tnf_probe_setup_t *);
85 
86 /*
87  * Probe argument block
88  */
89 
90 struct tnf_probe_setup {
91 	tnf_ops_t		*tpd_p;
92 	void			*buffer_p;
93 	tnf_probe_control_t	*probe_p;
94 };
95 
96 /*
97  * Probe control block
98  */
99 
100 struct tnf_probe_control {
101 	const struct tnf_probe_version	*version;
102 	tnf_probe_control_t	*next;
103 	tnf_probe_test_func_t	test_func;
104 	tnf_probe_alloc_func_t	alloc_func;
105 	tnf_probe_func_t	probe_func;
106 	tnf_probe_func_t	commit_func;
107 	uintptr_t		index;
108 	const char		*attrs;
109 	tnf_tag_data_t		***slot_types;
110 	unsigned long		tnf_event_size;
111 };
112 
113 #ifdef _KERNEL
114 
115 #define	TNF_NEXT_INIT	0
116 
117 #else
118 
119 #define	TNF_NEXT_INIT	-1
120 
121 #endif	/* _KERNEL */
122 
123 /*
124  * TNF Type extension
125  */
126 
127 #ifdef NPROBE
128 
129 #define	TNF_DECLARE_RECORD(ctype, record)				\
130 	typedef tnf_reference_t record##_t
131 
132 #else
133 
134 #define	TNF_DECLARE_RECORD(ctype, record)				\
135 	typedef tnf_reference_t record##_t;				\
136 	extern tnf_tag_data_t *record##_tag_data;			\
137 	extern record##_t record(tnf_ops_t *, ctype *, tnf_record_p)
138 
139 #endif	/* NPROBE */
140 
141 #ifdef NPROBE
142 
143 /* CSTYLED */
144 #define	TNF_DEFINE_RECORD_1(ctype, ctype_record, t1, n1)
145 
146 #else
147 
148 /* CSTYLED */
149 #define	TNF_DEFINE_RECORD_1(ctype, ctype_record, t1, n1) \
150 typedef struct {						\
151 	tnf_tag_t	tag;					\
152 	t1##_t		data_1;				\
153 } ctype_record##_prototype_t;					\
154 static tnf_tag_data_t **ctype_record##_type_slots[] = {		\
155 	&tnf_tag_tag_data,					\
156 	&t1##_tag_data,					\
157 	0 };							\
158 static char *ctype_record##_slot_names[] = {			\
159 	"tnf_tag",						\
160 	""#n1,						\
161 	0 };							\
162 static tnf_tag_data_t ctype_record##_tag_data_rec = {		\
163 	TNF_TAG_VERSION, &tnf_struct_tag_1,			\
164 	0, #ctype_record, &tnf_user_struct_properties,		\
165 	sizeof (ctype_record##_prototype_t),			\
166 	TNF_REF32_ALIGN,					\
167 	sizeof (ctype_record##_t), TNF_STRUCT, 0,		\
168 	ctype_record##_type_slots, ctype_record##_slot_names	\
169 };								\
170 tnf_tag_data_t *ctype_record##_tag_data =			\
171 			&ctype_record##_tag_data_rec;		\
172 ctype_record##_t						\
173 ctype_record(tnf_ops_t *ops, ctype * the_ctype,			\
174 				tnf_record_p reference)	\
175 {								\
176 	tnf_tag_data_t			*metatag_data;		\
177 	tnf_record_p			metatag_index;		\
178 	ctype_record##_prototype_t	*buffer;		\
179 								\
180 	if (the_ctype == NULL)					\
181 		return (0);					\
182 	buffer = (ctype_record##_prototype_t *) tnf_allocate(ops, \
183 			sizeof (ctype_record##_prototype_t));	\
184 	if (buffer == NULL)					\
185 		return (0);					\
186 								\
187 	metatag_data = ctype_record##_tag_data;			\
188 	metatag_index = metatag_data->tag_index ?		\
189 		metatag_data->tag_index:			\
190 		metatag_data->tag_desc(ops, metatag_data);	\
191 	buffer->tag = tnf_tag(ops, metatag_index,		\
192 		(tnf_record_p) &buffer->tag);		\
193 	buffer->data_1 = t1(ops, the_ctype->n1,		\
194 			(tnf_record_p) &(buffer->data_1));	\
195 	return (tnf_ref32(ops, (tnf_record_p) buffer, reference)); \
196 }
197 
198 #endif /* NPROBE */
199 
200 #ifdef NPROBE
201 
202 /* CSTYLED */
203 #define	TNF_DEFINE_RECORD_2(ctype, ctype_record, t1, n1, t2, n2)
204 
205 #else
206 
207 /* CSTYLED */
208 #define	TNF_DEFINE_RECORD_2(ctype, ctype_record, t1, n1, t2, n2) \
209 typedef struct {						\
210 	tnf_tag_t	tag;					\
211 	t1##_t		data_1;				\
212 	t2##_t		data_2;				\
213 } ctype_record##_prototype_t;					\
214 static tnf_tag_data_t **ctype_record##_type_slots[] = {		\
215 	&tnf_tag_tag_data,					\
216 	&t1##_tag_data,					\
217 	&t2##_tag_data,					\
218 	0 };							\
219 static char *ctype_record##_slot_names[] = {			\
220 	"tnf_tag",						\
221 	""#n1,						\
222 	""#n2,						\
223 	0 };							\
224 static tnf_tag_data_t ctype_record##_tag_data_rec = {		\
225 	TNF_TAG_VERSION, &tnf_struct_tag_1,			\
226 	0, #ctype_record, &tnf_user_struct_properties,		\
227 	sizeof (ctype_record##_prototype_t),			\
228 	TNF_REF32_ALIGN,					\
229 	sizeof (ctype_record##_t), TNF_STRUCT, 0,		\
230 	ctype_record##_type_slots, ctype_record##_slot_names	\
231 };								\
232 tnf_tag_data_t *ctype_record##_tag_data =			\
233 			&ctype_record##_tag_data_rec;		\
234 ctype_record##_t						\
235 ctype_record(tnf_ops_t *ops, ctype * the_ctype,			\
236 				tnf_record_p reference)	\
237 {								\
238 	tnf_tag_data_t			*metatag_data;		\
239 	tnf_record_p			metatag_index;		\
240 	ctype_record##_prototype_t	*buffer;		\
241 								\
242 	if (the_ctype == NULL)					\
243 		return (0);					\
244 	buffer = (ctype_record##_prototype_t *) tnf_allocate(ops, \
245 			sizeof (ctype_record##_prototype_t));	\
246 	if (buffer == NULL)					\
247 		return (0);					\
248 								\
249 	metatag_data = ctype_record##_tag_data;			\
250 	metatag_index = metatag_data->tag_index ?		\
251 		metatag_data->tag_index:			\
252 		metatag_data->tag_desc(ops, metatag_data);	\
253 	buffer->tag = tnf_tag(ops, metatag_index,		\
254 		(tnf_record_p) &buffer->tag);		\
255 	buffer->data_1 = t1(ops, the_ctype->n1,		\
256 			(tnf_record_p) &(buffer->data_1));	\
257 	buffer->data_2 = t2(ops, the_ctype->n2,		\
258 			(tnf_record_p) &(buffer->data_2));	\
259 	return (tnf_ref32(ops, (tnf_record_p) buffer, reference)); \
260 }
261 
262 #endif /* NPROBE */
263 
264 #ifdef NPROBE
265 
266 /* CSTYLED */
267 #define	TNF_DEFINE_RECORD_3(ctype, ctype_record, t1, n1, t2, n2, t3, n3)
268 
269 #else
270 
271 /* CSTYLED */
272 #define	TNF_DEFINE_RECORD_3(ctype, ctype_record, t1, n1, t2, n2, t3, n3) \
273 typedef struct {						\
274 	tnf_tag_t	tag;					\
275 	t1##_t		data_1;				\
276 	t2##_t		data_2;				\
277 	t3##_t		data_3;				\
278 } ctype_record##_prototype_t;					\
279 static tnf_tag_data_t **ctype_record##_type_slots[] = {		\
280 	&tnf_tag_tag_data,					\
281 	&t1##_tag_data,					\
282 	&t2##_tag_data,					\
283 	&t3##_tag_data,					\
284 	0 };							\
285 static char *ctype_record##_slot_names[] = {			\
286 	"tnf_tag",						\
287 	""#n1,						\
288 	""#n2,						\
289 	""#n3,						\
290 	0 };							\
291 static tnf_tag_data_t ctype_record##_tag_data_rec = {		\
292 	TNF_TAG_VERSION, &tnf_struct_tag_1,			\
293 	0, #ctype_record, &tnf_user_struct_properties,		\
294 	sizeof (ctype_record##_prototype_t),			\
295 	TNF_REF32_ALIGN,					\
296 	sizeof (ctype_record##_t), TNF_STRUCT, 0,		\
297 	ctype_record##_type_slots, ctype_record##_slot_names	\
298 };								\
299 tnf_tag_data_t *ctype_record##_tag_data =			\
300 			&ctype_record##_tag_data_rec;		\
301 ctype_record##_t						\
302 ctype_record(tnf_ops_t *ops, ctype * the_ctype,			\
303 				tnf_record_p reference)	\
304 {								\
305 	tnf_tag_data_t			*metatag_data;		\
306 	tnf_record_p			metatag_index;		\
307 	ctype_record##_prototype_t	*buffer;		\
308 								\
309 	if (the_ctype == NULL)					\
310 		return (0);					\
311 	buffer = (ctype_record##_prototype_t *) tnf_allocate(ops, \
312 			sizeof (ctype_record##_prototype_t));	\
313 	if (buffer == NULL)					\
314 		return (0);					\
315 								\
316 	metatag_data = ctype_record##_tag_data;			\
317 	metatag_index = metatag_data->tag_index ?		\
318 		metatag_data->tag_index:			\
319 		metatag_data->tag_desc(ops, metatag_data);	\
320 	buffer->tag = tnf_tag(ops, metatag_index,		\
321 		(tnf_record_p) &buffer->tag);		\
322 	buffer->data_1 = t1(ops, the_ctype->n1,		\
323 			(tnf_record_p) &(buffer->data_1));	\
324 	buffer->data_2 = t2(ops, the_ctype->n2,		\
325 			(tnf_record_p) &(buffer->data_2));	\
326 	buffer->data_3 = t3(ops, the_ctype->n3,		\
327 			(tnf_record_p) &(buffer->data_3));	\
328 	return (tnf_ref32(ops, (tnf_record_p) buffer, reference)); \
329 }
330 
331 #endif /* NPROBE */
332 
333 #ifdef NPROBE
334 
335 /* CSTYLED */
336 #define	TNF_DEFINE_RECORD_4(ctype, ctype_record, t1, n1, t2, n2, t3, n3, t4, n4)
337 
338 #else
339 
340 /* CSTYLED */
341 #define	TNF_DEFINE_RECORD_4(ctype, ctype_record, t1, n1, t2, n2, t3, n3, t4, n4) \
342 typedef struct {						\
343 	tnf_tag_t	tag;					\
344 	t1##_t		data_1;				\
345 	t2##_t		data_2;				\
346 	t3##_t		data_3;				\
347 	t4##_t		data_4;				\
348 } ctype_record##_prototype_t;					\
349 static tnf_tag_data_t **ctype_record##_type_slots[] = {		\
350 	&tnf_tag_tag_data,					\
351 	&t1##_tag_data,					\
352 	&t2##_tag_data,					\
353 	&t3##_tag_data,					\
354 	&t4##_tag_data,					\
355 	0 };							\
356 static char *ctype_record##_slot_names[] = {			\
357 	"tnf_tag",						\
358 	""#n1,						\
359 	""#n2,						\
360 	""#n3,						\
361 	""#n4,						\
362 	0 };							\
363 static tnf_tag_data_t ctype_record##_tag_data_rec = {		\
364 	TNF_TAG_VERSION, &tnf_struct_tag_1,			\
365 	0, #ctype_record, &tnf_user_struct_properties,		\
366 	sizeof (ctype_record##_prototype_t),			\
367 	TNF_REF32_ALIGN,					\
368 	sizeof (ctype_record##_t), TNF_STRUCT, 0,		\
369 	ctype_record##_type_slots, ctype_record##_slot_names	\
370 };								\
371 tnf_tag_data_t *ctype_record##_tag_data =			\
372 			&ctype_record##_tag_data_rec;		\
373 ctype_record##_t						\
374 ctype_record(tnf_ops_t *ops, ctype * the_ctype,			\
375 				tnf_record_p reference)	\
376 {								\
377 	tnf_tag_data_t			*metatag_data;		\
378 	tnf_record_p			metatag_index;		\
379 	ctype_record##_prototype_t	*buffer;		\
380 								\
381 	if (the_ctype == NULL)					\
382 		return (0);					\
383 	buffer = (ctype_record##_prototype_t *) tnf_allocate(ops, \
384 			sizeof (ctype_record##_prototype_t));	\
385 	if (buffer == NULL)					\
386 		return (0);					\
387 								\
388 	metatag_data = ctype_record##_tag_data;			\
389 	metatag_index = metatag_data->tag_index ?		\
390 		metatag_data->tag_index:			\
391 		metatag_data->tag_desc(ops, metatag_data);	\
392 	buffer->tag = tnf_tag(ops, metatag_index,		\
393 		(tnf_record_p) &buffer->tag);		\
394 	buffer->data_1 = t1(ops, the_ctype->n1,		\
395 			(tnf_record_p) &(buffer->data_1));	\
396 	buffer->data_2 = t2(ops, the_ctype->n2,		\
397 			(tnf_record_p) &(buffer->data_2));	\
398 	buffer->data_3 = t3(ops, the_ctype->n3,		\
399 			(tnf_record_p) &(buffer->data_3));	\
400 	buffer->data_4 = t4(ops, the_ctype->n4,		\
401 			(tnf_record_p) &(buffer->data_4));	\
402 	return (tnf_ref32(ops, (tnf_record_p) buffer, reference)); \
403 }
404 
405 #endif /* NPROBE */
406 
407 #ifdef NPROBE
408 
409 /* CSTYLED */
410 #define	TNF_DEFINE_RECORD_5(ctype, ctype_record, t1, n1, t2, n2, t3, n3, t4, n4, t5, n5)
411 
412 #else
413 
414 /* CSTYLED */
415 #define	TNF_DEFINE_RECORD_5(ctype, ctype_record, t1, n1, t2, n2, t3, n3, t4, n4, t5, n5) \
416 typedef struct {						\
417 	tnf_tag_t	tag;					\
418 	t1##_t		data_1;				\
419 	t2##_t		data_2;				\
420 	t3##_t		data_3;				\
421 	t4##_t		data_4;				\
422 	t5##_t		data_5;				\
423 } ctype_record##_prototype_t;					\
424 static tnf_tag_data_t **ctype_record##_type_slots[] = {		\
425 	&tnf_tag_tag_data,					\
426 	&t1##_tag_data,					\
427 	&t2##_tag_data,					\
428 	&t3##_tag_data,					\
429 	&t4##_tag_data,					\
430 	&t5##_tag_data,					\
431 	0 };							\
432 static char *ctype_record##_slot_names[] = {			\
433 	"tnf_tag",						\
434 	""#n1,						\
435 	""#n2,						\
436 	""#n3,						\
437 	""#n4,						\
438 	""#n5,						\
439 	0 };							\
440 static tnf_tag_data_t ctype_record##_tag_data_rec = {		\
441 	TNF_TAG_VERSION, &tnf_struct_tag_1,			\
442 	0, #ctype_record, &tnf_user_struct_properties,		\
443 	sizeof (ctype_record##_prototype_t),			\
444 	TNF_REF32_ALIGN,					\
445 	sizeof (ctype_record##_t), TNF_STRUCT, 0,		\
446 	ctype_record##_type_slots, ctype_record##_slot_names	\
447 };								\
448 tnf_tag_data_t *ctype_record##_tag_data =			\
449 			&ctype_record##_tag_data_rec;		\
450 ctype_record##_t						\
451 ctype_record(tnf_ops_t *ops, ctype * the_ctype,			\
452 				tnf_record_p reference)	\
453 {								\
454 	tnf_tag_data_t			*metatag_data;		\
455 	tnf_record_p			metatag_index;		\
456 	ctype_record##_prototype_t	*buffer;		\
457 								\
458 	if (the_ctype == NULL)					\
459 		return (0);					\
460 	buffer = (ctype_record##_prototype_t *) tnf_allocate(ops, \
461 			sizeof (ctype_record##_prototype_t));	\
462 	if (buffer == NULL)					\
463 		return (0);					\
464 								\
465 	metatag_data = ctype_record##_tag_data;			\
466 	metatag_index = metatag_data->tag_index ?		\
467 		metatag_data->tag_index:			\
468 		metatag_data->tag_desc(ops, metatag_data);	\
469 	buffer->tag = tnf_tag(ops, metatag_index,		\
470 		(tnf_record_p) &buffer->tag);		\
471 	buffer->data_1 = t1(ops, the_ctype->n1,		\
472 			(tnf_record_p) &(buffer->data_1));	\
473 	buffer->data_2 = t2(ops, the_ctype->n2,		\
474 			(tnf_record_p) &(buffer->data_2));	\
475 	buffer->data_3 = t3(ops, the_ctype->n3,		\
476 			(tnf_record_p) &(buffer->data_3));	\
477 	buffer->data_4 = t4(ops, the_ctype->n4,		\
478 			(tnf_record_p) &(buffer->data_4));	\
479 	buffer->data_5 = t5(ops, the_ctype->n5,		\
480 			(tnf_record_p) &(buffer->data_5));	\
481 	return (tnf_ref32(ops, (tnf_record_p) buffer, reference)); \
482 }
483 
484 #endif /* NPROBE */
485 
486 /*
487  * Probe Macros
488  */
489 
490 #ifdef NPROBE
491 
492 /* CSTYLED */
493 #define	TNF_PROBE_0(namearg, keysarg, detail) \
494 		((void)0)
495 
496 #else
497 
498 /* CSTYLED */
499 #define	TNF_PROBE_0(namearg, keysarg, detail)	\
500 {								\
501 	struct tnf_v_buf_0 {					\
502 		tnf_probe_event_t	probe_event;		\
503 		tnf_time_delta_t	time_delta;		\
504 	};							\
505 	static tnf_tag_data_t ** tnf_v_##namearg##_info[] = {		\
506 		&tnf_probe_event_tag_data,			\
507 		&tnf_time_delta_tag_data,			\
508 		0 };						\
509 	static struct tnf_probe_control tnf_v_##namearg##_probe = {	\
510 		&__tnf_probe_version_1,				\
511 		(tnf_probe_control_t *) TNF_NEXT_INIT,		\
512 		(tnf_probe_test_func_t) 0,			\
513 		(tnf_probe_alloc_func_t) 0,			\
514 		(tnf_probe_func_t) 0,				\
515 		(tnf_probe_func_t) 0,				\
516 		(tnf_uint32_t) 0,				\
517 			/* attribute string */			\
518 			"name " TNF_STRINGVALUE(namearg) ";" \
519 			"slots "				\
520 			";"					\
521 			"keys " keysarg ";"			\
522 			"file " __FILE__ ";"		\
523 			"line " TNF_STRINGVALUE(__LINE__) ";" \
524 			detail,					\
525 		tnf_v_##namearg##_info,					\
526 		sizeof (struct tnf_v_buf_0)			\
527 	};							\
528 	tnf_probe_control_t	*tnf_v_probe_p = &tnf_v_##namearg##_probe; \
529 	tnf_probe_test_func_t	tnf_v_probe_test = tnf_v_probe_p->test_func; \
530 	tnf_probe_setup_t	tnf_v_set_p;			\
531 	struct tnf_v_buf_0	*tnf_v_probe_buffer;		\
532 								\
533 	if (tnf_v_probe_test) {					\
534 		tnf_v_probe_buffer = (struct tnf_v_buf_0 *)	\
535 		    tnf_v_probe_test(0, tnf_v_probe_p, &tnf_v_set_p); \
536 		if (tnf_v_probe_buffer) {			\
537 		    (tnf_v_probe_p->probe_func)(&tnf_v_set_p);	\
538 		}						\
539 	}							\
540 }
541 
542 #endif /* NPROBE */
543 
544 #ifdef NPROBE
545 
546 /* CSTYLED */
547 #define	TNF_PROBE_1(namearg, keysarg, detail, type_1, namearg_1, valarg_1) \
548 		((void)0)
549 
550 #else
551 
552 /* CSTYLED */
553 #define	TNF_PROBE_1(namearg, keysarg, detail, type_1, namearg_1, valarg_1)	\
554 {								\
555 	struct tnf_v_buf_1 {					\
556 		tnf_probe_event_t	probe_event;		\
557 		tnf_time_delta_t	time_delta;		\
558 		type_1##_t		data_1;		\
559 	};							\
560 	static tnf_tag_data_t ** tnf_v_##namearg##_info[] = {		\
561 		&tnf_probe_event_tag_data,			\
562 		&tnf_time_delta_tag_data,			\
563 		&type_1##_tag_data,				\
564 		0 };						\
565 	static struct tnf_probe_control tnf_v_##namearg##_probe = {	\
566 		&__tnf_probe_version_1,				\
567 		(tnf_probe_control_t *) TNF_NEXT_INIT,		\
568 		(tnf_probe_test_func_t) 0,			\
569 		(tnf_probe_alloc_func_t) 0,			\
570 		(tnf_probe_func_t) 0,				\
571 		(tnf_probe_func_t) 0,				\
572 		(tnf_uint32_t) 0,				\
573 			/* attribute string */			\
574 			"name " TNF_STRINGVALUE(namearg) ";" \
575 			"slots "				\
576 			""#namearg_1" "			\
577 			";"					\
578 			"keys " keysarg ";"			\
579 			"file " __FILE__ ";"		\
580 			"line " TNF_STRINGVALUE(__LINE__) ";" \
581 			detail,					\
582 		tnf_v_##namearg##_info,					\
583 		sizeof (struct tnf_v_buf_1)			\
584 	};							\
585 	tnf_probe_control_t	*tnf_v_probe_p = &tnf_v_##namearg##_probe; \
586 	tnf_probe_test_func_t	tnf_v_probe_test = tnf_v_probe_p->test_func; \
587 	tnf_probe_setup_t	tnf_v_set_p;			\
588 	struct tnf_v_buf_1	*tnf_v_probe_buffer;		\
589 								\
590 	if (tnf_v_probe_test) {					\
591 		tnf_v_probe_buffer = (struct tnf_v_buf_1 *)	\
592 		    tnf_v_probe_test(0, tnf_v_probe_p, &tnf_v_set_p); \
593 		if (tnf_v_probe_buffer) {			\
594 		    tnf_v_probe_buffer->data_1 = type_1(	\
595 			tnf_v_set_p.tpd_p, valarg_1,		\
596 			(tnf_record_p) &(tnf_v_probe_buffer->data_1)); \
597 		    (tnf_v_probe_p->probe_func)(&tnf_v_set_p);	\
598 		}						\
599 	}							\
600 }
601 
602 #endif /* NPROBE */
603 
604 #ifdef NPROBE
605 
606 /* CSTYLED */
607 #define	TNF_PROBE_2(namearg, keysarg, detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2) \
608 		((void)0)
609 
610 #else
611 
612 /* CSTYLED */
613 #define	TNF_PROBE_2(namearg, keysarg, detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2)	\
614 {								\
615 	struct tnf_v_buf_2 {					\
616 		tnf_probe_event_t	probe_event;		\
617 		tnf_time_delta_t	time_delta;		\
618 		type_1##_t		data_1;		\
619 		type_2##_t		data_2;		\
620 	};							\
621 	static tnf_tag_data_t ** tnf_v_##namearg##_info[] = {		\
622 		&tnf_probe_event_tag_data,			\
623 		&tnf_time_delta_tag_data,			\
624 		&type_1##_tag_data,				\
625 		&type_2##_tag_data,				\
626 		0 };						\
627 	static struct tnf_probe_control tnf_v_##namearg##_probe = {	\
628 		&__tnf_probe_version_1,				\
629 		(tnf_probe_control_t *) TNF_NEXT_INIT,		\
630 		(tnf_probe_test_func_t) 0,			\
631 		(tnf_probe_alloc_func_t) 0,			\
632 		(tnf_probe_func_t) 0,				\
633 		(tnf_probe_func_t) 0,				\
634 		(tnf_uint32_t) 0,				\
635 			/* attribute string */			\
636 			"name " TNF_STRINGVALUE(namearg) ";" \
637 			"slots "				\
638 			""#namearg_1" "			\
639 			""#namearg_2" "			\
640 			";"					\
641 			"keys " keysarg ";"			\
642 			"file " __FILE__ ";"		\
643 			"line " TNF_STRINGVALUE(__LINE__) ";" \
644 			detail,					\
645 		tnf_v_##namearg##_info,					\
646 		sizeof (struct tnf_v_buf_2)			\
647 	};							\
648 	tnf_probe_control_t	*tnf_v_probe_p = &tnf_v_##namearg##_probe; \
649 	tnf_probe_test_func_t	tnf_v_probe_test = tnf_v_probe_p->test_func; \
650 	tnf_probe_setup_t	tnf_v_set_p;			\
651 	struct tnf_v_buf_2	*tnf_v_probe_buffer;		\
652 								\
653 	if (tnf_v_probe_test) {					\
654 		tnf_v_probe_buffer = (struct tnf_v_buf_2 *)	\
655 		    tnf_v_probe_test(0, tnf_v_probe_p, &tnf_v_set_p); \
656 		if (tnf_v_probe_buffer) {			\
657 		    tnf_v_probe_buffer->data_1 = type_1(	\
658 			tnf_v_set_p.tpd_p, valarg_1,		\
659 			(tnf_record_p) &(tnf_v_probe_buffer->data_1)); \
660 		    tnf_v_probe_buffer->data_2 = type_2(	\
661 			tnf_v_set_p.tpd_p, valarg_2,		\
662 			(tnf_record_p) &(tnf_v_probe_buffer->data_2)); \
663 		    (tnf_v_probe_p->probe_func)(&tnf_v_set_p);	\
664 		}						\
665 	}							\
666 }
667 
668 #endif /* NPROBE */
669 
670 #ifdef NPROBE
671 
672 /* CSTYLED */
673 #define	TNF_PROBE_3(namearg, keysarg, detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2, type_3, namearg_3, valarg_3) \
674 		((void)0)
675 
676 #else
677 
678 /* CSTYLED */
679 #define	TNF_PROBE_3(namearg, keysarg, detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2, type_3, namearg_3, valarg_3)	\
680 {								\
681 	struct tnf_v_buf_3 {					\
682 		tnf_probe_event_t	probe_event;		\
683 		tnf_time_delta_t	time_delta;		\
684 		type_1##_t		data_1;		\
685 		type_2##_t		data_2;		\
686 		type_3##_t		data_3;		\
687 	};							\
688 	static tnf_tag_data_t ** tnf_v_##namearg##_info[] = {		\
689 		&tnf_probe_event_tag_data,			\
690 		&tnf_time_delta_tag_data,			\
691 		&type_1##_tag_data,				\
692 		&type_2##_tag_data,				\
693 		&type_3##_tag_data,				\
694 		0 };						\
695 	static struct tnf_probe_control tnf_v_##namearg##_probe = {	\
696 		&__tnf_probe_version_1,				\
697 		(tnf_probe_control_t *) TNF_NEXT_INIT,		\
698 		(tnf_probe_test_func_t) 0,			\
699 		(tnf_probe_alloc_func_t) 0,			\
700 		(tnf_probe_func_t) 0,				\
701 		(tnf_probe_func_t) 0,				\
702 		(tnf_uint32_t) 0,				\
703 			/* attribute string */			\
704 			"name " TNF_STRINGVALUE(namearg) ";" \
705 			"slots "				\
706 			""#namearg_1" "			\
707 			""#namearg_2" "			\
708 			""#namearg_3" "			\
709 			";"					\
710 			"keys " keysarg ";"			\
711 			"file " __FILE__ ";"		\
712 			"line " TNF_STRINGVALUE(__LINE__) ";" \
713 			detail,					\
714 		tnf_v_##namearg##_info,					\
715 		sizeof (struct tnf_v_buf_3)			\
716 	};							\
717 	tnf_probe_control_t	*tnf_v_probe_p = &tnf_v_##namearg##_probe; \
718 	tnf_probe_test_func_t	tnf_v_probe_test = tnf_v_probe_p->test_func; \
719 	tnf_probe_setup_t	tnf_v_set_p;			\
720 	struct tnf_v_buf_3	*tnf_v_probe_buffer;		\
721 								\
722 	if (tnf_v_probe_test) {					\
723 		tnf_v_probe_buffer = (struct tnf_v_buf_3 *)	\
724 		    tnf_v_probe_test(0, tnf_v_probe_p, &tnf_v_set_p); \
725 		if (tnf_v_probe_buffer) {			\
726 		    tnf_v_probe_buffer->data_1 = type_1(	\
727 			tnf_v_set_p.tpd_p, valarg_1,		\
728 			(tnf_record_p) &(tnf_v_probe_buffer->data_1)); \
729 		    tnf_v_probe_buffer->data_2 = type_2(	\
730 			tnf_v_set_p.tpd_p, valarg_2,		\
731 			(tnf_record_p) &(tnf_v_probe_buffer->data_2)); \
732 		    tnf_v_probe_buffer->data_3 = type_3(	\
733 			tnf_v_set_p.tpd_p, valarg_3,		\
734 			(tnf_record_p) &(tnf_v_probe_buffer->data_3)); \
735 		    (tnf_v_probe_p->probe_func)(&tnf_v_set_p);	\
736 		}						\
737 	}							\
738 }
739 
740 #endif /* NPROBE */
741 
742 #ifdef NPROBE
743 
744 /* CSTYLED */
745 #define	TNF_PROBE_4(namearg, keysarg, detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2, type_3, namearg_3, valarg_3, type_4, namearg_4, valarg_4) \
746 		((void)0)
747 
748 #else
749 
750 /* CSTYLED */
751 #define	TNF_PROBE_4(namearg, keysarg, detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2, type_3, namearg_3, valarg_3, type_4, namearg_4, valarg_4)	\
752 {								\
753 	struct tnf_v_buf_4 {					\
754 		tnf_probe_event_t	probe_event;		\
755 		tnf_time_delta_t	time_delta;		\
756 		type_1##_t		data_1;		\
757 		type_2##_t		data_2;		\
758 		type_3##_t		data_3;		\
759 		type_4##_t		data_4;		\
760 	};							\
761 	static tnf_tag_data_t ** tnf_v_##namearg##_info[] = {		\
762 		&tnf_probe_event_tag_data,			\
763 		&tnf_time_delta_tag_data,			\
764 		&type_1##_tag_data,				\
765 		&type_2##_tag_data,				\
766 		&type_3##_tag_data,				\
767 		&type_4##_tag_data,				\
768 		0 };						\
769 	static struct tnf_probe_control tnf_v_##namearg##_probe = {	\
770 		&__tnf_probe_version_1,				\
771 		(tnf_probe_control_t *) TNF_NEXT_INIT,		\
772 		(tnf_probe_test_func_t) 0,			\
773 		(tnf_probe_alloc_func_t) 0,			\
774 		(tnf_probe_func_t) 0,				\
775 		(tnf_probe_func_t) 0,				\
776 		(tnf_uint32_t) 0,				\
777 			/* attribute string */			\
778 			"name " TNF_STRINGVALUE(namearg) ";" \
779 			"slots "				\
780 			""#namearg_1" "			\
781 			""#namearg_2" "			\
782 			""#namearg_3" "			\
783 			""#namearg_4" "			\
784 			";"					\
785 			"keys " keysarg ";"			\
786 			"file " __FILE__ ";"		\
787 			"line " TNF_STRINGVALUE(__LINE__) ";" \
788 			detail,					\
789 		tnf_v_##namearg##_info,					\
790 		sizeof (struct tnf_v_buf_4)			\
791 	};							\
792 	tnf_probe_control_t	*tnf_v_probe_p = &tnf_v_##namearg##_probe; \
793 	tnf_probe_test_func_t	tnf_v_probe_test = tnf_v_probe_p->test_func; \
794 	tnf_probe_setup_t	tnf_v_set_p;			\
795 	struct tnf_v_buf_4	*tnf_v_probe_buffer;		\
796 								\
797 	if (tnf_v_probe_test) {					\
798 		tnf_v_probe_buffer = (struct tnf_v_buf_4 *)	\
799 		    tnf_v_probe_test(0, tnf_v_probe_p, &tnf_v_set_p); \
800 		if (tnf_v_probe_buffer) {			\
801 		    tnf_v_probe_buffer->data_1 = type_1(	\
802 			tnf_v_set_p.tpd_p, valarg_1,		\
803 			(tnf_record_p) &(tnf_v_probe_buffer->data_1)); \
804 		    tnf_v_probe_buffer->data_2 = type_2(	\
805 			tnf_v_set_p.tpd_p, valarg_2,		\
806 			(tnf_record_p) &(tnf_v_probe_buffer->data_2)); \
807 		    tnf_v_probe_buffer->data_3 = type_3(	\
808 			tnf_v_set_p.tpd_p, valarg_3,		\
809 			(tnf_record_p) &(tnf_v_probe_buffer->data_3)); \
810 		    tnf_v_probe_buffer->data_4 = type_4(	\
811 			tnf_v_set_p.tpd_p, valarg_4,		\
812 			(tnf_record_p) &(tnf_v_probe_buffer->data_4)); \
813 		    (tnf_v_probe_p->probe_func)(&tnf_v_set_p);	\
814 		}						\
815 	}							\
816 }
817 
818 #endif /* NPROBE */
819 
820 #ifdef NPROBE
821 
822 /* CSTYLED */
823 #define	TNF_PROBE_5(namearg, keysarg, detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2, type_3, namearg_3, valarg_3, type_4, namearg_4, valarg_4, type_5, namearg_5, valarg_5) \
824 		((void)0)
825 
826 #else
827 
828 /* CSTYLED */
829 #define	TNF_PROBE_5(namearg, keysarg, detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2, type_3, namearg_3, valarg_3, type_4, namearg_4, valarg_4, type_5, namearg_5, valarg_5)	\
830 {								\
831 	struct tnf_v_buf_5 {					\
832 		tnf_probe_event_t	probe_event;		\
833 		tnf_time_delta_t	time_delta;		\
834 		type_1##_t		data_1;		\
835 		type_2##_t		data_2;		\
836 		type_3##_t		data_3;		\
837 		type_4##_t		data_4;		\
838 		type_5##_t		data_5;		\
839 	};							\
840 	static tnf_tag_data_t ** tnf_v_##namearg##_info[] = {		\
841 		&tnf_probe_event_tag_data,			\
842 		&tnf_time_delta_tag_data,			\
843 		&type_1##_tag_data,				\
844 		&type_2##_tag_data,				\
845 		&type_3##_tag_data,				\
846 		&type_4##_tag_data,				\
847 		&type_5##_tag_data,				\
848 		0 };						\
849 	static struct tnf_probe_control tnf_v_##namearg##_probe = {	\
850 		&__tnf_probe_version_1,				\
851 		(tnf_probe_control_t *) TNF_NEXT_INIT,		\
852 		(tnf_probe_test_func_t) 0,			\
853 		(tnf_probe_alloc_func_t) 0,			\
854 		(tnf_probe_func_t) 0,				\
855 		(tnf_probe_func_t) 0,				\
856 		(tnf_uint32_t) 0,				\
857 			/* attribute string */			\
858 			"name " TNF_STRINGVALUE(namearg) ";" \
859 			"slots "				\
860 			""#namearg_1" "			\
861 			""#namearg_2" "			\
862 			""#namearg_3" "			\
863 			""#namearg_4" "			\
864 			""#namearg_5" "			\
865 			";"					\
866 			"keys " keysarg ";"			\
867 			"file " __FILE__ ";"		\
868 			"line " TNF_STRINGVALUE(__LINE__) ";" \
869 			detail,					\
870 		tnf_v_##namearg##_info,					\
871 		sizeof (struct tnf_v_buf_5)			\
872 	};							\
873 	tnf_probe_control_t	*tnf_v_probe_p = &tnf_v_##namearg##_probe; \
874 	tnf_probe_test_func_t	tnf_v_probe_test = tnf_v_probe_p->test_func; \
875 	tnf_probe_setup_t	tnf_v_set_p;			\
876 	struct tnf_v_buf_5	*tnf_v_probe_buffer;		\
877 								\
878 	if (tnf_v_probe_test) {					\
879 		tnf_v_probe_buffer = (struct tnf_v_buf_5 *)	\
880 		    tnf_v_probe_test(0, tnf_v_probe_p, &tnf_v_set_p); \
881 		if (tnf_v_probe_buffer) {			\
882 		    tnf_v_probe_buffer->data_1 = type_1(	\
883 			tnf_v_set_p.tpd_p, valarg_1,		\
884 			(tnf_record_p) &(tnf_v_probe_buffer->data_1)); \
885 		    tnf_v_probe_buffer->data_2 = type_2(	\
886 			tnf_v_set_p.tpd_p, valarg_2,		\
887 			(tnf_record_p) &(tnf_v_probe_buffer->data_2)); \
888 		    tnf_v_probe_buffer->data_3 = type_3(	\
889 			tnf_v_set_p.tpd_p, valarg_3,		\
890 			(tnf_record_p) &(tnf_v_probe_buffer->data_3)); \
891 		    tnf_v_probe_buffer->data_4 = type_4(	\
892 			tnf_v_set_p.tpd_p, valarg_4,		\
893 			(tnf_record_p) &(tnf_v_probe_buffer->data_4)); \
894 		    tnf_v_probe_buffer->data_5 = type_5(	\
895 			tnf_v_set_p.tpd_p, valarg_5,		\
896 			(tnf_record_p) &(tnf_v_probe_buffer->data_5)); \
897 		    (tnf_v_probe_p->probe_func)(&tnf_v_set_p);	\
898 		}						\
899 	}							\
900 }
901 
902 #endif /* NPROBE */
903 
904 /*
905  * Debug Probe Macros (contain an additional "debug" attribute)
906  */
907 
908 #if defined(TNF_DEBUG)
909 
910 /* CSTYLED */
911 #define	TNF_PROBE_0_DEBUG(namearg, keysarg, detail)	TNF_PROBE_0(namearg, keysarg, "debug;" detail)
912 
913 #else
914 
915 /* CSTYLED */
916 #define	TNF_PROBE_0_DEBUG(namearg, keysarg, detail) \
917 		((void)0)
918 
919 #endif /* defined(TNF_DEBUG) */
920 
921 #if defined(TNF_DEBUG)
922 
923 /* CSTYLED */
924 #define	TNF_PROBE_1_DEBUG(namearg, keysarg, detail, type_1, namearg_1, valarg_1)	TNF_PROBE_1(namearg, keysarg, "debug;" detail, type_1, namearg_1, valarg_1)
925 
926 #else
927 
928 /* CSTYLED */
929 #define	TNF_PROBE_1_DEBUG(namearg, keysarg, detail, type_1, namearg_1, valarg_1) \
930 		((void)0)
931 
932 #endif /* defined(TNF_DEBUG) */
933 
934 #if defined(TNF_DEBUG)
935 
936 /* CSTYLED */
937 #define	TNF_PROBE_2_DEBUG(namearg, keysarg, detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2)	TNF_PROBE_2(namearg, keysarg, "debug;" detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2)
938 
939 #else
940 
941 /* CSTYLED */
942 #define	TNF_PROBE_2_DEBUG(namearg, keysarg, detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2) \
943 		((void)0)
944 
945 #endif /* defined(TNF_DEBUG) */
946 
947 #if defined(TNF_DEBUG)
948 
949 /* CSTYLED */
950 #define	TNF_PROBE_3_DEBUG(namearg, keysarg, detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2, type_3, namearg_3, valarg_3)	TNF_PROBE_3(namearg, keysarg, "debug;" detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2, type_3, namearg_3, valarg_3)
951 
952 #else
953 
954 /* CSTYLED */
955 #define	TNF_PROBE_3_DEBUG(namearg, keysarg, detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2, type_3, namearg_3, valarg_3) \
956 		((void)0)
957 
958 #endif /* defined(TNF_DEBUG) */
959 
960 #if defined(TNF_DEBUG)
961 
962 /* CSTYLED */
963 #define	TNF_PROBE_4_DEBUG(namearg, keysarg, detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2, type_3, namearg_3, valarg_3, type_4, namearg_4, valarg_4)	TNF_PROBE_4(namearg, keysarg, "debug;" detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2, type_3, namearg_3, valarg_3, type_4, namearg_4, valarg_4)
964 
965 #else
966 
967 /* CSTYLED */
968 #define	TNF_PROBE_4_DEBUG(namearg, keysarg, detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2, type_3, namearg_3, valarg_3, type_4, namearg_4, valarg_4) \
969 		((void)0)
970 
971 #endif /* defined(TNF_DEBUG) */
972 
973 #if defined(TNF_DEBUG)
974 
975 /* CSTYLED */
976 #define	TNF_PROBE_5_DEBUG(namearg, keysarg, detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2, type_3, namearg_3, valarg_3, type_4, namearg_4, valarg_4, type_5, namearg_5, valarg_5)	TNF_PROBE_5(namearg, keysarg, "debug;" detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2, type_3, namearg_3, valarg_3, type_4, namearg_4, valarg_4, type_5, namearg_5, valarg_5)
977 
978 #else
979 
980 /* CSTYLED */
981 #define	TNF_PROBE_5_DEBUG(namearg, keysarg, detail, type_1, namearg_1, valarg_1, type_2, namearg_2, valarg_2, type_3, namearg_3, valarg_3, type_4, namearg_4, valarg_4, type_5, namearg_5, valarg_5) \
982 		((void)0)
983 
984 #endif /* defined(TNF_DEBUG) */
985 
986 #ifdef __cplusplus
987 }
988 #endif
989 
990 #endif /* _SYS_TNF_PROBE_H */
991