Path: blob/main/cddl/contrib/opensolaris/lib/libdtrace/common/dt_inttab.h
39562 views
/*1* CDDL HEADER START2*3* The contents of this file are subject to the terms of the4* Common Development and Distribution License, Version 1.0 only5* (the "License"). You may not use this file except in compliance6* with the License.7*8* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE9* or http://www.opensolaris.org/os/licensing.10* See the License for the specific language governing permissions11* and limitations under the License.12*13* When distributing Covered Code, include this CDDL HEADER in each14* file and include the License file at usr/src/OPENSOLARIS.LICENSE.15* If applicable, add the following below this CDDL HEADER, with the16* fields enclosed by brackets "[]" replaced with your own identifying17* information: Portions Copyright [yyyy] [name of copyright owner]18*19* CDDL HEADER END20*/21/*22* Copyright 2004 Sun Microsystems, Inc. All rights reserved.23* Use is subject to license terms.24*/2526#ifndef _DT_INTTAB_H27#define _DT_INTTAB_H2829#pragma ident "%Z%%M% %I% %E% SMI"3031#include <dtrace.h>3233#ifdef __cplusplus34extern "C" {35#endif3637typedef struct dt_inthash {38struct dt_inthash *inh_hash; /* next dt_inthash in hash chain */39struct dt_inthash *inh_next; /* next dt_inthash in output table */40uint64_t inh_value; /* value associated with this element */41uint_t inh_index; /* index associated with this element */42uint_t inh_flags; /* flags (see below) */43} dt_inthash_t;4445typedef struct dt_inttab {46dtrace_hdl_t *int_hdl; /* pointer back to library handle */47dt_inthash_t **int_hash; /* array of hash buckets */48uint_t int_hashlen; /* size of hash bucket array */49uint_t int_nelems; /* number of elements hashed */50dt_inthash_t *int_head; /* head of table in index order */51dt_inthash_t *int_tail; /* tail of table in index order */52uint_t int_index; /* next index to hand out */53} dt_inttab_t;5455#define DT_INT_PRIVATE 0 /* only a single ref for this entry */56#define DT_INT_SHARED 1 /* multiple refs can share entry */5758extern dt_inttab_t *dt_inttab_create(dtrace_hdl_t *);59extern void dt_inttab_destroy(dt_inttab_t *);60extern int dt_inttab_insert(dt_inttab_t *, uint64_t, uint_t);61extern uint_t dt_inttab_size(const dt_inttab_t *);62extern void dt_inttab_write(const dt_inttab_t *, uint64_t *);6364#ifdef __cplusplus65}66#endif6768#endif /* _DT_INTTAB_H */697071