1*7c478bd9Sstevel@tonic-gate#!/usr/bin/sh
2*7c478bd9Sstevel@tonic-gate#
3*7c478bd9Sstevel@tonic-gate# CDDL HEADER START
4*7c478bd9Sstevel@tonic-gate#
5*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
6*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
7*7c478bd9Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
8*7c478bd9Sstevel@tonic-gate# with the License.
9*7c478bd9Sstevel@tonic-gate#
10*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
12*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
13*7c478bd9Sstevel@tonic-gate# and limitations under the License.
14*7c478bd9Sstevel@tonic-gate#
15*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
16*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
18*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
19*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
20*7c478bd9Sstevel@tonic-gate#
21*7c478bd9Sstevel@tonic-gate# CDDL HEADER END
22*7c478bd9Sstevel@tonic-gate#
23*7c478bd9Sstevel@tonic-gate#
24*7c478bd9Sstevel@tonic-gate# Copyright (c) 1994-2000 by Sun Microsystems, Inc.
25*7c478bd9Sstevel@tonic-gate# All rights reserved.
26*7c478bd9Sstevel@tonic-gate#
27*7c478bd9Sstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"
28*7c478bd9Sstevel@tonic-gate
29*7c478bd9Sstevel@tonic-gatecat <<ENDSTR
30*7c478bd9Sstevel@tonic-gate/*
31*7c478bd9Sstevel@tonic-gate *	Copyright (c) 1994, by Sun Microsytems, Inc.
32*7c478bd9Sstevel@tonic-gate */
33*7c478bd9Sstevel@tonic-gate
34*7c478bd9Sstevel@tonic-gate#ifndef _SYS_TNF_PROBE_H
35*7c478bd9Sstevel@tonic-gate#define	_SYS_TNF_PROBE_H
36*7c478bd9Sstevel@tonic-gate
37*7c478bd9Sstevel@tonic-gate#pragma ident	"%Z%tnf_probe.h	%I%	%E% SMI"
38*7c478bd9Sstevel@tonic-gate
39*7c478bd9Sstevel@tonic-gate#include <sys/tnf_writer.h>
40*7c478bd9Sstevel@tonic-gate
41*7c478bd9Sstevel@tonic-gate#ifdef __cplusplus
42*7c478bd9Sstevel@tonic-gateextern "C" {
43*7c478bd9Sstevel@tonic-gate#endif
44*7c478bd9Sstevel@tonic-gate
45*7c478bd9Sstevel@tonic-gate/*
46*7c478bd9Sstevel@tonic-gate * These macros are used to convert the __LINE__ directive to a
47*7c478bd9Sstevel@tonic-gate * string in the probe macros below.
48*7c478bd9Sstevel@tonic-gate */
49*7c478bd9Sstevel@tonic-gate
50*7c478bd9Sstevel@tonic-gate#define	TNF_STRINGIFY(x) #x
51*7c478bd9Sstevel@tonic-gate#define	TNF_STRINGVALUE(x) TNF_STRINGIFY(x)
52*7c478bd9Sstevel@tonic-gate
53*7c478bd9Sstevel@tonic-gate/*
54*7c478bd9Sstevel@tonic-gate * Alignment of tnf_ref32_t
55*7c478bd9Sstevel@tonic-gate */
56*7c478bd9Sstevel@tonic-gate
57*7c478bd9Sstevel@tonic-gatestruct _tnf_ref32_align {
58*7c478bd9Sstevel@tonic-gate	char		c;
59*7c478bd9Sstevel@tonic-gate	tnf_ref32_t	t;
60*7c478bd9Sstevel@tonic-gate};
61*7c478bd9Sstevel@tonic-gate#define	TNF_REF32_ALIGN		TNF_OFFSETOF(struct _tnf_ref32_align, t)
62*7c478bd9Sstevel@tonic-gate
63*7c478bd9Sstevel@tonic-gate/*
64*7c478bd9Sstevel@tonic-gate * Probe versioning
65*7c478bd9Sstevel@tonic-gate */
66*7c478bd9Sstevel@tonic-gate
67*7c478bd9Sstevel@tonic-gatestruct tnf_probe_version {
68*7c478bd9Sstevel@tonic-gate	size_t	version_size;		/* sizeof(struct tnf_probe_version) */
69*7c478bd9Sstevel@tonic-gate	size_t	probe_control_size;	/* sizeof(tnf_probe_control_t) */
70*7c478bd9Sstevel@tonic-gate};
71*7c478bd9Sstevel@tonic-gate
72*7c478bd9Sstevel@tonic-gateextern struct tnf_probe_version __tnf_probe_version_1;
73*7c478bd9Sstevel@tonic-gate#pragma weak __tnf_probe_version_1
74*7c478bd9Sstevel@tonic-gate
75*7c478bd9Sstevel@tonic-gate/*
76*7c478bd9Sstevel@tonic-gate * Typedefs
77*7c478bd9Sstevel@tonic-gate */
78*7c478bd9Sstevel@tonic-gate
79*7c478bd9Sstevel@tonic-gatetypedef struct tnf_probe_control tnf_probe_control_t;
80*7c478bd9Sstevel@tonic-gatetypedef struct tnf_probe_setup tnf_probe_setup_t;
81*7c478bd9Sstevel@tonic-gate
82*7c478bd9Sstevel@tonic-gate/* returns pointer to buffer */
83*7c478bd9Sstevel@tonic-gatetypedef void * (*tnf_probe_test_func_t)(void *,
84*7c478bd9Sstevel@tonic-gate					tnf_probe_control_t *,
85*7c478bd9Sstevel@tonic-gate					tnf_probe_setup_t *);
86*7c478bd9Sstevel@tonic-gate
87*7c478bd9Sstevel@tonic-gate/* returns buffer pointer */
88*7c478bd9Sstevel@tonic-gatetypedef void * (*tnf_probe_alloc_func_t)(tnf_ops_t *,	/* tpd	*/
89*7c478bd9Sstevel@tonic-gate					tnf_probe_control_t *,
90*7c478bd9Sstevel@tonic-gate					tnf_probe_setup_t *);
91*7c478bd9Sstevel@tonic-gate
92*7c478bd9Sstevel@tonic-gatetypedef void (*tnf_probe_func_t)(tnf_probe_setup_t *);
93*7c478bd9Sstevel@tonic-gate
94*7c478bd9Sstevel@tonic-gate/*
95*7c478bd9Sstevel@tonic-gate * Probe argument block
96*7c478bd9Sstevel@tonic-gate */
97*7c478bd9Sstevel@tonic-gate
98*7c478bd9Sstevel@tonic-gatestruct tnf_probe_setup {
99*7c478bd9Sstevel@tonic-gate	tnf_ops_t		*tpd_p;
100*7c478bd9Sstevel@tonic-gate	void			*buffer_p;
101*7c478bd9Sstevel@tonic-gate	tnf_probe_control_t	*probe_p;
102*7c478bd9Sstevel@tonic-gate};
103*7c478bd9Sstevel@tonic-gate
104*7c478bd9Sstevel@tonic-gate/*
105*7c478bd9Sstevel@tonic-gate * Probe control block
106*7c478bd9Sstevel@tonic-gate */
107*7c478bd9Sstevel@tonic-gate
108*7c478bd9Sstevel@tonic-gatestruct tnf_probe_control {
109*7c478bd9Sstevel@tonic-gate	const struct tnf_probe_version	*version;
110*7c478bd9Sstevel@tonic-gate	tnf_probe_control_t	*next;
111*7c478bd9Sstevel@tonic-gate	tnf_probe_test_func_t	test_func;
112*7c478bd9Sstevel@tonic-gate	tnf_probe_alloc_func_t	alloc_func;
113*7c478bd9Sstevel@tonic-gate	tnf_probe_func_t	probe_func;
114*7c478bd9Sstevel@tonic-gate	tnf_probe_func_t	commit_func;
115*7c478bd9Sstevel@tonic-gate	tnf_uint32_t		index;
116*7c478bd9Sstevel@tonic-gate	const char		*attrs;
117*7c478bd9Sstevel@tonic-gate	tnf_tag_data_t		***slot_types;
118*7c478bd9Sstevel@tonic-gate	unsigned long		tnf_event_size;
119*7c478bd9Sstevel@tonic-gate};
120*7c478bd9Sstevel@tonic-gate
121*7c478bd9Sstevel@tonic-gate#ifdef _KERNEL
122*7c478bd9Sstevel@tonic-gate
123*7c478bd9Sstevel@tonic-gate#define	TNF_NEXT_INIT	0
124*7c478bd9Sstevel@tonic-gate
125*7c478bd9Sstevel@tonic-gate#else
126*7c478bd9Sstevel@tonic-gate
127*7c478bd9Sstevel@tonic-gate#define	TNF_NEXT_INIT	-1
128*7c478bd9Sstevel@tonic-gate
129*7c478bd9Sstevel@tonic-gate#endif	/* _KERNEL */
130*7c478bd9Sstevel@tonic-gate
131*7c478bd9Sstevel@tonic-gate/*
132*7c478bd9Sstevel@tonic-gate * TNF Type extension
133*7c478bd9Sstevel@tonic-gate */
134*7c478bd9Sstevel@tonic-gate
135*7c478bd9Sstevel@tonic-gate#ifdef NPROBE
136*7c478bd9Sstevel@tonic-gate
137*7c478bd9Sstevel@tonic-gate#define	TNF_DECLARE_RECORD(ctype, record)				\\
138*7c478bd9Sstevel@tonic-gate	typedef tnf_reference_t record##_t
139*7c478bd9Sstevel@tonic-gate
140*7c478bd9Sstevel@tonic-gate#else
141*7c478bd9Sstevel@tonic-gate
142*7c478bd9Sstevel@tonic-gate#define	TNF_DECLARE_RECORD(ctype, record)				\\
143*7c478bd9Sstevel@tonic-gate	typedef tnf_reference_t record##_t;				\\
144*7c478bd9Sstevel@tonic-gate	extern tnf_tag_data_t *record##_tag_data;			\\
145*7c478bd9Sstevel@tonic-gate	extern record##_t record(tnf_ops_t *, ctype *, tnf_reference_t)
146*7c478bd9Sstevel@tonic-gate
147*7c478bd9Sstevel@tonic-gate#endif	/* NPROBE */
148*7c478bd9Sstevel@tonic-gate
149*7c478bd9Sstevel@tonic-gateENDSTR
150*7c478bd9Sstevel@tonic-gate
151*7c478bd9Sstevel@tonic-gate#
152*7c478bd9Sstevel@tonic-gate# The following code generates the five type extension macros
153*7c478bd9Sstevel@tonic-gate#
154*7c478bd9Sstevel@tonic-gatefor i in 1 2 3 4 5; do
155*7c478bd9Sstevel@tonic-gate  echo "#ifdef NPROBE\n"
156*7c478bd9Sstevel@tonic-gate  echo "/* CSTYLED */"
157*7c478bd9Sstevel@tonic-gate  echo "#define	TNF_DEFINE_RECORD_$i(ctype, ctype_record\c"
158*7c478bd9Sstevel@tonic-gate  j=1; while [ $j -le $i ]; do
159*7c478bd9Sstevel@tonic-gate    echo ", t$j, n$j\c"
160*7c478bd9Sstevel@tonic-gate    j=`expr $j + 1`
161*7c478bd9Sstevel@tonic-gate  done
162*7c478bd9Sstevel@tonic-gate  echo ")\n"
163*7c478bd9Sstevel@tonic-gate  echo "#else\n"
164*7c478bd9Sstevel@tonic-gate  echo "/* CSTYLED */"
165*7c478bd9Sstevel@tonic-gate  echo "#define	TNF_DEFINE_RECORD_$i(ctype, ctype_record\c"
166*7c478bd9Sstevel@tonic-gate  j=1; while [ $j -le $i ]; do
167*7c478bd9Sstevel@tonic-gate    echo ", t$j, n$j\c"
168*7c478bd9Sstevel@tonic-gate    j=`expr $j + 1`
169*7c478bd9Sstevel@tonic-gate  done
170*7c478bd9Sstevel@tonic-gate  echo ") \\"
171*7c478bd9Sstevel@tonic-gate  echo "typedef struct {						\\"
172*7c478bd9Sstevel@tonic-gate  echo "	tnf_tag_t	tag;					\\"
173*7c478bd9Sstevel@tonic-gate  j=1; while [ $j -le $i ]; do
174*7c478bd9Sstevel@tonic-gate    echo "	t$j##_t		data_$j;				\\"
175*7c478bd9Sstevel@tonic-gate    j=`expr $j + 1`
176*7c478bd9Sstevel@tonic-gate  done
177*7c478bd9Sstevel@tonic-gate  echo "} ctype_record##_prototype_t;					\\"
178*7c478bd9Sstevel@tonic-gate  echo "static tnf_tag_data_t **ctype_record##_type_slots[] = {		\\"
179*7c478bd9Sstevel@tonic-gate  echo "	&tnf_tag_tag_data,					\\"
180*7c478bd9Sstevel@tonic-gate  j=1; while [ $j -le $i ]; do
181*7c478bd9Sstevel@tonic-gate    echo "	&t$j##_tag_data,					\\"
182*7c478bd9Sstevel@tonic-gate    j=`expr $j + 1`
183*7c478bd9Sstevel@tonic-gate  done
184*7c478bd9Sstevel@tonic-gate  echo "	0 };							\\";
185*7c478bd9Sstevel@tonic-gate  echo "static char *ctype_record##_slot_names[] = {			\\";
186*7c478bd9Sstevel@tonic-gate  echo "	\"tnf_tag\",						\\"
187*7c478bd9Sstevel@tonic-gate  j=1; while [ $j -le $i ]; do
188*7c478bd9Sstevel@tonic-gate    echo "	\"\"#n$j,						\\"
189*7c478bd9Sstevel@tonic-gate    j=`expr $j + 1`
190*7c478bd9Sstevel@tonic-gate  done
191*7c478bd9Sstevel@tonic-gate  echo "	0 };							\\"
192*7c478bd9Sstevel@tonic-gate  echo "static tnf_tag_data_t ctype_record##_tag_data_rec = {		\\"
193*7c478bd9Sstevel@tonic-gate  echo "	TNF_TAG_VERSION, &tnf_struct_tag_1,			\\"
194*7c478bd9Sstevel@tonic-gate  echo "	0, #ctype_record, &tnf_user_struct_properties,		\\"
195*7c478bd9Sstevel@tonic-gate  echo "	sizeof (ctype_record##_prototype_t),			\\"
196*7c478bd9Sstevel@tonic-gate  echo "	TNF_REF32_ALIGN,					\\"
197*7c478bd9Sstevel@tonic-gate  echo "	sizeof (ctype_record##_t), TNF_STRUCT, 0,		\\"
198*7c478bd9Sstevel@tonic-gate  echo "	ctype_record##_type_slots, ctype_record##_slot_names	\\"
199*7c478bd9Sstevel@tonic-gate  echo "};								\\"
200*7c478bd9Sstevel@tonic-gate  echo "tnf_tag_data_t *ctype_record##_tag_data =			\\"
201*7c478bd9Sstevel@tonic-gate  echo "			&ctype_record##_tag_data_rec;		\\"
202*7c478bd9Sstevel@tonic-gate  echo "ctype_record##_t						\\"
203*7c478bd9Sstevel@tonic-gate  echo "ctype_record(tnf_ops_t *ops, ctype * the_ctype,			\\"
204*7c478bd9Sstevel@tonic-gate  echo "				tnf_reference_t reference)	\\"
205*7c478bd9Sstevel@tonic-gate  echo "{								\\"
206*7c478bd9Sstevel@tonic-gate  echo "	tnf_tag_data_t			*metatag_data;		\\"
207*7c478bd9Sstevel@tonic-gate  echo "	tnf_record_p			metatag_index;		\\"
208*7c478bd9Sstevel@tonic-gate  echo "	ctype_record##_prototype_t	*buffer;		\\"
209*7c478bd9Sstevel@tonic-gate  echo "								\\"
210*7c478bd9Sstevel@tonic-gate  echo "	if (the_ctype == NULL)					\\"
211*7c478bd9Sstevel@tonic-gate  echo "		return (0);					\\"
212*7c478bd9Sstevel@tonic-gate  echo "	buffer = (ctype_record##_prototype_t *) tnf_allocate(ops, \\"
213*7c478bd9Sstevel@tonic-gate  echo "			sizeof (ctype_record##_prototype_t));	\\"
214*7c478bd9Sstevel@tonic-gate  echo "	if (buffer == NULL)					\\"
215*7c478bd9Sstevel@tonic-gate  echo "		return (0);					\\"
216*7c478bd9Sstevel@tonic-gate  echo "								\\"
217*7c478bd9Sstevel@tonic-gate  echo "	metatag_data = ctype_record##_tag_data;			\\"
218*7c478bd9Sstevel@tonic-gate  echo "	metatag_index = metatag_data->tag_index ?		\\"
219*7c478bd9Sstevel@tonic-gate  echo "		metatag_data->tag_index:			\\"
220*7c478bd9Sstevel@tonic-gate  echo "		metatag_data->tag_desc(ops, metatag_data);	\\"
221*7c478bd9Sstevel@tonic-gate  echo "	buffer->tag = tnf_tag(ops, metatag_index,		\\"
222*7c478bd9Sstevel@tonic-gate  echo "		(tnf_reference_t) &buffer->tag);		\\"
223*7c478bd9Sstevel@tonic-gate  j=1; while [ $j -le $i ]; do
224*7c478bd9Sstevel@tonic-gate    echo "	buffer->data_$j = t$j(ops, the_ctype->n$j,		\\"
225*7c478bd9Sstevel@tonic-gate    echo "			(tnf_reference_t) &(buffer->data_$j));	\\"
226*7c478bd9Sstevel@tonic-gate    j=`expr $j + 1`
227*7c478bd9Sstevel@tonic-gate  done
228*7c478bd9Sstevel@tonic-gate  echo "	return (tnf_ref32(ops, (tnf_record_p) buffer, reference)); \\"
229*7c478bd9Sstevel@tonic-gate  echo "}\n"
230*7c478bd9Sstevel@tonic-gate  echo "#endif /* NPROBE */"
231*7c478bd9Sstevel@tonic-gate  echo ""
232*7c478bd9Sstevel@tonic-gatedone
233*7c478bd9Sstevel@tonic-gate
234*7c478bd9Sstevel@tonic-gateecho "/*"
235*7c478bd9Sstevel@tonic-gateecho " * Probe Macros"
236*7c478bd9Sstevel@tonic-gateecho " */"
237*7c478bd9Sstevel@tonic-gateecho ""
238*7c478bd9Sstevel@tonic-gate
239*7c478bd9Sstevel@tonic-gate#
240*7c478bd9Sstevel@tonic-gate# The following code generates the six probe macros ...
241*7c478bd9Sstevel@tonic-gate#
242*7c478bd9Sstevel@tonic-gatefor i in 0 1 2 3 4 5; do
243*7c478bd9Sstevel@tonic-gate  echo "#ifdef NPROBE\n"
244*7c478bd9Sstevel@tonic-gate  echo "/* CSTYLED */"
245*7c478bd9Sstevel@tonic-gate  echo "#define	TNF_PROBE_$i(namearg, keysarg, detail\c"
246*7c478bd9Sstevel@tonic-gate  j=1; while [ $j -le $i ]; do
247*7c478bd9Sstevel@tonic-gate    echo ", type_$j, namearg_$j, valarg_$j\c"
248*7c478bd9Sstevel@tonic-gate    j=`expr $j + 1`
249*7c478bd9Sstevel@tonic-gate  done
250*7c478bd9Sstevel@tonic-gate  echo ") \\"
251*7c478bd9Sstevel@tonic-gate  echo "\t\t((void)0)\n"
252*7c478bd9Sstevel@tonic-gate  echo "#else\n"
253*7c478bd9Sstevel@tonic-gate  echo "/* CSTYLED */"
254*7c478bd9Sstevel@tonic-gate  echo "#define	TNF_PROBE_$i(namearg, keysarg, detail\c"
255*7c478bd9Sstevel@tonic-gate  j=1; while [ $j -le $i ]; do
256*7c478bd9Sstevel@tonic-gate    echo ", type_$j, namearg_$j, valarg_$j\c";
257*7c478bd9Sstevel@tonic-gate    j=`expr $j + 1`
258*7c478bd9Sstevel@tonic-gate  done
259*7c478bd9Sstevel@tonic-gate  echo ")	\\"
260*7c478bd9Sstevel@tonic-gate  echo "{								\\"
261*7c478bd9Sstevel@tonic-gate  echo "	struct tnf_v_buf_$i {					\\"
262*7c478bd9Sstevel@tonic-gate  echo "		tnf_probe_event_t	probe_event;		\\"
263*7c478bd9Sstevel@tonic-gate  echo "		tnf_time_delta_t	time_delta;		\\"
264*7c478bd9Sstevel@tonic-gate  j=1; while [ $j -le $i ]; do
265*7c478bd9Sstevel@tonic-gate    echo "		type_$j##_t		data_$j;		\\"
266*7c478bd9Sstevel@tonic-gate    j=`expr $j + 1`
267*7c478bd9Sstevel@tonic-gate  done
268*7c478bd9Sstevel@tonic-gate  echo "	};							\\"
269*7c478bd9Sstevel@tonic-gate  echo "	static tnf_tag_data_t ** tnf_v_##namearg##_info[] = {		\\"
270*7c478bd9Sstevel@tonic-gate  echo "		&tnf_probe_event_tag_data,			\\"
271*7c478bd9Sstevel@tonic-gate  echo "		&tnf_time_delta_tag_data,			\\"
272*7c478bd9Sstevel@tonic-gate  j=1; while [ $j -le $i ]; do
273*7c478bd9Sstevel@tonic-gate    echo "		&type_$j##_tag_data,				\\"
274*7c478bd9Sstevel@tonic-gate    j=`expr $j + 1`
275*7c478bd9Sstevel@tonic-gate  done
276*7c478bd9Sstevel@tonic-gate  echo "		0 };						\\"
277*7c478bd9Sstevel@tonic-gate  echo "	static struct tnf_probe_control tnf_v_##namearg##_probe = {	\\"
278*7c478bd9Sstevel@tonic-gate  echo "		&__tnf_probe_version_1,				\\"
279*7c478bd9Sstevel@tonic-gate  echo "		(tnf_probe_control_t *) TNF_NEXT_INIT,		\\"
280*7c478bd9Sstevel@tonic-gate  echo "		(tnf_probe_test_func_t) 0,			\\"
281*7c478bd9Sstevel@tonic-gate  echo "		(tnf_probe_alloc_func_t) 0,			\\"
282*7c478bd9Sstevel@tonic-gate  echo "		(tnf_probe_func_t) 0,				\\"
283*7c478bd9Sstevel@tonic-gate  echo "		(tnf_probe_func_t) 0,				\\"
284*7c478bd9Sstevel@tonic-gate  echo "		(tnf_uint32_t) 0,				\\"
285*7c478bd9Sstevel@tonic-gate  echo "			/* attribute string */			\\"
286*7c478bd9Sstevel@tonic-gate  echo "			\"name \" TNF_STRINGVALUE(namearg) \";\" \\"
287*7c478bd9Sstevel@tonic-gate#  echo "			\"slots \"\c"
288*7c478bd9Sstevel@tonic-gate#  j=1; while [ $j -le $i ]; do
289*7c478bd9Sstevel@tonic-gate#    echo " #namearg_$j \" \"\c"
290*7c478bd9Sstevel@tonic-gate#    j=`expr $j + 1`
291*7c478bd9Sstevel@tonic-gate  echo "			\"slots \"				\\"
292*7c478bd9Sstevel@tonic-gate  j=1; while [ $j -le $i ]; do
293*7c478bd9Sstevel@tonic-gate    echo "			\"\"#namearg_$j\" \"			\\"
294*7c478bd9Sstevel@tonic-gate    j=`expr $j + 1`
295*7c478bd9Sstevel@tonic-gate  done
296*7c478bd9Sstevel@tonic-gate  echo "			\";\"					\\"
297*7c478bd9Sstevel@tonic-gate  echo "			\"keys \" keysarg \";\"			\\"
298*7c478bd9Sstevel@tonic-gate  echo "			\"file \" __FILE__ \";\"		\\"
299*7c478bd9Sstevel@tonic-gate  echo "			\"line \" TNF_STRINGVALUE(__LINE__) \";\" \\"
300*7c478bd9Sstevel@tonic-gate  echo "			detail,					\\"
301*7c478bd9Sstevel@tonic-gate  echo "		tnf_v_##namearg##_info,					\\"
302*7c478bd9Sstevel@tonic-gate  echo "		sizeof (struct tnf_v_buf_$i)			\\"
303*7c478bd9Sstevel@tonic-gate  echo "	};							\\"
304*7c478bd9Sstevel@tonic-gate  echo "	tnf_probe_control_t	*tnf_v_probe_p = &tnf_v_##namearg##_probe; \\"
305*7c478bd9Sstevel@tonic-gate  echo "	tnf_probe_test_func_t	tnf_v_probe_test = tnf_v_probe_p->test_func; \\"
306*7c478bd9Sstevel@tonic-gate  echo "	tnf_probe_setup_t	tnf_v_set_p;			\\"
307*7c478bd9Sstevel@tonic-gate  echo "	struct tnf_v_buf_$i	*tnf_v_probe_buffer;		\\"
308*7c478bd9Sstevel@tonic-gate  echo "								\\"
309*7c478bd9Sstevel@tonic-gate  echo "	if (tnf_v_probe_test) {					\\"
310*7c478bd9Sstevel@tonic-gate  echo "		tnf_v_probe_buffer = (struct tnf_v_buf_$i *)	\\"
311*7c478bd9Sstevel@tonic-gate  echo "		    tnf_v_probe_test(0, tnf_v_probe_p, &tnf_v_set_p); \\"
312*7c478bd9Sstevel@tonic-gate  echo "		if (tnf_v_probe_buffer) {			\\"
313*7c478bd9Sstevel@tonic-gate  j=1; while [ $j -le $i ]; do
314*7c478bd9Sstevel@tonic-gate    echo "		    tnf_v_probe_buffer->data_$j = type_$j(	\\"
315*7c478bd9Sstevel@tonic-gate    echo "			tnf_v_set_p.tpd_p, valarg_$j,		\\"
316*7c478bd9Sstevel@tonic-gate    echo "			(tnf_reference_t) &(tnf_v_probe_buffer->data_$j)); \\"
317*7c478bd9Sstevel@tonic-gate    j=`expr $j + 1`
318*7c478bd9Sstevel@tonic-gate  done
319*7c478bd9Sstevel@tonic-gate  echo "		    (tnf_v_probe_p->probe_func)(&tnf_v_set_p);	\\"
320*7c478bd9Sstevel@tonic-gate  echo "		}						\\"
321*7c478bd9Sstevel@tonic-gate  echo "	}							\\"
322*7c478bd9Sstevel@tonic-gate  echo "}\n"
323*7c478bd9Sstevel@tonic-gate  echo "#endif /* NPROBE */"
324*7c478bd9Sstevel@tonic-gate  echo ""
325*7c478bd9Sstevel@tonic-gate  done
326*7c478bd9Sstevel@tonic-gate
327*7c478bd9Sstevel@tonic-gateecho "/*"
328*7c478bd9Sstevel@tonic-gateecho " * Debug Probe Macros (contain an additional \"debug\" attribute)"
329*7c478bd9Sstevel@tonic-gateecho " */"
330*7c478bd9Sstevel@tonic-gateecho ""
331*7c478bd9Sstevel@tonic-gate
332*7c478bd9Sstevel@tonic-gate#
333*7c478bd9Sstevel@tonic-gate# The following code generates the six debug probe macros ...
334*7c478bd9Sstevel@tonic-gate#
335*7c478bd9Sstevel@tonic-gatefor i in 0 1 2 3 4 5; do
336*7c478bd9Sstevel@tonic-gate  echo "#if defined(TNF_DEBUG)\n"
337*7c478bd9Sstevel@tonic-gate  echo "/* CSTYLED */"
338*7c478bd9Sstevel@tonic-gate  echo "#define	TNF_PROBE_${i}_DEBUG(namearg, keysarg, detail\c"
339*7c478bd9Sstevel@tonic-gate  j=1; while [ $j -le $i ]; do
340*7c478bd9Sstevel@tonic-gate    echo ", type_$j, namearg_$j, valarg_$j\c";
341*7c478bd9Sstevel@tonic-gate    j=`expr $j + 1`
342*7c478bd9Sstevel@tonic-gate  done
343*7c478bd9Sstevel@tonic-gate  echo ")\t\c"
344*7c478bd9Sstevel@tonic-gate  echo "TNF_PROBE_$i(namearg, keysarg, \"debug;\" detail\c"
345*7c478bd9Sstevel@tonic-gate  j=1; while [ $j -le $i ]; do
346*7c478bd9Sstevel@tonic-gate    echo ", type_$j, namearg_$j, valarg_$j\c"
347*7c478bd9Sstevel@tonic-gate    j=`expr $j + 1`
348*7c478bd9Sstevel@tonic-gate  done
349*7c478bd9Sstevel@tonic-gate  echo ")\n"
350*7c478bd9Sstevel@tonic-gate  echo "#else\n"
351*7c478bd9Sstevel@tonic-gate  echo "/* CSTYLED */"
352*7c478bd9Sstevel@tonic-gate  echo "#define	TNF_PROBE_${i}_DEBUG(namearg, keysarg, detail\c"
353*7c478bd9Sstevel@tonic-gate  j=1; while [ $j -le $i ]; do
354*7c478bd9Sstevel@tonic-gate    echo ", type_$j, namearg_$j, valarg_$j\c"
355*7c478bd9Sstevel@tonic-gate    j=`expr $j + 1`
356*7c478bd9Sstevel@tonic-gate  done
357*7c478bd9Sstevel@tonic-gate  echo ") \\"
358*7c478bd9Sstevel@tonic-gate  echo "\t\t((void)0)\n"
359*7c478bd9Sstevel@tonic-gate  echo "#endif /* defined(TNF_DEBUG) */"
360*7c478bd9Sstevel@tonic-gate  echo ""
361*7c478bd9Sstevel@tonic-gate  done
362*7c478bd9Sstevel@tonic-gate
363*7c478bd9Sstevel@tonic-gate  echo "#ifdef __cplusplus"
364*7c478bd9Sstevel@tonic-gate  echo "}"
365*7c478bd9Sstevel@tonic-gate  echo "#endif"
366*7c478bd9Sstevel@tonic-gate  echo ""
367*7c478bd9Sstevel@tonic-gate  echo "#endif /* _SYS_TNF_PROBE_H */"
368