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 (the "License").
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * You may not use this file except in compliance 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/*
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Use is subject to license terms.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#ifndef _DT_STRTAB_H
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#define _DT_STRTAB_H
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
dfd08267d2958ae1cd559dd7dc2f36bf5461648dvboxsync#ifndef VBOX
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#pragma ident "%Z%%M% %I% %E% SMI"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#include <sys/types.h>
0fea9bc4af28518049902cca68d209af223a8e13vboxsync#else
0fea9bc4af28518049902cca68d209af223a8e13vboxsync# include "VBoxDTraceTypes.h"
dfd08267d2958ae1cd559dd7dc2f36bf5461648dvboxsync#endif
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#ifdef __cplusplus
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncextern "C" {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#endif
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctypedef struct dt_strhash {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync const char *str_data; /* pointer to actual string data */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ulong_t str_buf; /* index of string data buffer */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync size_t str_off; /* offset in bytes of this string */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync size_t str_len; /* length in bytes of this string */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync struct dt_strhash *str_next; /* next string in hash chain */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync} dt_strhash_t;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctypedef struct dt_strtab {
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync dt_strhash_t **str_hash; /* array of hash buckets */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ulong_t str_hashsz; /* size of hash bucket array */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync char **str_bufs; /* array of buffer pointers */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync char *str_ptr; /* pointer to current buffer location */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ulong_t str_nbufs; /* size of buffer pointer array */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync size_t str_bufsz; /* size of individual buffer */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ulong_t str_nstrs; /* total number of strings in strtab */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync size_t str_size; /* total size of strings in bytes */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync} dt_strtab_t;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsynctypedef ssize_t dt_strtab_write_f(const char *, size_t, size_t, void *);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncextern dt_strtab_t *dt_strtab_create(size_t);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncextern void dt_strtab_destroy(dt_strtab_t *);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncextern ssize_t dt_strtab_index(dt_strtab_t *, const char *);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncextern ssize_t dt_strtab_insert(dt_strtab_t *, const char *);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncextern size_t dt_strtab_size(const dt_strtab_t *);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncextern ssize_t dt_strtab_write(const dt_strtab_t *,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync dt_strtab_write_f *, void *);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncextern ulong_t dt_strtab_hash(const char *, size_t *);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#ifdef __cplusplus
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync}
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#endif
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync#endif /* _DT_STRTAB_H */