17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*53f3aea0SRoger A. Faulkner * Common Development and Distribution License (the "License"). 6*53f3aea0SRoger A. Faulkner * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21d9638e54Smws 227c478bd9Sstevel@tonic-gate /* 23*53f3aea0SRoger A. Faulkner * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _FMD_SUBR_H 287c478bd9Sstevel@tonic-gate #define _FMD_SUBR_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #include <pthread.h> 31*53f3aea0SRoger A. Faulkner #include <synch.h> 327c478bd9Sstevel@tonic-gate #include <stdarg.h> 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #ifdef __cplusplus 357c478bd9Sstevel@tonic-gate extern "C" { 367c478bd9Sstevel@tonic-gate #endif 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #ifdef DEBUG 397c478bd9Sstevel@tonic-gate extern int fmd_assert(const char *, const char *, int); 407c478bd9Sstevel@tonic-gate #define ASSERT(x) ((void)((x) || fmd_assert(#x, __FILE__, __LINE__))) 417c478bd9Sstevel@tonic-gate #else 427c478bd9Sstevel@tonic-gate #define ASSERT(x) 437c478bd9Sstevel@tonic-gate #endif 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate extern void fmd_vpanic(const char *, va_list); 467c478bd9Sstevel@tonic-gate extern void fmd_panic(const char *, ...); 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate extern void fmd_verror(int, const char *, va_list); 497c478bd9Sstevel@tonic-gate extern void fmd_error(int, const char *, ...); 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate #define FMD_DBG_HELP 0x0001 /* display list of debugging modes and exit */ 527c478bd9Sstevel@tonic-gate #define FMD_DBG_ERR 0x0002 /* enable error handling debug messages */ 537c478bd9Sstevel@tonic-gate #define FMD_DBG_MOD 0x0004 /* enable module subsystem debug messages */ 547c478bd9Sstevel@tonic-gate #define FMD_DBG_DISP 0x0008 /* enable dispq subsystem debug messages */ 557c478bd9Sstevel@tonic-gate #define FMD_DBG_XPRT 0x0010 /* enable transport subsystem debug messages */ 567c478bd9Sstevel@tonic-gate #define FMD_DBG_EVT 0x0020 /* enable event subsystem debug messages */ 577c478bd9Sstevel@tonic-gate #define FMD_DBG_LOG 0x0040 /* enable log subsystem debug messages */ 587c478bd9Sstevel@tonic-gate #define FMD_DBG_TMR 0x0080 /* enable timer subsystem debug messages */ 597c478bd9Sstevel@tonic-gate #define FMD_DBG_FMRI 0x0100 /* enable fmri subsystem debug messages */ 607c478bd9Sstevel@tonic-gate #define FMD_DBG_ASRU 0x0200 /* enable asru subsystem debug messages */ 617c478bd9Sstevel@tonic-gate #define FMD_DBG_CASE 0x0400 /* enable case subsystem debug messages */ 627c478bd9Sstevel@tonic-gate #define FMD_DBG_CKPT 0x0800 /* enable checkpoint debug messages */ 637c478bd9Sstevel@tonic-gate #define FMD_DBG_RPC 0x1000 /* enable rpc service debug messages */ 64d9638e54Smws #define FMD_DBG_TRACE 0x2000 /* display matching TRACE() calls */ 65d9638e54Smws #define FMD_DBG_ALL 0x1ffe /* enable all modes except for HELP, TRACE */ 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate extern void fmd_vdprintf(int, const char *, va_list); 687c478bd9Sstevel@tonic-gate extern void fmd_dprintf(int, const char *, ...); 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate extern void fmd_trace_cpp(void *, const char *, int); 71d9638e54Smws extern void *fmd_trace(uint_t, const char *, ...); 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate #ifdef DEBUG 747c478bd9Sstevel@tonic-gate #define TRACE(args) { fmd_trace_cpp(fmd_trace args, __FILE__, __LINE__); } 757c478bd9Sstevel@tonic-gate #else 767c478bd9Sstevel@tonic-gate #define TRACE(args) 777c478bd9Sstevel@tonic-gate #endif 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gate extern const char *fmd_ea_strerror(int); 807c478bd9Sstevel@tonic-gate extern uint64_t fmd_ena(void); 81d9638e54Smws extern uint32_t fmd_ntz32(uint32_t); 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate #ifdef __cplusplus 847c478bd9Sstevel@tonic-gate } 857c478bd9Sstevel@tonic-gate #endif 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate #endif /* _FMD_SUBR_H */ 88