tnf_types.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1994,1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _TNF_TYPES_H
#define _TNF_TYPES_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef _KERNEL
#include <sys/tnf_writer.h>
#include <sys/tnf_probe.h>
#include "tnf_buf.h"
#else /* _KERNEL */
#endif /* _KERNEL */
#ifdef __cplusplus
extern "C" {
#endif
extern struct tnf_probe_version __tnf_probe_version_1_info;
/*
* Defines
*/
/*
* String limits
*/
/* XXX tie into TNF_BLOCK_SIZE */
/*
* XXX Semi-private
*/
#ifdef _KERNEL
#else /* _KERNEL */
#endif /* _KERNEL */
return (TNF_NULL); \
} \
return (TNF_NULL); \
}
/*
* NOTE: These macros DO NOT export the tags. In the kernel, tag data
* pointers are initialized to NULL in tnf_res.c, and are snapped by
* tnf_tag_XXX_init() when the driver is loaded. In user land
* they are exported by another macro.
*/
/*
* Initializing abstract tags
*/
#define TNF_ABSTRACT_TAG(type) \
0, \
/*
* Initializing scalar tags
*/
&tnf_scalar_tag_1, \
0, \
TNF_STRINGIFY(type), \
size, \
align, \
size, \
kind }
/*
* Initializing array tags
* Assumes all arrays are `records'
*/
&tnf_array_tag_1, \
0, \
TNF_STRINGIFY(type), \
&props, \
TNF_ALIGN(tnf_ref32_t), \
sizeof (tnf_ref32_t), \
kind, \
eltag, \
slots }
/*
* Initializing derived tags
*/
0, \
TNF_STRINGIFY(type), \
&props, \
0, \
align, \
size, \
kind, \
basetag }
/*
* Initializing structure tags
* Assumes all structs are `records'
*/
&tnf_struct_tag_1, \
0, \
TNF_STRINGIFY(type), \
&props, \
size, \
TNF_ALIGN(tnf_ref32_t), \
sizeof (tnf_ref32_t), \
TNF_STRUCT, \
0, \
slots, \
names }
/*
* Initializing metatags
* Size is initialized assuming NULL-terminated array of words and
* each element has a reference size of one word.
*/
&desc, \
0, \
TNF_STRINGIFY(type), \
&props, \
(sizeof (tnf_uint32_t))/(sizeof (char *)), \
TNF_ALIGN(tnf_ref32_t), \
sizeof (tnf_ref32_t), \
TNF_STRUCT, \
0, \
slots, \
0 }
/*
* TNF internal types
*/
extern tnf_tag_data_t *tnf_tag_arg_tag_data;
extern tnf_tag_data_t *tnf_derived_base_tag_data;
typedef tnf_reference_t tnf_derived_base_t;
extern tnf_tag_data_t *tnf_element_type_tag_data;
typedef tnf_reference_t tnf_element_type_t;
extern tnf_tag_data_t *tnf_type_array_tag_data;
typedef tnf_reference_t tnf_type_array_t;
extern tnf_tag_data_t *tnf_slot_types_tag_data;
typedef tnf_type_array_t tnf_slot_types_t;
extern tnf_tag_data_t *tnf_properties_tag_data;
typedef tnf_type_array_t tnf_properties_t;
extern tnf_tag_data_t *tnf_name_array_tag_data;
typedef tnf_reference_t tnf_name_array_t;
extern tnf_tag_data_t *tnf_slot_names_tag_data;
typedef tnf_name_array_t tnf_slot_names_t;
extern tnf_tag_data_t *tnf_align_tag_data;
typedef tnf_uint32_t tnf_align_t;
extern tnf_tag_data_t *tnf_self_size_tag_data;
typedef tnf_uint32_t tnf_self_size_t;
extern tnf_tag_data_t *tnf_type_size_tag_data;
typedef tnf_uint32_t tnf_type_size_t;
extern tnf_tag_data_t *tnf_header_size_tag_data;
typedef tnf_uint32_t tnf_header_size_t;
extern tnf_tag_data_t *tnf_scalar_type_tag_data;
extern tnf_tag_data_t *tnf_derived_type_tag_data;
extern tnf_tag_data_t *tnf_array_type_tag_data;
extern tnf_tag_data_t *tnf_struct_type_tag_data;
/*
* Concrete struct types
*/
extern tnf_tag_data_t *tnf_file_header_tag_data;
extern tnf_tag_data_t *tnf_block_header_tag_data;
/*
* Exported slots
*/
extern tnf_tag_data_t **tnf_array_slots[];
/*
* Exported properties
*/
extern tnf_tag_data_t ***tnf_no_properties;
extern tnf_tag_data_t ***tnf_scalar_properties;
extern tnf_tag_data_t ***tnf_array_properties;
extern tnf_tag_data_t ***tnf_derived_properties;
extern tnf_tag_data_t ***tnf_struct_properties;
extern tnf_tag_data_t ***tnf_type_properties;
/*
* Binary layout of standard array header
*/
typedef struct {
#define ARRAY_HDR_SIZE sizeof (tnf_array_header_t)
/*
* Binary layouts of TNF tags
*/
typedef struct {
typedef struct {
typedef struct {
typedef struct {
typedef struct {
/*
* Data encoders
*/
tnf_tag_data_t **,
tnf_tag_data_t *);
tnf_tag_data_t ***,
tnf_tag_data_t *);
tnf_tag_data_t ****,
tnf_tag_data_t *);
char **,
tnf_tag_data_t *);
/*
* Tag descriptors
*/
#ifdef _KERNEL
/*
* Tag pointer initializers, called when driver loaded to snap all
* tag data pointers.
*/
extern void tnf_tag_core_init(void); /* initialize core tags */
extern void tnf_tag_trace_init(void); /* initialize trace tags */
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _TNF_TYPES_H */