/*
* 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, by Sun Microsytems, Inc.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "libtnf.h"
/*
*
*/
static struct taginfo *
static struct taginfo *
static struct taginfo *
static struct taginfo *
static struct taginfo *
/*
* Allocate tag table and directory
*/
{
== NULL)
return (TNF_ERR_ALLOCFAIL);
sizeof (struct taginfo *)))
== NULL)
return (TNF_ERR_ALLOCFAIL);
return (TNF_ERR_NONE);
}
/*
* Deallocate all taginfos and tables associated with TNF handle
*/
{
int i;
/*
* free taginfos
*/
for (i = 0; i < TAGTABCNT; i++) {
while (info) {
/* remember link */
/* free slot information */
/* free taginfo */
/* next in hash chain */
}
}
/*
* free the tables
*/
return (TNF_ERR_NONE);
}
/*
* Get info for supplied tag
*/
struct taginfo *
{
return (info); /* found it */
/* default: not there, create */
}
/*
* Get info for supplied record
* Use fast lookup, if possible
*/
struct taginfo *
{
index = 0;
if (TNF_REF32_IS_PAIR(ref32)) {
if (TNF_TAG16_IS_ABS(tag16))
}
if (index) {
return (info);
else { /* not in directory yet */
/* enter into tag directory */
}
}
/* default: not referenced via index */
}
/*
* Add a new taginfo for tag
*/
static struct taginfo *
{
unsigned hash;
/* Initialize members */
/* Add it to table */
/* Ensure meta info is available */
/*
* Initialize info
* Derived must be first clause due to property inheritance
*/
if (INFO_DERIVED(info))
else if (INFO_STRUCT(info))
else if (INFO_ARRAY(info))
else if (INFO_SCALAR(info))
else /* XXX assume abstract type */
}
/*
* Initialize info for an abstract tag
*/
static struct taginfo *
/* ARGSUSED */
{
return (info);
}
/*
* Initialize info for a derived tag
*/
static struct taginfo *
{
if (!INFO_DERIVED(info))
/* Ensure ultimate base information is available */
return (info);
}
/*
* Initialize info for a scalar tag
*/
static struct taginfo *
/* ARGSUSED */
{
if ((!INFO_SCALAR(info)) ||
/* XXX alignment already done */
return (info);
}
/*
* Initialize info for a struct tag
*/
static struct taginfo *
{
if ((!INFO_STRUCT(info)) ||
/* Get slot information */
return (info);
}
/*
* Initialize info for an array tag
*/
static struct taginfo *
{
int defeat;
if ((!INFO_ARRAY(info)) ||
/* XXX special-case abstract array tag */
/* Require all arrays to be self-sized records */
if (!defeat)
/* Store array header size */
/* XXX Temporary sanity check */
if (!defeat)
/* Get slot information */
/* Get info for element type */
/* LINTED pointer cast may result in improper alignment */
/* XXX tnf_array has element_type == NULL */
return (info);
}
/*
* Initialize slot information for aggregate tag
*/
static void
{
slot_types = (tnf_ref32_t *)
/* LINTED pointer cast may result in improper alignment */
slot_names = (tnf_ref32_t *)
/* LINTED pointer cast may result in improper alignment */
/* abstract tags have no slots */
if (slot_types == TNF_NULL)
return;
/* LINTED pointer cast may result in improper alignment */
/* LINTED pointer cast may result in improper alignment */
offset = 0;
for (i = 0; i < count; i++) {
/* XXX No checks here for missing tags */
/* Resolve slot tag into taginfo */
/* Get cached reference size */
/* Get cached alignment */
/* Adjust offset to account for alignment, if needed */
/* Bump offset by reference size */
}
}