17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 22*78b6ed60Scraigm 237c478bd9Sstevel@tonic-gate /* 24*78b6ed60Scraigm * Copyright 1994 Sun Microsystems, Inc. All rights reserved. 25*78b6ed60Scraigm * Use is subject to license terms. 267c478bd9Sstevel@tonic-gate */ 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate #ifndef _LIBTNF_H 297c478bd9Sstevel@tonic-gate #define _LIBTNF_H 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #include <stdio.h> 347c478bd9Sstevel@tonic-gate #include <stdlib.h> 357c478bd9Sstevel@tonic-gate #include <stdarg.h> 367c478bd9Sstevel@tonic-gate #include <string.h> 377c478bd9Sstevel@tonic-gate #include <unistd.h> 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #include "tnf/tnf.h" 407c478bd9Sstevel@tonic-gate #include "machlibtnf.h" 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #ifdef __cplusplus 437c478bd9Sstevel@tonic-gate extern "C" { 447c478bd9Sstevel@tonic-gate #endif 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate /* 477c478bd9Sstevel@tonic-gate * Info flags 487c478bd9Sstevel@tonic-gate */ 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate typedef unsigned long tag_props_t; 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate #define TAG_PROP_INLINE (1<<0) 537c478bd9Sstevel@tonic-gate #define TAG_PROP_TAGGED (1<<1) 547c478bd9Sstevel@tonic-gate #define TAG_PROP_SCALAR (1<<2) 557c478bd9Sstevel@tonic-gate #define TAG_PROP_DERIVED (1<<3) 567c478bd9Sstevel@tonic-gate #define TAG_PROP_ARRAY (1<<4) 577c478bd9Sstevel@tonic-gate #define TAG_PROP_STRING (1<<5) 587c478bd9Sstevel@tonic-gate #define TAG_PROP_STRUCT (1<<6) 597c478bd9Sstevel@tonic-gate #define TAG_PROP_TYPE (1<<7) 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate /* 627c478bd9Sstevel@tonic-gate * Type tag information 637c478bd9Sstevel@tonic-gate */ 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate struct taginfo { 667c478bd9Sstevel@tonic-gate struct taginfo *link; /* hash link */ 677c478bd9Sstevel@tonic-gate #define INFO_MEMBER_0 link 687c478bd9Sstevel@tonic-gate TNF *tnf; /* TNF handle */ 697c478bd9Sstevel@tonic-gate tnf_ref32_t *tag; /* tag record in file */ 707c478bd9Sstevel@tonic-gate char *name; /* chars in file */ 717c478bd9Sstevel@tonic-gate tnf_kind_t kind; /* data classification */ 727c478bd9Sstevel@tonic-gate tag_props_t props; /* tag property flags */ 737c478bd9Sstevel@tonic-gate struct taginfo *meta; /* meta tag info */ 747c478bd9Sstevel@tonic-gate struct taginfo *base; /* last derived base or elttype */ 757c478bd9Sstevel@tonic-gate size_t size; /* storage size or -1 */ 767c478bd9Sstevel@tonic-gate size_t align; /* slot alignment */ 777c478bd9Sstevel@tonic-gate size_t hdrsize; /* array header size */ 787c478bd9Sstevel@tonic-gate struct slotinfo { /* aggregate slot information */ 797c478bd9Sstevel@tonic-gate unsigned slot_count; 807c478bd9Sstevel@tonic-gate /* Embedded array */ 817c478bd9Sstevel@tonic-gate struct slot { 827c478bd9Sstevel@tonic-gate struct taginfo *slot_type; 837c478bd9Sstevel@tonic-gate char *slot_name; 847c478bd9Sstevel@tonic-gate unsigned slot_offset; 857c478bd9Sstevel@tonic-gate } slots[1]; 867c478bd9Sstevel@tonic-gate } *slotinfo; 877c478bd9Sstevel@tonic-gate }; 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate #define INFO_PROP(ip, p) ((ip)->props & (p)) 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate #define INFO_INLINE(ip) INFO_PROP(ip, TAG_PROP_INLINE) 927c478bd9Sstevel@tonic-gate #define INFO_TAGGED(ip) INFO_PROP(ip, TAG_PROP_TAGGED) 937c478bd9Sstevel@tonic-gate #define INFO_SCALAR(ip) INFO_PROP(ip, TAG_PROP_SCALAR) 947c478bd9Sstevel@tonic-gate #define INFO_DERIVED(ip) INFO_PROP(ip, TAG_PROP_DERIVED) 957c478bd9Sstevel@tonic-gate #define INFO_ARRAY(ip) INFO_PROP(ip, TAG_PROP_ARRAY) 967c478bd9Sstevel@tonic-gate #define INFO_STRING(ip) INFO_PROP(ip, TAG_PROP_STRING) 977c478bd9Sstevel@tonic-gate #define INFO_STRUCT(ip) INFO_PROP(ip, TAG_PROP_STRUCT) 987c478bd9Sstevel@tonic-gate #define INFO_TYPE(ip) INFO_PROP(ip, TAG_PROP_TYPE) 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate #define INFO_REF_SIZE(ip) (INFO_TAGGED(ip)? 4: (ip)->size) 1017c478bd9Sstevel@tonic-gate #define INFO_ELEMENT_SIZE(ip) INFO_REF_SIZE(ip) 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate /* Alignment is stored for all but records and derivations thereof */ 1047c478bd9Sstevel@tonic-gate #define INFO_ALIGN(ip) (INFO_TAGGED(ip)? 4: (ip)->align) 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gate #define ALIGN(n, a) \ 1077c478bd9Sstevel@tonic-gate (((a) == 0) ? (n) : (((n) + (a) - 1) & ~((a) - 1))) 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate /* 1107c478bd9Sstevel@tonic-gate * Tag lookup 1117c478bd9Sstevel@tonic-gate */ 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gate /* Number of directory entries */ 1147c478bd9Sstevel@tonic-gate #define TAGDIRCNT(x) ((x) / sizeof (tnf_ref32_t)) 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate /* Number of hash table buckets */ 1177c478bd9Sstevel@tonic-gate #define TAGTABCNT 1024 1187c478bd9Sstevel@tonic-gate #define TAGTABMASK (TAGTABCNT-1) 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate /* A tag is at least 32 bytes; with strings & props, assume 128 bytes */ 1217c478bd9Sstevel@tonic-gate #define TAGTABSHIFT 7 1227c478bd9Sstevel@tonic-gate 1237c478bd9Sstevel@tonic-gate /* Hash tag by bits 17:7 of offset within data area */ 1247c478bd9Sstevel@tonic-gate #define TAGOFF(tnf, p) ((unsigned)((caddr_t)(p) - (tnf)->data_start)) 1257c478bd9Sstevel@tonic-gate #define TAGHASH(tnf, p) ((TAGOFF(tnf, p) >> TAGTABSHIFT) & TAGTABMASK) 1267c478bd9Sstevel@tonic-gate 1277c478bd9Sstevel@tonic-gate /* 1287c478bd9Sstevel@tonic-gate * TNF handle 1297c478bd9Sstevel@tonic-gate */ 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate struct TNF { 1327c478bd9Sstevel@tonic-gate /* 1337c478bd9Sstevel@tonic-gate * Client-supplied bounds 1347c478bd9Sstevel@tonic-gate */ 1357c478bd9Sstevel@tonic-gate caddr_t file_start; 1367c478bd9Sstevel@tonic-gate size_t file_size; 1377c478bd9Sstevel@tonic-gate caddr_t file_end; /* file_start + file_size */ 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate /* 1407c478bd9Sstevel@tonic-gate * File information 1417c478bd9Sstevel@tonic-gate */ 1427c478bd9Sstevel@tonic-gate unsigned file_magic; /* magic number of file */ 1437c478bd9Sstevel@tonic-gate int file_native; /* endian flag */ 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate /* file header */ 1467c478bd9Sstevel@tonic-gate tnf_ref32_t *file_header; /* first record in file */ 1477c478bd9Sstevel@tonic-gate size_t block_size; /* size of a block */ 1487c478bd9Sstevel@tonic-gate size_t directory_size; /* size of directory area */ 1497c478bd9Sstevel@tonic-gate 1507c478bd9Sstevel@tonic-gate unsigned block_count; /* number of data blocks */ 1517c478bd9Sstevel@tonic-gate caddr_t data_start; /* file_start + 64KB */ 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate unsigned generation_shift; 1547c478bd9Sstevel@tonic-gate unsigned address_mask; 1557c478bd9Sstevel@tonic-gate 1567c478bd9Sstevel@tonic-gate /* block headers */ 1577c478bd9Sstevel@tonic-gate unsigned block_shift; /* index -> bhdr */ 1587c478bd9Sstevel@tonic-gate unsigned block_mask; /* ptr -> bhdr */ 1597c478bd9Sstevel@tonic-gate unsigned block_generation_offset; 1607c478bd9Sstevel@tonic-gate unsigned block_bytes_valid_offset; 1617c478bd9Sstevel@tonic-gate 1627c478bd9Sstevel@tonic-gate /* root tag */ 1637c478bd9Sstevel@tonic-gate tnf_ref32_t *root_tag; 1647c478bd9Sstevel@tonic-gate 1657c478bd9Sstevel@tonic-gate /* important taginfo */ 1667c478bd9Sstevel@tonic-gate struct taginfo *file_header_info; 1677c478bd9Sstevel@tonic-gate struct taginfo *block_header_info; 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gate /* tag lookup tables */ 1707c478bd9Sstevel@tonic-gate struct taginfo **tag_table; /* by address */ 1717c478bd9Sstevel@tonic-gate struct taginfo **tag_directory; /* by index */ 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate }; 1747c478bd9Sstevel@tonic-gate 1757c478bd9Sstevel@tonic-gate /* 1767c478bd9Sstevel@tonic-gate * File operations for reading integers 1777c478bd9Sstevel@tonic-gate */ 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gate #define _GET_UINT32(tnf, ptr) \ 1807c478bd9Sstevel@tonic-gate ((tnf)->file_native ? \ 1817c478bd9Sstevel@tonic-gate *(tnf_uint32_t *)(ptr) : \ 1827c478bd9Sstevel@tonic-gate _tnf_swap32(*(tnf_uint32_t *)(ptr))) 1837c478bd9Sstevel@tonic-gate 1847c478bd9Sstevel@tonic-gate #define _GET_INT32(tnf, ptr) \ 1857c478bd9Sstevel@tonic-gate ((tnf_int32_t)_GET_UINT32(tnf, ptr)) 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate #define _GET_UINT16(tnf, ptr) \ 1887c478bd9Sstevel@tonic-gate ((tnf)->file_native ? \ 1897c478bd9Sstevel@tonic-gate *(tnf_uint16_t *)(ptr) : \ 1907c478bd9Sstevel@tonic-gate _tnf_swap16(*(tnf_uint16_t *)(ptr))) 1917c478bd9Sstevel@tonic-gate 1927c478bd9Sstevel@tonic-gate #define _GET_INT16(tnf, ptr) \ 1937c478bd9Sstevel@tonic-gate ((tnf_int16_t)_GET_UINT16(tnf, ptr)) 1947c478bd9Sstevel@tonic-gate 1957c478bd9Sstevel@tonic-gate /* 1967c478bd9Sstevel@tonic-gate * TNF reference-chasing operations 1977c478bd9Sstevel@tonic-gate */ 1987c478bd9Sstevel@tonic-gate 1997c478bd9Sstevel@tonic-gate tnf_ref32_t * _tnf_get_ref32(TNF *, tnf_ref32_t *); 2007c478bd9Sstevel@tonic-gate tnf_ref32_t * _tnf_get_ref16(TNF *, tnf_ref32_t *); 2017c478bd9Sstevel@tonic-gate 2027c478bd9Sstevel@tonic-gate #define _GET_REF32(tnf, ptr) _tnf_get_ref32(tnf, ptr) 2037c478bd9Sstevel@tonic-gate #define _GET_REF16(tnf, ptr) _tnf_get_ref16(tnf, ptr) 2047c478bd9Sstevel@tonic-gate 2057c478bd9Sstevel@tonic-gate /* 2067c478bd9Sstevel@tonic-gate * Block header record operations 2077c478bd9Sstevel@tonic-gate * Only applicable in data area 2087c478bd9Sstevel@tonic-gate */ 2097c478bd9Sstevel@tonic-gate 2107c478bd9Sstevel@tonic-gate #define _GET_BLOCK(tnf, ptr) \ 2117c478bd9Sstevel@tonic-gate ((tnf_ref32_t *)((unsigned)(ptr) & (tnf)->block_mask)) 2127c478bd9Sstevel@tonic-gate 2137c478bd9Sstevel@tonic-gate #define _GET_BLOCK_INDEX(tnf, bhdr) \ 2147c478bd9Sstevel@tonic-gate (((caddr_t)(bhdr) - (tnf)->data_start) >> (tnf)->block_shift) 2157c478bd9Sstevel@tonic-gate 2167c478bd9Sstevel@tonic-gate #define _GET_INDEX_BLOCK(tnf, index) \ 2177c478bd9Sstevel@tonic-gate ((tnf_ref32_t *)((tnf)->data_start + ((index) << (tnf)->block_shift))) 2187c478bd9Sstevel@tonic-gate 2197c478bd9Sstevel@tonic-gate #define _GET_BLOCK_GENERATION(tnf, bhdr) \ 2207c478bd9Sstevel@tonic-gate _GET_UINT32(tnf, (caddr_t)bhdr + tnf->block_generation_offset) 2217c478bd9Sstevel@tonic-gate 2227c478bd9Sstevel@tonic-gate #define _GET_BLOCK_BYTES_VALID(tnf, bhdr) \ 2237c478bd9Sstevel@tonic-gate (!(bhdr) ? 0 : _GET_UINT16(tnf, (caddr_t)bhdr + \ 2247c478bd9Sstevel@tonic-gate tnf->block_bytes_valid_offset)) 2257c478bd9Sstevel@tonic-gate 2267c478bd9Sstevel@tonic-gate /* 2277c478bd9Sstevel@tonic-gate * Datum operations 2287c478bd9Sstevel@tonic-gate */ 2297c478bd9Sstevel@tonic-gate 2307c478bd9Sstevel@tonic-gate #ifndef _DATUM_MACROS 2317c478bd9Sstevel@tonic-gate 2327c478bd9Sstevel@tonic-gate tnf_datum_t _tnf_datum(struct taginfo *, caddr_t); 2337c478bd9Sstevel@tonic-gate struct taginfo * _tnf_datum_info(tnf_datum_t); 2347c478bd9Sstevel@tonic-gate caddr_t _tnf_datum_val(tnf_datum_t); 2357c478bd9Sstevel@tonic-gate 2367c478bd9Sstevel@tonic-gate #define DATUM(x, y) _tnf_datum(x, y) 2377c478bd9Sstevel@tonic-gate #define DATUM_INFO(x) _tnf_datum_info(x) 2387c478bd9Sstevel@tonic-gate #define DATUM_VAL(x) _tnf_datum_val(x) 2397c478bd9Sstevel@tonic-gate 2407c478bd9Sstevel@tonic-gate #else /* _DATUM_MACROS */ 2417c478bd9Sstevel@tonic-gate 2427c478bd9Sstevel@tonic-gate /* Some degree of type safety: */ 243*78b6ed60Scraigm #define DATUM(x, y) _DATUM((uintptr_t)&(x)->INFO_MEMBER_0, y) 2447c478bd9Sstevel@tonic-gate #define DATUM_INFO(d) ((struct taginfo *)_DATUM_HI(d)) 2457c478bd9Sstevel@tonic-gate #define DATUM_VAL(d) ((caddr_t)_DATUM_LO(d)) 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate #endif /* _DATUM_MACROS */ 2487c478bd9Sstevel@tonic-gate 2497c478bd9Sstevel@tonic-gate #define _DATUM(hi, lo) (((unsigned long long)(hi) << 32) | (unsigned)(lo)) 2507c478bd9Sstevel@tonic-gate #define _DATUM_HI(x) ((unsigned) ((x) >> 32)) 2517c478bd9Sstevel@tonic-gate #define _DATUM_LO(x) ((unsigned) (x)) 2527c478bd9Sstevel@tonic-gate 2537c478bd9Sstevel@tonic-gate #define DATUM_RECORD(x) \ 2547c478bd9Sstevel@tonic-gate ((tnf_ref32_t *)DATUM_VAL(x)) 2557c478bd9Sstevel@tonic-gate 2567c478bd9Sstevel@tonic-gate #define RECORD_DATUM(tnf, rec) \ 2577c478bd9Sstevel@tonic-gate DATUM(_tnf_record_info(tnf, rec), (caddr_t)rec) 2587c478bd9Sstevel@tonic-gate 2597c478bd9Sstevel@tonic-gate #define DATUM_TNF(x) DATUM_INFO(x)->tnf 2607c478bd9Sstevel@tonic-gate #define DATUM_TAG(x) DATUM_INFO(x)->tag 2617c478bd9Sstevel@tonic-gate 2627c478bd9Sstevel@tonic-gate /* 2637c478bd9Sstevel@tonic-gate * Type checking operations 2647c478bd9Sstevel@tonic-gate */ 2657c478bd9Sstevel@tonic-gate 2667c478bd9Sstevel@tonic-gate void _tnf_check_datum(tnf_datum_t); 2677c478bd9Sstevel@tonic-gate #define CHECK_DATUM(x) _tnf_check_datum(x) 2687c478bd9Sstevel@tonic-gate 2697c478bd9Sstevel@tonic-gate void _tnf_check_record(tnf_datum_t); 2707c478bd9Sstevel@tonic-gate #define CHECK_RECORD(x) _tnf_check_record(x) 2717c478bd9Sstevel@tonic-gate 2727c478bd9Sstevel@tonic-gate void _tnf_check_slots(tnf_datum_t); 2737c478bd9Sstevel@tonic-gate #define CHECK_SLOTS(x) _tnf_check_slots(x) 2747c478bd9Sstevel@tonic-gate 2757c478bd9Sstevel@tonic-gate void _tnf_check_array(tnf_datum_t); 2767c478bd9Sstevel@tonic-gate #define CHECK_ARRAY(x) _tnf_check_array(x) 2777c478bd9Sstevel@tonic-gate 2787c478bd9Sstevel@tonic-gate void _tnf_check_type(tnf_datum_t); 2797c478bd9Sstevel@tonic-gate #define CHECK_TYPE(x) _tnf_check_type(x) 2807c478bd9Sstevel@tonic-gate 2817c478bd9Sstevel@tonic-gate /* 2827c478bd9Sstevel@tonic-gate * Operations based on ABI layouts and bootstrap assumptions 2837c478bd9Sstevel@tonic-gate */ 2847c478bd9Sstevel@tonic-gate 2857c478bd9Sstevel@tonic-gate tnf_ref32_t * _tnf_get_tag(TNF *, tnf_ref32_t *); 2867c478bd9Sstevel@tonic-gate tnf_ref32_t * _tnf_get_tag_arg(TNF *, tnf_ref32_t *); 2877c478bd9Sstevel@tonic-gate size_t _tnf_get_self_size(TNF *, tnf_ref32_t *); 2887c478bd9Sstevel@tonic-gate unsigned _tnf_get_element_count(TNF *, tnf_ref32_t *, unsigned); 2897c478bd9Sstevel@tonic-gate caddr_t _tnf_get_elements(TNF *, tnf_ref32_t *); 2907c478bd9Sstevel@tonic-gate char * _tnf_get_chars(TNF *, tnf_ref32_t *); 2917c478bd9Sstevel@tonic-gate char * _tnf_get_name(TNF *, tnf_ref32_t *); 2927c478bd9Sstevel@tonic-gate tnf_ref32_t * _tnf_get_properties(TNF *, tnf_ref32_t *); 2937c478bd9Sstevel@tonic-gate tnf_ref32_t * _tnf_get_slot_types(TNF *, tnf_ref32_t *); 2947c478bd9Sstevel@tonic-gate size_t _tnf_get_header_size(TNF *, tnf_ref32_t *); 2957c478bd9Sstevel@tonic-gate tnf_ref32_t * _tnf_get_derived_base(TNF *, tnf_ref32_t *); 2967c478bd9Sstevel@tonic-gate 2977c478bd9Sstevel@tonic-gate tnf_ref32_t * _tnf_get_root_tag(TNF *, tnf_ref32_t *); 2987c478bd9Sstevel@tonic-gate tnf_ref32_t * _tnf_get_property(TNF *, tnf_ref32_t *, char *); 2997c478bd9Sstevel@tonic-gate tnf_ref32_t * _tnf_get_element_named(TNF *, tnf_ref32_t *, char *); 3007c478bd9Sstevel@tonic-gate tnf_ref32_t * _tnf_get_base_tag(TNF *, tnf_ref32_t *); 3017c478bd9Sstevel@tonic-gate 3027c478bd9Sstevel@tonic-gate size_t _tnf_get_storage_size(TNF *, tnf_ref32_t *); 3037c478bd9Sstevel@tonic-gate size_t _tnf_get_ref_size(TNF *, tnf_ref32_t *); 3047c478bd9Sstevel@tonic-gate 3057c478bd9Sstevel@tonic-gate unsigned _tnf_get_align(TNF *, tnf_ref32_t *); 3067c478bd9Sstevel@tonic-gate 3077c478bd9Sstevel@tonic-gate caddr_t _tnf_get_slot_typed(TNF *, tnf_ref32_t *, char *); 3087c478bd9Sstevel@tonic-gate caddr_t _tnf_get_slot_named(TNF *, tnf_ref32_t *, char *); 3097c478bd9Sstevel@tonic-gate 3107c478bd9Sstevel@tonic-gate #define HAS_PROPERTY(tnf, tag, name) \ 3117c478bd9Sstevel@tonic-gate (_tnf_get_property(tnf, tag, name) != TNF_NULL) 3127c478bd9Sstevel@tonic-gate 3137c478bd9Sstevel@tonic-gate /* 3147c478bd9Sstevel@tonic-gate * Call the installed error handler with installed arg 3157c478bd9Sstevel@tonic-gate */ 3167c478bd9Sstevel@tonic-gate 3177c478bd9Sstevel@tonic-gate void _tnf_error(TNF *, tnf_errcode_t); 3187c478bd9Sstevel@tonic-gate 3197c478bd9Sstevel@tonic-gate /* 3207c478bd9Sstevel@tonic-gate * Tag lookup operations 3217c478bd9Sstevel@tonic-gate */ 3227c478bd9Sstevel@tonic-gate 3237c478bd9Sstevel@tonic-gate struct taginfo * _tnf_get_info(TNF *, tnf_ref32_t *); 3247c478bd9Sstevel@tonic-gate struct taginfo * _tnf_record_info(TNF *, tnf_ref32_t *); 3257c478bd9Sstevel@tonic-gate 3267c478bd9Sstevel@tonic-gate tnf_errcode_t _tnf_init_tags(TNF *); 3277c478bd9Sstevel@tonic-gate tnf_errcode_t _tnf_fini_tags(TNF *); 3287c478bd9Sstevel@tonic-gate 3297c478bd9Sstevel@tonic-gate /* 3307c478bd9Sstevel@tonic-gate * Classify a tag into its props and data kind 3317c478bd9Sstevel@tonic-gate */ 3327c478bd9Sstevel@tonic-gate 3337c478bd9Sstevel@tonic-gate tag_props_t _tnf_get_props(TNF *, tnf_ref32_t *); 3347c478bd9Sstevel@tonic-gate tnf_kind_t _tnf_get_kind(TNF *, tnf_ref32_t *); 3357c478bd9Sstevel@tonic-gate 3367c478bd9Sstevel@tonic-gate caddr_t _tnf_get_member(TNF *, caddr_t, struct taginfo *); 3377c478bd9Sstevel@tonic-gate 3387c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3397c478bd9Sstevel@tonic-gate } 3407c478bd9Sstevel@tonic-gate #endif 3417c478bd9Sstevel@tonic-gate 3427c478bd9Sstevel@tonic-gate #endif /* _LIBTNF_H */ 343