dt_inttab.h revision 2
2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _DT_INTTAB_H
2N/A#define _DT_INTTAB_H
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#include <dtrace.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/Atypedef struct dt_inthash {
2N/A struct dt_inthash *inh_hash; /* next dt_inthash in hash chain */
2N/A struct dt_inthash *inh_next; /* next dt_inthash in output table */
2N/A uint64_t inh_value; /* value associated with this element */
2N/A uint_t inh_index; /* index associated with this element */
2N/A uint_t inh_flags; /* flags (see below) */
2N/A} dt_inthash_t;
2N/A
2N/Atypedef struct dt_inttab {
2N/A dtrace_hdl_t *int_hdl; /* pointer back to library handle */
2N/A dt_inthash_t **int_hash; /* array of hash buckets */
2N/A uint_t int_hashlen; /* size of hash bucket array */
2N/A uint_t int_nelems; /* number of elements hashed */
2N/A dt_inthash_t *int_head; /* head of table in index order */
2N/A dt_inthash_t *int_tail; /* tail of table in index order */
2N/A uint_t int_index; /* next index to hand out */
2N/A} dt_inttab_t;
2N/A
2N/A#define DT_INT_PRIVATE 0 /* only a single ref for this entry */
2N/A#define DT_INT_SHARED 1 /* multiple refs can share entry */
2N/A
2N/Aextern dt_inttab_t *dt_inttab_create(dtrace_hdl_t *);
2N/Aextern void dt_inttab_destroy(dt_inttab_t *);
2N/Aextern int dt_inttab_insert(dt_inttab_t *, uint64_t, uint_t);
2N/Aextern uint_t dt_inttab_size(const dt_inttab_t *);
2N/Aextern void dt_inttab_write(const dt_inttab_t *, uint64_t *);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _DT_INTTAB_H */