1/* 2 * Copyright (c) 2002-2007 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 24#ifndef __IOKIT_IO_SCSI_PARALLEL_FAMILY_DEBUGGING_H__ 25#define __IOKIT_IO_SCSI_PARALLEL_FAMILY_DEBUGGING_H__ 26 27#if KERNEL 28#include <IOKit/IOLib.h> 29#else 30#include <IOKit/IOKitLib.h> 31#endif 32 33#ifndef DEBUG_ASSERT_COMPONENT_NAME_STRING 34 #define DEBUG_ASSERT_COMPONENT_NAME_STRING "SPI" 35#endif 36 37#if KERNEL 38 39#if SPI_MODULE 40 41/* IOSCSIParallelFamilyDebugAssert prototype*/ 42void 43IOSCSIParallelFamilyDebugAssert ( const char * componentNameString, 44 const char * assertionString, 45 const char * exceptionLabelString, 46 const char * errorString, 47 const char * fileName, 48 long lineNumber, 49 int errorCode ); 50 51#else 52 53extern void 54IOSCSIParallelFamilyDebugAssert ( const char * componentNameString, 55 const char * assertionString, 56 const char * exceptionLabelString, 57 const char * errorString, 58 const char * fileName, 59 long lineNumber, 60 int errorCode ); 61 62 63#endif /* SPI_MODULE */ 64 65 66#define DEBUG_ASSERT_MESSAGE( componentNameString, \ 67 assertionString, \ 68 exceptionLabelString, \ 69 errorString, \ 70 fileName, \ 71 lineNumber, \ 72 error ) \ 73 IOSCSIParallelFamilyDebugAssert( componentNameString, \ 74 assertionString, \ 75 exceptionLabelString, \ 76 errorString, \ 77 fileName, \ 78 lineNumber, \ 79 error ) 80 81 82#endif /* KERNEL */ 83 84 85#include <AssertMacros.h> 86 87 88// Other helpful macros (maybe some day these will make 89// their way into /usr/include/AssertMacros.h) 90 91#define require_success( errorCode, exceptionLabel ) \ 92 require( kIOReturnSuccess == (errorCode), exceptionLabel ) 93 94#define require_success_action( errorCode, exceptionLabel, action ) \ 95 require_action( kIOReturnSuccess == (errorCode), exceptionLabel, action ) 96 97#define require_success_quiet( errorCode, exceptionLabel ) \ 98 require_quiet( kIOReturnSuccess == (errorCode), exceptionLabel ) 99 100#define require_success_action_quiet( errorCode, exceptionLabel, action ) \ 101 require_action_quiet( kIOReturnSuccess == (errorCode), exceptionLabel, action ) 102 103#define require_success_string( errorCode, exceptionLabel, message ) \ 104 require_string( kIOReturnSuccess == (errorCode), exceptionLabel, message ) 105 106#define require_success_action_string( errorCode, exceptionLabel, action, message ) \ 107 require_action_string( kIOReturnSuccess == (errorCode), exceptionLabel, action, message ) 108 109 110#define require_nonzero( obj, exceptionLabel ) \ 111 require( ( 0 != obj ), exceptionLabel ) 112 113#define require_nonzero_action( obj, exceptionLabel, action ) \ 114 require_action( ( 0 != obj ), exceptionLabel, action ) 115 116#define require_nonzero_quiet( obj, exceptionLabel ) \ 117 require_quiet( ( 0 != obj ), exceptionLabel ) 118 119#define require_nonzero_action_quiet( obj, exceptionLabel, action ) \ 120 require_action_quiet( ( 0 != obj ), exceptionLabel, action ) 121 122#define require_nonzero_string( obj, exceptionLabel, message ) \ 123 require_string( ( 0 != obj ), exceptionLabel, message ) 124 125#define require_nonzero_action_string( obj, exceptionLabel, action, message ) \ 126 require_action_string( ( 0 != obj ), exceptionLabel, action, message ) 127 128 129#endif /* __IOKIT_IO_SCSI_PARALLEL_FAMILY_DEBUGGING_H__ */