4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1994, by Sun Microsytems, Inc.
26 #pragma ident "%Z%%M% %I% %E% SMI"
31 * All types are struct records
35 _tnf_check_type(tnf_datum_t datum
)
40 if (!INFO_TYPE(DATUM_INFO(datum
)))
41 _tnf_error(DATUM_TNF(datum
), TNF_ERR_TYPEMISMATCH
);
45 * Get data kind of a type record
49 tnf_type_get_kind(tnf_datum_t datum
)
55 /* Note: DATUM_RECORD(), not DATUM_TAG() */
56 /* LINTED pointer cast may result in improper alignment */
57 info
= _tnf_get_info(DATUM_TNF(datum
), DATUM_RECORD(datum
));
62 * Retrieve type name for datum type record
66 tnf_type_get_name(tnf_datum_t datum
)
69 /* XXX Dispatch to ABI routine; faster than taginfo lookup? */
70 /* LINTED pointer cast may result in improper alignment */
71 return (_tnf_get_name(DATUM_TNF(datum
), DATUM_RECORD(datum
)));
75 * Fetch size member of info for datum type record
79 tnf_type_get_size(tnf_datum_t datum
)
85 /* Note: DATUM_RECORD(), not DATUM_TAG() */
86 /* LINTED pointer cast may result in improper alignment */
87 info
= _tnf_get_info(DATUM_TNF(datum
), DATUM_RECORD(datum
));
90 /* XXX All arrays are self-sized */
97 * Get the base type of a type
101 tnf_type_get_base(tnf_datum_t datum
)
103 struct taginfo
*info
;
107 /* Note: DATUM_RECORD(), not DATUM_TAG() */
108 /* LINTED pointer cast may result in improper alignment */
109 info
= _tnf_get_info(DATUM_TNF(datum
), DATUM_RECORD(datum
));
111 if (INFO_DERIVED(info
))
112 return (DATUM(info
->base
->meta
, (caddr_t
)info
->base
->tag
));
118 * If type record has named property, return a datum for it
122 tnf_type_get_property(tnf_datum_t datum
, char *name
)
124 tnf_ref32_t
*property
;
128 /* Note: DATUM_RECORD(), not DATUM_TAG() */
129 property
= _tnf_get_property(DATUM_TNF(datum
),
130 /* LINTED pointer cast may result in improper alignment */
131 DATUM_RECORD(datum
), name
);
133 if (property
== TNF_NULL
)
134 return (TNF_DATUM_NULL
);
136 return (RECORD_DATUM(DATUM_TNF(datum
), property
));