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