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,1998 by Sun Microsystems, Inc. 24*7c478bd9Sstevel@tonic-gate * All rights reserved. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _TNF_TYPES_H 28*7c478bd9Sstevel@tonic-gate #define _TNF_TYPES_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 33*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 34*7c478bd9Sstevel@tonic-gate #include <sys/tnf_com.h> 35*7c478bd9Sstevel@tonic-gate #include <sys/tnf_writer.h> 36*7c478bd9Sstevel@tonic-gate #include <sys/tnf_probe.h> 37*7c478bd9Sstevel@tonic-gate #include "tnf_buf.h" 38*7c478bd9Sstevel@tonic-gate #else /* _KERNEL */ 39*7c478bd9Sstevel@tonic-gate #include <tnf/com.h> 40*7c478bd9Sstevel@tonic-gate #include <tnf/writer.h> 41*7c478bd9Sstevel@tonic-gate #include <tnf/probe.h> 42*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 45*7c478bd9Sstevel@tonic-gate extern "C" { 46*7c478bd9Sstevel@tonic-gate #endif 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate extern struct tnf_probe_version __tnf_probe_version_1_info; 49*7c478bd9Sstevel@tonic-gate 50*7c478bd9Sstevel@tonic-gate /* 51*7c478bd9Sstevel@tonic-gate * Defines 52*7c478bd9Sstevel@tonic-gate */ 53*7c478bd9Sstevel@tonic-gate 54*7c478bd9Sstevel@tonic-gate #define TAG_DATA(type) type##_tag_data 55*7c478bd9Sstevel@tonic-gate #define _TAG_DATA(type) _##type##_tag_data 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate #define TAG_SNAP(type) TAG_DATA(type) = &_TAG_DATA(type) 58*7c478bd9Sstevel@tonic-gate #define TAG_EXPORT(type) tnf_tag_data_t *TAG_SNAP(type) 59*7c478bd9Sstevel@tonic-gate 60*7c478bd9Sstevel@tonic-gate /* 61*7c478bd9Sstevel@tonic-gate * String limits 62*7c478bd9Sstevel@tonic-gate */ 63*7c478bd9Sstevel@tonic-gate 64*7c478bd9Sstevel@tonic-gate /* XXX tie into TNF_BLOCK_SIZE */ 65*7c478bd9Sstevel@tonic-gate #define TNF_STRING_LIMIT 255 /* excludes terminating NUL */ 66*7c478bd9Sstevel@tonic-gate #define TNF_STRING_ROUNDUP(sz) (((sz) + 3) & ~3) 67*7c478bd9Sstevel@tonic-gate 68*7c478bd9Sstevel@tonic-gate /* 69*7c478bd9Sstevel@tonic-gate * XXX Semi-private 70*7c478bd9Sstevel@tonic-gate */ 71*7c478bd9Sstevel@tonic-gate 72*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 73*7c478bd9Sstevel@tonic-gate 74*7c478bd9Sstevel@tonic-gate #define TAG_SET(type) TAG_SNAP(type) 75*7c478bd9Sstevel@tonic-gate #define BUF_ALLOC(ops) tnfw_b_alloc 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate #else /* _KERNEL */ 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate #define TAG_SET(type) TAG_EXPORT(type) 80*7c478bd9Sstevel@tonic-gate #define BUF_ALLOC(ops) ops->alloc 81*7c478bd9Sstevel@tonic-gate 82*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate #define ASSIGN(buf, slot, val) \ 85*7c478bd9Sstevel@tonic-gate buf->slot = tnf_##slot(ops, val, (tnf_record_p) &buf->slot) 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate #define ASSIGN2(buf, slot, val, func) \ 88*7c478bd9Sstevel@tonic-gate buf->slot = tnf_##func(ops, val, (tnf_record_p)&buf->slot) 89*7c478bd9Sstevel@tonic-gate 90*7c478bd9Sstevel@tonic-gate #define ALLOC(ops, size, mem, index_p, saved_mode) \ 91*7c478bd9Sstevel@tonic-gate mem = BUF_ALLOC(ops)(&(ops->wcb), size, ops->mode); \ 92*7c478bd9Sstevel@tonic-gate if (mem == TNF_NULL) { \ 93*7c478bd9Sstevel@tonic-gate ops->mode = saved_mode; \ 94*7c478bd9Sstevel@tonic-gate return (TNF_NULL); \ 95*7c478bd9Sstevel@tonic-gate } \ 96*7c478bd9Sstevel@tonic-gate index_p = (tnf_record_p)mem 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gate #define ALLOC2(ops, size, mem, saved_mode) \ 99*7c478bd9Sstevel@tonic-gate mem = BUF_ALLOC(ops)(&(ops->wcb), size, ops->mode); \ 100*7c478bd9Sstevel@tonic-gate if (mem == TNF_NULL) { \ 101*7c478bd9Sstevel@tonic-gate ops->mode = saved_mode; \ 102*7c478bd9Sstevel@tonic-gate return (TNF_NULL); \ 103*7c478bd9Sstevel@tonic-gate } 104*7c478bd9Sstevel@tonic-gate 105*7c478bd9Sstevel@tonic-gate /* 106*7c478bd9Sstevel@tonic-gate * NOTE: These macros DO NOT export the tags. In the kernel, tag data 107*7c478bd9Sstevel@tonic-gate * pointers are initialized to NULL in tnf_res.c, and are snapped by 108*7c478bd9Sstevel@tonic-gate * tnf_tag_XXX_init() when the driver is loaded. In user land 109*7c478bd9Sstevel@tonic-gate * they are exported by another macro. 110*7c478bd9Sstevel@tonic-gate */ 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate /* 113*7c478bd9Sstevel@tonic-gate * Initializing abstract tags 114*7c478bd9Sstevel@tonic-gate */ 115*7c478bd9Sstevel@tonic-gate 116*7c478bd9Sstevel@tonic-gate #define TNF_ABSTRACT_TAG(type) \ 117*7c478bd9Sstevel@tonic-gate static tnf_tag_data_t _TAG_DATA(type) = { \ 118*7c478bd9Sstevel@tonic-gate TNF_TAG_VERSION, \ 119*7c478bd9Sstevel@tonic-gate &tnf_abstract_tag_1, \ 120*7c478bd9Sstevel@tonic-gate 0, \ 121*7c478bd9Sstevel@tonic-gate TNF_STRINGIFY(type) } 122*7c478bd9Sstevel@tonic-gate 123*7c478bd9Sstevel@tonic-gate /* 124*7c478bd9Sstevel@tonic-gate * Initializing scalar tags 125*7c478bd9Sstevel@tonic-gate */ 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate #define TNF_SCALAR_TAG(type, size, align, kind) \ 128*7c478bd9Sstevel@tonic-gate static tnf_tag_data_t _TAG_DATA(type) = { \ 129*7c478bd9Sstevel@tonic-gate TNF_TAG_VERSION, \ 130*7c478bd9Sstevel@tonic-gate &tnf_scalar_tag_1, \ 131*7c478bd9Sstevel@tonic-gate 0, \ 132*7c478bd9Sstevel@tonic-gate TNF_STRINGIFY(type), \ 133*7c478bd9Sstevel@tonic-gate &tnf_scalar_properties, \ 134*7c478bd9Sstevel@tonic-gate size, \ 135*7c478bd9Sstevel@tonic-gate align, \ 136*7c478bd9Sstevel@tonic-gate size, \ 137*7c478bd9Sstevel@tonic-gate kind } 138*7c478bd9Sstevel@tonic-gate 139*7c478bd9Sstevel@tonic-gate #define TNF_STD_SCALAR_TAG(type, kind) \ 140*7c478bd9Sstevel@tonic-gate TNF_SCALAR_TAG(type, sizeof (type##_t), \ 141*7c478bd9Sstevel@tonic-gate TNF_ALIGN(type##_t), kind) 142*7c478bd9Sstevel@tonic-gate 143*7c478bd9Sstevel@tonic-gate /* 144*7c478bd9Sstevel@tonic-gate * Initializing array tags 145*7c478bd9Sstevel@tonic-gate * Assumes all arrays are `records' 146*7c478bd9Sstevel@tonic-gate */ 147*7c478bd9Sstevel@tonic-gate 148*7c478bd9Sstevel@tonic-gate #define TNF_ARRAY_TAG(type, eltag, props, slots, kind) \ 149*7c478bd9Sstevel@tonic-gate static tnf_tag_data_t _TAG_DATA(type) = { \ 150*7c478bd9Sstevel@tonic-gate TNF_TAG_VERSION, \ 151*7c478bd9Sstevel@tonic-gate &tnf_array_tag_1, \ 152*7c478bd9Sstevel@tonic-gate 0, \ 153*7c478bd9Sstevel@tonic-gate TNF_STRINGIFY(type), \ 154*7c478bd9Sstevel@tonic-gate &props, \ 155*7c478bd9Sstevel@tonic-gate ARRAY_HDR_SIZE, \ 156*7c478bd9Sstevel@tonic-gate TNF_ALIGN(tnf_ref32_t), \ 157*7c478bd9Sstevel@tonic-gate sizeof (tnf_ref32_t), \ 158*7c478bd9Sstevel@tonic-gate kind, \ 159*7c478bd9Sstevel@tonic-gate eltag, \ 160*7c478bd9Sstevel@tonic-gate slots } 161*7c478bd9Sstevel@tonic-gate 162*7c478bd9Sstevel@tonic-gate #define TNF_STD_ARRAY_TAG(type, eltype, kind) \ 163*7c478bd9Sstevel@tonic-gate TNF_ARRAY_TAG(type, &TAG_DATA(eltype), \ 164*7c478bd9Sstevel@tonic-gate tnf_array_properties, tnf_array_slots, kind) 165*7c478bd9Sstevel@tonic-gate 166*7c478bd9Sstevel@tonic-gate /* 167*7c478bd9Sstevel@tonic-gate * Initializing derived tags 168*7c478bd9Sstevel@tonic-gate */ 169*7c478bd9Sstevel@tonic-gate 170*7c478bd9Sstevel@tonic-gate #define TNF_DERIVED_TAG(type, basetag, props, size, align, kind) \ 171*7c478bd9Sstevel@tonic-gate static tnf_tag_data_t _TAG_DATA(type) = { \ 172*7c478bd9Sstevel@tonic-gate TNF_TAG_VERSION, \ 173*7c478bd9Sstevel@tonic-gate &tnf_derived_tag_1, \ 174*7c478bd9Sstevel@tonic-gate 0, \ 175*7c478bd9Sstevel@tonic-gate TNF_STRINGIFY(type), \ 176*7c478bd9Sstevel@tonic-gate &props, \ 177*7c478bd9Sstevel@tonic-gate 0, \ 178*7c478bd9Sstevel@tonic-gate align, \ 179*7c478bd9Sstevel@tonic-gate size, \ 180*7c478bd9Sstevel@tonic-gate kind, \ 181*7c478bd9Sstevel@tonic-gate basetag } 182*7c478bd9Sstevel@tonic-gate 183*7c478bd9Sstevel@tonic-gate #define TNF_STD_DERIVED_TAG(type, base, props, kind) \ 184*7c478bd9Sstevel@tonic-gate TNF_DERIVED_TAG(type, &TAG_DATA(base), props, \ 185*7c478bd9Sstevel@tonic-gate sizeof (type##_t), TNF_ALIGN(type##_t), kind) 186*7c478bd9Sstevel@tonic-gate 187*7c478bd9Sstevel@tonic-gate /* 188*7c478bd9Sstevel@tonic-gate * Initializing structure tags 189*7c478bd9Sstevel@tonic-gate * Assumes all structs are `records' 190*7c478bd9Sstevel@tonic-gate */ 191*7c478bd9Sstevel@tonic-gate 192*7c478bd9Sstevel@tonic-gate #define TNF_STRUCT_TAG(type, props, slots, names, size) \ 193*7c478bd9Sstevel@tonic-gate static tnf_tag_data_t _TAG_DATA(type) = { \ 194*7c478bd9Sstevel@tonic-gate TNF_TAG_VERSION, \ 195*7c478bd9Sstevel@tonic-gate &tnf_struct_tag_1, \ 196*7c478bd9Sstevel@tonic-gate 0, \ 197*7c478bd9Sstevel@tonic-gate TNF_STRINGIFY(type), \ 198*7c478bd9Sstevel@tonic-gate &props, \ 199*7c478bd9Sstevel@tonic-gate size, \ 200*7c478bd9Sstevel@tonic-gate TNF_ALIGN(tnf_ref32_t), \ 201*7c478bd9Sstevel@tonic-gate sizeof (tnf_ref32_t), \ 202*7c478bd9Sstevel@tonic-gate TNF_STRUCT, \ 203*7c478bd9Sstevel@tonic-gate 0, \ 204*7c478bd9Sstevel@tonic-gate slots, \ 205*7c478bd9Sstevel@tonic-gate names } 206*7c478bd9Sstevel@tonic-gate 207*7c478bd9Sstevel@tonic-gate #define TNF_STD_STRUCT_TAG(type, slots, names, size) \ 208*7c478bd9Sstevel@tonic-gate TNF_STRUCT_TAG(type, tnf_struct_properties, slots, names, size) 209*7c478bd9Sstevel@tonic-gate 210*7c478bd9Sstevel@tonic-gate /* 211*7c478bd9Sstevel@tonic-gate * Initializing metatags 212*7c478bd9Sstevel@tonic-gate * Size is initialized assuming NULL-terminated array of words and 213*7c478bd9Sstevel@tonic-gate * each element has a reference size of one word. 214*7c478bd9Sstevel@tonic-gate */ 215*7c478bd9Sstevel@tonic-gate 216*7c478bd9Sstevel@tonic-gate #define TNF_METATAG(type, props, slots, desc) \ 217*7c478bd9Sstevel@tonic-gate static tnf_tag_data_t _TAG_DATA(type) = { \ 218*7c478bd9Sstevel@tonic-gate TNF_TAG_VERSION, \ 219*7c478bd9Sstevel@tonic-gate &desc, \ 220*7c478bd9Sstevel@tonic-gate 0, \ 221*7c478bd9Sstevel@tonic-gate TNF_STRINGIFY(type), \ 222*7c478bd9Sstevel@tonic-gate &props, \ 223*7c478bd9Sstevel@tonic-gate (sizeof (slots) - sizeof (slots[0])) * \ 224*7c478bd9Sstevel@tonic-gate (sizeof (tnf_uint32_t))/(sizeof (char *)), \ 225*7c478bd9Sstevel@tonic-gate TNF_ALIGN(tnf_ref32_t), \ 226*7c478bd9Sstevel@tonic-gate sizeof (tnf_ref32_t), \ 227*7c478bd9Sstevel@tonic-gate TNF_STRUCT, \ 228*7c478bd9Sstevel@tonic-gate 0, \ 229*7c478bd9Sstevel@tonic-gate slots, \ 230*7c478bd9Sstevel@tonic-gate 0 } 231*7c478bd9Sstevel@tonic-gate 232*7c478bd9Sstevel@tonic-gate /* 233*7c478bd9Sstevel@tonic-gate * TNF internal types 234*7c478bd9Sstevel@tonic-gate */ 235*7c478bd9Sstevel@tonic-gate 236*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_tag_arg_tag_data; 237*7c478bd9Sstevel@tonic-gate typedef tnf_ref32_t tnf_tag_arg_t; /* tag qualifier */ 238*7c478bd9Sstevel@tonic-gate 239*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_inline_tag_data; /* abstract */ 240*7c478bd9Sstevel@tonic-gate 241*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_tagged_tag_data; /* abstract */ 242*7c478bd9Sstevel@tonic-gate 243*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_scalar_tag_data; /* abstract scalar */ 244*7c478bd9Sstevel@tonic-gate 245*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_array_tag_data; /* abstract array */ 246*7c478bd9Sstevel@tonic-gate 247*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_derived_tag_data; /* abstract derived */ 248*7c478bd9Sstevel@tonic-gate 249*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_derived_base_tag_data; 250*7c478bd9Sstevel@tonic-gate typedef tnf_reference_t tnf_derived_base_t; 251*7c478bd9Sstevel@tonic-gate #define tnf_derived_base(ops, item, ref)\ 252*7c478bd9Sstevel@tonic-gate tnf_tag_element_1(ops, item, ref, tnf_derived_base_tag_data) 253*7c478bd9Sstevel@tonic-gate 254*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_element_type_tag_data; 255*7c478bd9Sstevel@tonic-gate typedef tnf_reference_t tnf_element_type_t; 256*7c478bd9Sstevel@tonic-gate #define tnf_element_type(ops, item, ref)\ 257*7c478bd9Sstevel@tonic-gate tnf_tag_element_1(ops, item, ref, tnf_element_type_tag_data) 258*7c478bd9Sstevel@tonic-gate 259*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_type_array_tag_data; 260*7c478bd9Sstevel@tonic-gate typedef tnf_reference_t tnf_type_array_t; 261*7c478bd9Sstevel@tonic-gate #define tnf_type_array(ops, item, ref) \ 262*7c478bd9Sstevel@tonic-gate tnf_tag_array_1(ops, item, ref, tnf_type_array_tag_data) 263*7c478bd9Sstevel@tonic-gate 264*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_slot_types_tag_data; 265*7c478bd9Sstevel@tonic-gate typedef tnf_type_array_t tnf_slot_types_t; 266*7c478bd9Sstevel@tonic-gate #define tnf_slot_types(ops, item, ref) \ 267*7c478bd9Sstevel@tonic-gate tnf_tag_array_1(ops, item, ref, tnf_slot_types_tag_data) 268*7c478bd9Sstevel@tonic-gate 269*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_properties_tag_data; 270*7c478bd9Sstevel@tonic-gate typedef tnf_type_array_t tnf_properties_t; 271*7c478bd9Sstevel@tonic-gate #define tnf_properties(ops, item, ref) \ 272*7c478bd9Sstevel@tonic-gate tnf_tag_properties_1(ops, item, ref, tnf_properties_tag_data) 273*7c478bd9Sstevel@tonic-gate 274*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_name_array_tag_data; 275*7c478bd9Sstevel@tonic-gate typedef tnf_reference_t tnf_name_array_t; 276*7c478bd9Sstevel@tonic-gate #define tnf_name_array(ops, item, ref) \ 277*7c478bd9Sstevel@tonic-gate tnf_string_array_1(ops, item, ref, tnf_name_array_tag_data) 278*7c478bd9Sstevel@tonic-gate 279*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_slot_names_tag_data; 280*7c478bd9Sstevel@tonic-gate typedef tnf_name_array_t tnf_slot_names_t; 281*7c478bd9Sstevel@tonic-gate #define tnf_slot_names(ops, item, ref) \ 282*7c478bd9Sstevel@tonic-gate tnf_string_array_1(ops, item, ref, tnf_slot_names_tag_data) 283*7c478bd9Sstevel@tonic-gate 284*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_align_tag_data; 285*7c478bd9Sstevel@tonic-gate typedef tnf_uint32_t tnf_align_t; 286*7c478bd9Sstevel@tonic-gate #define tnf_align(ops, item, ref) \ 287*7c478bd9Sstevel@tonic-gate tnf_uint32(ops, item, ref) 288*7c478bd9Sstevel@tonic-gate 289*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_self_size_tag_data; 290*7c478bd9Sstevel@tonic-gate typedef tnf_uint32_t tnf_self_size_t; 291*7c478bd9Sstevel@tonic-gate #define tnf_self_size(ops, item, ref) \ 292*7c478bd9Sstevel@tonic-gate tnf_uint32(ops, item, ref) 293*7c478bd9Sstevel@tonic-gate 294*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_type_size_tag_data; 295*7c478bd9Sstevel@tonic-gate typedef tnf_uint32_t tnf_type_size_t; 296*7c478bd9Sstevel@tonic-gate #define tnf_type_size(ops, item, ref) \ 297*7c478bd9Sstevel@tonic-gate tnf_uint32(ops, item, ref) 298*7c478bd9Sstevel@tonic-gate 299*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_header_size_tag_data; 300*7c478bd9Sstevel@tonic-gate typedef tnf_uint32_t tnf_header_size_t; 301*7c478bd9Sstevel@tonic-gate #define tnf_header_size(ops, item, ref) \ 302*7c478bd9Sstevel@tonic-gate tnf_uint32(ops, item, ref) 303*7c478bd9Sstevel@tonic-gate 304*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_struct_tag_data; /* abstract struct */ 305*7c478bd9Sstevel@tonic-gate 306*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_type_tag_data; /* abstract type */ 307*7c478bd9Sstevel@tonic-gate 308*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_scalar_type_tag_data; 309*7c478bd9Sstevel@tonic-gate 310*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_derived_type_tag_data; 311*7c478bd9Sstevel@tonic-gate 312*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_array_type_tag_data; 313*7c478bd9Sstevel@tonic-gate 314*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_struct_type_tag_data; 315*7c478bd9Sstevel@tonic-gate 316*7c478bd9Sstevel@tonic-gate /* 317*7c478bd9Sstevel@tonic-gate * Concrete struct types 318*7c478bd9Sstevel@tonic-gate */ 319*7c478bd9Sstevel@tonic-gate 320*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_file_header_tag_data; 321*7c478bd9Sstevel@tonic-gate 322*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t *tnf_block_header_tag_data; 323*7c478bd9Sstevel@tonic-gate 324*7c478bd9Sstevel@tonic-gate /* 325*7c478bd9Sstevel@tonic-gate * Exported slots 326*7c478bd9Sstevel@tonic-gate */ 327*7c478bd9Sstevel@tonic-gate 328*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t **tnf_array_slots[]; 329*7c478bd9Sstevel@tonic-gate 330*7c478bd9Sstevel@tonic-gate /* 331*7c478bd9Sstevel@tonic-gate * Exported properties 332*7c478bd9Sstevel@tonic-gate */ 333*7c478bd9Sstevel@tonic-gate 334*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t ***tnf_no_properties; 335*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t ***tnf_scalar_properties; 336*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t ***tnf_array_properties; 337*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t ***tnf_derived_properties; 338*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t ***tnf_struct_properties; 339*7c478bd9Sstevel@tonic-gate extern tnf_tag_data_t ***tnf_type_properties; 340*7c478bd9Sstevel@tonic-gate 341*7c478bd9Sstevel@tonic-gate /* 342*7c478bd9Sstevel@tonic-gate * Binary layout of standard array header 343*7c478bd9Sstevel@tonic-gate */ 344*7c478bd9Sstevel@tonic-gate 345*7c478bd9Sstevel@tonic-gate typedef struct { 346*7c478bd9Sstevel@tonic-gate tnf_tag_t tag; 347*7c478bd9Sstevel@tonic-gate tnf_self_size_t self_size; 348*7c478bd9Sstevel@tonic-gate } tnf_array_header_t; 349*7c478bd9Sstevel@tonic-gate 350*7c478bd9Sstevel@tonic-gate #define ARRAY_HDR_SIZE sizeof (tnf_array_header_t) 351*7c478bd9Sstevel@tonic-gate 352*7c478bd9Sstevel@tonic-gate /* 353*7c478bd9Sstevel@tonic-gate * Binary layouts of TNF tags 354*7c478bd9Sstevel@tonic-gate */ 355*7c478bd9Sstevel@tonic-gate 356*7c478bd9Sstevel@tonic-gate typedef struct { 357*7c478bd9Sstevel@tonic-gate tnf_tag_t tag; 358*7c478bd9Sstevel@tonic-gate tnf_name_t name; 359*7c478bd9Sstevel@tonic-gate tnf_properties_t properties; 360*7c478bd9Sstevel@tonic-gate } tnf_type_prototype_t; 361*7c478bd9Sstevel@tonic-gate 362*7c478bd9Sstevel@tonic-gate typedef struct { 363*7c478bd9Sstevel@tonic-gate tnf_tag_t tag; 364*7c478bd9Sstevel@tonic-gate tnf_name_t name; 365*7c478bd9Sstevel@tonic-gate tnf_properties_t properties; 366*7c478bd9Sstevel@tonic-gate tnf_type_size_t type_size; 367*7c478bd9Sstevel@tonic-gate tnf_align_t align; 368*7c478bd9Sstevel@tonic-gate } tnf_scalar_type_prototype_t; 369*7c478bd9Sstevel@tonic-gate 370*7c478bd9Sstevel@tonic-gate typedef struct { 371*7c478bd9Sstevel@tonic-gate tnf_tag_t tag; 372*7c478bd9Sstevel@tonic-gate tnf_name_t name; 373*7c478bd9Sstevel@tonic-gate tnf_properties_t properties; 374*7c478bd9Sstevel@tonic-gate tnf_derived_base_t derived_base; 375*7c478bd9Sstevel@tonic-gate } tnf_derived_type_prototype_t; 376*7c478bd9Sstevel@tonic-gate 377*7c478bd9Sstevel@tonic-gate typedef struct { 378*7c478bd9Sstevel@tonic-gate tnf_tag_t tag; 379*7c478bd9Sstevel@tonic-gate tnf_name_t name; 380*7c478bd9Sstevel@tonic-gate tnf_properties_t properties; 381*7c478bd9Sstevel@tonic-gate tnf_slot_types_t slot_types; 382*7c478bd9Sstevel@tonic-gate tnf_header_size_t header_size; 383*7c478bd9Sstevel@tonic-gate tnf_element_type_t element_type; 384*7c478bd9Sstevel@tonic-gate } tnf_array_type_prototype_t; 385*7c478bd9Sstevel@tonic-gate 386*7c478bd9Sstevel@tonic-gate typedef struct { 387*7c478bd9Sstevel@tonic-gate tnf_tag_t tag; 388*7c478bd9Sstevel@tonic-gate tnf_name_t name; 389*7c478bd9Sstevel@tonic-gate tnf_properties_t properties; 390*7c478bd9Sstevel@tonic-gate tnf_slot_types_t slot_types; 391*7c478bd9Sstevel@tonic-gate tnf_type_size_t type_size; 392*7c478bd9Sstevel@tonic-gate tnf_slot_names_t slot_names; 393*7c478bd9Sstevel@tonic-gate } tnf_struct_type_prototype_t; 394*7c478bd9Sstevel@tonic-gate 395*7c478bd9Sstevel@tonic-gate /* 396*7c478bd9Sstevel@tonic-gate * Data encoders 397*7c478bd9Sstevel@tonic-gate */ 398*7c478bd9Sstevel@tonic-gate 399*7c478bd9Sstevel@tonic-gate extern tnf_reference_t tnf_tag_element_1(tnf_ops_t *, 400*7c478bd9Sstevel@tonic-gate tnf_tag_data_t **, 401*7c478bd9Sstevel@tonic-gate tnf_record_p, 402*7c478bd9Sstevel@tonic-gate tnf_tag_data_t *); 403*7c478bd9Sstevel@tonic-gate 404*7c478bd9Sstevel@tonic-gate extern tnf_reference_t tnf_tag_array_1(tnf_ops_t *, 405*7c478bd9Sstevel@tonic-gate tnf_tag_data_t ***, 406*7c478bd9Sstevel@tonic-gate tnf_record_p, 407*7c478bd9Sstevel@tonic-gate tnf_tag_data_t *); 408*7c478bd9Sstevel@tonic-gate 409*7c478bd9Sstevel@tonic-gate extern tnf_reference_t tnf_tag_properties_1(tnf_ops_t *, 410*7c478bd9Sstevel@tonic-gate tnf_tag_data_t ****, 411*7c478bd9Sstevel@tonic-gate tnf_record_p, 412*7c478bd9Sstevel@tonic-gate tnf_tag_data_t *); 413*7c478bd9Sstevel@tonic-gate 414*7c478bd9Sstevel@tonic-gate extern tnf_reference_t tnf_string_array_1(tnf_ops_t *, 415*7c478bd9Sstevel@tonic-gate char **, 416*7c478bd9Sstevel@tonic-gate tnf_record_p, 417*7c478bd9Sstevel@tonic-gate tnf_tag_data_t *); 418*7c478bd9Sstevel@tonic-gate 419*7c478bd9Sstevel@tonic-gate /* 420*7c478bd9Sstevel@tonic-gate * Tag descriptors 421*7c478bd9Sstevel@tonic-gate */ 422*7c478bd9Sstevel@tonic-gate 423*7c478bd9Sstevel@tonic-gate extern tnf_record_p tnf_abstract_tag_1(tnf_ops_t *, tnf_tag_data_t *); 424*7c478bd9Sstevel@tonic-gate extern tnf_record_p tnf_scalar_tag_1(tnf_ops_t *, tnf_tag_data_t *); 425*7c478bd9Sstevel@tonic-gate extern tnf_record_p tnf_derived_tag_1(tnf_ops_t *, tnf_tag_data_t *); 426*7c478bd9Sstevel@tonic-gate extern tnf_record_p tnf_array_tag_1(tnf_ops_t *, tnf_tag_data_t *); 427*7c478bd9Sstevel@tonic-gate 428*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 429*7c478bd9Sstevel@tonic-gate /* 430*7c478bd9Sstevel@tonic-gate * Tag pointer initializers, called when driver loaded to snap all 431*7c478bd9Sstevel@tonic-gate * tag data pointers. 432*7c478bd9Sstevel@tonic-gate */ 433*7c478bd9Sstevel@tonic-gate 434*7c478bd9Sstevel@tonic-gate extern void tnf_tag_core_init(void); /* initialize core tags */ 435*7c478bd9Sstevel@tonic-gate extern void tnf_tag_trace_init(void); /* initialize trace tags */ 436*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 437*7c478bd9Sstevel@tonic-gate 438*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 439*7c478bd9Sstevel@tonic-gate } 440*7c478bd9Sstevel@tonic-gate #endif 441*7c478bd9Sstevel@tonic-gate 442*7c478bd9Sstevel@tonic-gate #endif /* _TNF_TYPES_H */ 443