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 5*11466SRoger.Faulkner@Sun.COM * Common Development and Distribution License (the "License"). 6*11466SRoger.Faulkner@Sun.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 211193Smws 220Sstevel@tonic-gate /* 23*11466SRoger.Faulkner@Sun.COM * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _FMD_SUBR_H 280Sstevel@tonic-gate #define _FMD_SUBR_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #include <pthread.h> 31*11466SRoger.Faulkner@Sun.COM #include <synch.h> 320Sstevel@tonic-gate #include <stdarg.h> 330Sstevel@tonic-gate 340Sstevel@tonic-gate #ifdef __cplusplus 350Sstevel@tonic-gate extern "C" { 360Sstevel@tonic-gate #endif 370Sstevel@tonic-gate 380Sstevel@tonic-gate #ifdef DEBUG 390Sstevel@tonic-gate extern int fmd_assert(const char *, const char *, int); 400Sstevel@tonic-gate #define ASSERT(x) ((void)((x) || fmd_assert(#x, __FILE__, __LINE__))) 410Sstevel@tonic-gate #else 420Sstevel@tonic-gate #define ASSERT(x) 430Sstevel@tonic-gate #endif 440Sstevel@tonic-gate 450Sstevel@tonic-gate extern void fmd_vpanic(const char *, va_list); 460Sstevel@tonic-gate extern void fmd_panic(const char *, ...); 470Sstevel@tonic-gate 480Sstevel@tonic-gate extern void fmd_verror(int, const char *, va_list); 490Sstevel@tonic-gate extern void fmd_error(int, const char *, ...); 500Sstevel@tonic-gate 510Sstevel@tonic-gate #define FMD_DBG_HELP 0x0001 /* display list of debugging modes and exit */ 520Sstevel@tonic-gate #define FMD_DBG_ERR 0x0002 /* enable error handling debug messages */ 530Sstevel@tonic-gate #define FMD_DBG_MOD 0x0004 /* enable module subsystem debug messages */ 540Sstevel@tonic-gate #define FMD_DBG_DISP 0x0008 /* enable dispq subsystem debug messages */ 550Sstevel@tonic-gate #define FMD_DBG_XPRT 0x0010 /* enable transport subsystem debug messages */ 560Sstevel@tonic-gate #define FMD_DBG_EVT 0x0020 /* enable event subsystem debug messages */ 570Sstevel@tonic-gate #define FMD_DBG_LOG 0x0040 /* enable log subsystem debug messages */ 580Sstevel@tonic-gate #define FMD_DBG_TMR 0x0080 /* enable timer subsystem debug messages */ 590Sstevel@tonic-gate #define FMD_DBG_FMRI 0x0100 /* enable fmri subsystem debug messages */ 600Sstevel@tonic-gate #define FMD_DBG_ASRU 0x0200 /* enable asru subsystem debug messages */ 610Sstevel@tonic-gate #define FMD_DBG_CASE 0x0400 /* enable case subsystem debug messages */ 620Sstevel@tonic-gate #define FMD_DBG_CKPT 0x0800 /* enable checkpoint debug messages */ 630Sstevel@tonic-gate #define FMD_DBG_RPC 0x1000 /* enable rpc service debug messages */ 641193Smws #define FMD_DBG_TRACE 0x2000 /* display matching TRACE() calls */ 651193Smws #define FMD_DBG_ALL 0x1ffe /* enable all modes except for HELP, TRACE */ 660Sstevel@tonic-gate 670Sstevel@tonic-gate extern void fmd_vdprintf(int, const char *, va_list); 680Sstevel@tonic-gate extern void fmd_dprintf(int, const char *, ...); 690Sstevel@tonic-gate 700Sstevel@tonic-gate extern void fmd_trace_cpp(void *, const char *, int); 711193Smws extern void *fmd_trace(uint_t, const char *, ...); 720Sstevel@tonic-gate 730Sstevel@tonic-gate #ifdef DEBUG 740Sstevel@tonic-gate #define TRACE(args) { fmd_trace_cpp(fmd_trace args, __FILE__, __LINE__); } 750Sstevel@tonic-gate #else 760Sstevel@tonic-gate #define TRACE(args) 770Sstevel@tonic-gate #endif 780Sstevel@tonic-gate 790Sstevel@tonic-gate extern const char *fmd_ea_strerror(int); 800Sstevel@tonic-gate extern uint64_t fmd_ena(void); 811193Smws extern uint32_t fmd_ntz32(uint32_t); 820Sstevel@tonic-gate 830Sstevel@tonic-gate #ifdef __cplusplus 840Sstevel@tonic-gate } 850Sstevel@tonic-gate #endif 860Sstevel@tonic-gate 870Sstevel@tonic-gate #endif /* _FMD_SUBR_H */ 88