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