/*
* 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 1994 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _LIBTNF_H
#define _LIBTNF_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include "machlibtnf.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Info flags
*/
typedef unsigned long tag_props_t;
/*
* Type tag information
*/
struct taginfo {
unsigned slot_count;
/* Embedded array */
struct slot {
char *slot_name;
unsigned slot_offset;
} *slotinfo;
};
/* Alignment is stored for all but records and derivations thereof */
#define ALIGN(n, a) \
(((a) == 0) ? (n) : (((n) + (a) - 1) & ~((a) - 1)))
/*
* Tag lookup
*/
/* Number of directory entries */
/* Number of hash table buckets */
/* A tag is at least 32 bytes; with strings & props, assume 128 bytes */
/* Hash tag by bits 17:7 of offset within data area */
/*
* TNF handle
*/
struct TNF {
/*
* Client-supplied bounds
*/
/*
* File information
*/
/* file header */
unsigned generation_shift;
unsigned address_mask;
/* block headers */
unsigned block_generation_offset;
unsigned block_bytes_valid_offset;
/* root tag */
/* important taginfo */
/* tag lookup tables */
};
/*
* File operations for reading integers
*/
((tnf)->file_native ? \
*(tnf_uint32_t *)(ptr) : \
((tnf)->file_native ? \
*(tnf_uint16_t *)(ptr) : \
/*
* TNF reference-chasing operations
*/
/*
* Block header record operations
* Only applicable in data area
*/
/*
* Datum operations
*/
#ifndef _DATUM_MACROS
#else /* _DATUM_MACROS */
/* Some degree of type safety: */
#endif /* _DATUM_MACROS */
#define _DATUM_LO(x) ((unsigned) (x))
#define DATUM_RECORD(x) \
((tnf_ref32_t *)DATUM_VAL(x))
/*
* Type checking operations
*/
void _tnf_check_datum(tnf_datum_t);
void _tnf_check_record(tnf_datum_t);
void _tnf_check_slots(tnf_datum_t);
void _tnf_check_array(tnf_datum_t);
void _tnf_check_type(tnf_datum_t);
/*
* Operations based on ABI layouts and bootstrap assumptions
*/
/*
* Call the installed error handler with installed arg
*/
/*
* Tag lookup operations
*/
/*
* Classify a tag into its props and data kind
*/
#ifdef __cplusplus
}
#endif
#endif /* _LIBTNF_H */