10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 22*1429Smws 230Sstevel@tonic-gate /* 24*1429Smws * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 250Sstevel@tonic-gate * Use is subject to license terms. 260Sstevel@tonic-gate */ 270Sstevel@tonic-gate 280Sstevel@tonic-gate #ifndef _FMD_BUF_H 290Sstevel@tonic-gate #define _FMD_BUF_H 300Sstevel@tonic-gate 310Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 320Sstevel@tonic-gate 330Sstevel@tonic-gate #include <sys/types.h> 340Sstevel@tonic-gate 350Sstevel@tonic-gate #ifdef __cplusplus 360Sstevel@tonic-gate extern "C" { 370Sstevel@tonic-gate #endif 380Sstevel@tonic-gate 390Sstevel@tonic-gate typedef struct fmd_buf { 400Sstevel@tonic-gate char *buf_name; /* name of this buffer */ 410Sstevel@tonic-gate struct fmd_buf *buf_next; /* next buffer in hash chain */ 420Sstevel@tonic-gate void *buf_data; /* buffer data storage */ 430Sstevel@tonic-gate size_t buf_size; /* buffer size */ 440Sstevel@tonic-gate uint_t buf_flags; /* buffer flags (see below) */ 450Sstevel@tonic-gate } fmd_buf_t; 460Sstevel@tonic-gate 470Sstevel@tonic-gate #define FMD_BUF_DIRTY 0x1 /* buffer is dirty (needs checkpoint) */ 480Sstevel@tonic-gate 490Sstevel@tonic-gate typedef void fmd_buf_f(fmd_buf_t *, void *); 500Sstevel@tonic-gate 510Sstevel@tonic-gate typedef struct fmd_buf_hash { 520Sstevel@tonic-gate fmd_buf_t **bh_hash; /* hash bucket array for buffers */ 530Sstevel@tonic-gate uint_t bh_hashlen; /* length of hash bucket array */ 540Sstevel@tonic-gate uint_t bh_count; /* number of buffers in hash */ 550Sstevel@tonic-gate } fmd_buf_hash_t; 560Sstevel@tonic-gate 570Sstevel@tonic-gate extern void fmd_buf_hash_create(fmd_buf_hash_t *); 58*1429Smws extern size_t fmd_buf_hash_destroy(fmd_buf_hash_t *); 590Sstevel@tonic-gate extern void fmd_buf_hash_apply(fmd_buf_hash_t *, fmd_buf_f *, void *); 600Sstevel@tonic-gate extern void fmd_buf_hash_commit(fmd_buf_hash_t *); 610Sstevel@tonic-gate extern uint_t fmd_buf_hash_count(fmd_buf_hash_t *); 620Sstevel@tonic-gate 630Sstevel@tonic-gate extern fmd_buf_t *fmd_buf_insert(fmd_buf_hash_t *, const char *, size_t); 640Sstevel@tonic-gate extern fmd_buf_t *fmd_buf_lookup(fmd_buf_hash_t *, const char *); 650Sstevel@tonic-gate extern void fmd_buf_delete(fmd_buf_hash_t *, const char *); 660Sstevel@tonic-gate 670Sstevel@tonic-gate #ifdef __cplusplus 680Sstevel@tonic-gate } 690Sstevel@tonic-gate #endif 700Sstevel@tonic-gate 710Sstevel@tonic-gate #endif /* _FMD_BUF_H */ 72