1178479Sjb/* 2178479Sjb * CDDL HEADER START 3178479Sjb * 4178479Sjb * The contents of this file are subject to the terms of the 5178479Sjb * Common Development and Distribution License, Version 1.0 only 6178479Sjb * (the "License"). You may not use this file except in compliance 7178479Sjb * with the License. 8178479Sjb * 9178479Sjb * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10178479Sjb * or http://www.opensolaris.org/os/licensing. 11178479Sjb * See the License for the specific language governing permissions 12178479Sjb * and limitations under the License. 13178479Sjb * 14178479Sjb * When distributing Covered Code, include this CDDL HEADER in each 15178479Sjb * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16178479Sjb * If applicable, add the following below this CDDL HEADER, with the 17178479Sjb * fields enclosed by brackets "[]" replaced with your own identifying 18178479Sjb * information: Portions Copyright [yyyy] [name of copyright owner] 19178479Sjb * 20178479Sjb * CDDL HEADER END 21178479Sjb */ 22178479Sjb/* 23178479Sjb * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24178479Sjb * Use is subject to license terms. 25178479Sjb */ 26178479Sjb 27178479Sjb#ifndef _DT_INTTAB_H 28178479Sjb#define _DT_INTTAB_H 29178479Sjb 30178479Sjb#pragma ident "%Z%%M% %I% %E% SMI" 31178479Sjb 32178479Sjb#include <dtrace.h> 33178479Sjb 34178479Sjb#ifdef __cplusplus 35178479Sjbextern "C" { 36178479Sjb#endif 37178479Sjb 38178479Sjbtypedef struct dt_inthash { 39178479Sjb struct dt_inthash *inh_hash; /* next dt_inthash in hash chain */ 40178479Sjb struct dt_inthash *inh_next; /* next dt_inthash in output table */ 41178479Sjb uint64_t inh_value; /* value associated with this element */ 42178479Sjb uint_t inh_index; /* index associated with this element */ 43178479Sjb uint_t inh_flags; /* flags (see below) */ 44178479Sjb} dt_inthash_t; 45178479Sjb 46178479Sjbtypedef struct dt_inttab { 47178479Sjb dtrace_hdl_t *int_hdl; /* pointer back to library handle */ 48178479Sjb dt_inthash_t **int_hash; /* array of hash buckets */ 49178479Sjb uint_t int_hashlen; /* size of hash bucket array */ 50178479Sjb uint_t int_nelems; /* number of elements hashed */ 51178479Sjb dt_inthash_t *int_head; /* head of table in index order */ 52178479Sjb dt_inthash_t *int_tail; /* tail of table in index order */ 53178479Sjb uint_t int_index; /* next index to hand out */ 54178479Sjb} dt_inttab_t; 55178479Sjb 56178479Sjb#define DT_INT_PRIVATE 0 /* only a single ref for this entry */ 57178479Sjb#define DT_INT_SHARED 1 /* multiple refs can share entry */ 58178479Sjb 59178479Sjbextern dt_inttab_t *dt_inttab_create(dtrace_hdl_t *); 60178479Sjbextern void dt_inttab_destroy(dt_inttab_t *); 61178479Sjbextern int dt_inttab_insert(dt_inttab_t *, uint64_t, uint_t); 62178479Sjbextern uint_t dt_inttab_size(const dt_inttab_t *); 63178479Sjbextern void dt_inttab_write(const dt_inttab_t *, uint64_t *); 64178479Sjb 65178479Sjb#ifdef __cplusplus 66178479Sjb} 67178479Sjb#endif 68178479Sjb 69178479Sjb#endif /* _DT_INTTAB_H */ 70