The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/bsd/hfs/hfs_dbg.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
    3  *
    4  * @APPLE_LICENSE_HEADER_START@
    5  * 
    6  * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
    7  * 
    8  * This file contains Original Code and/or Modifications of Original Code
    9  * as defined in and that are subject to the Apple Public Source License
   10  * Version 2.0 (the 'License'). You may not use this file except in
   11  * compliance with the License. Please obtain a copy of the License at
   12  * http://www.opensource.apple.com/apsl/ and read it before using this
   13  * file.
   14  * 
   15  * The Original Code and all software distributed under the License are
   16  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
   17  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
   18  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
   19  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
   20  * Please see the License for the specific language governing rights and
   21  * limitations under the License.
   22  * 
   23  * @APPLE_LICENSE_HEADER_END@
   24  */
   25 /*      hfs_dbg.h
   26  *
   27  *      (c) 1997 Apple Computer, Inc.  All Rights Reserved
   28  *
   29  *      hfs_dbg.h -- debugging macros for HFS file system.
   30  *
   31  *      HISTORY
   32  *      10-Nov-1998 Pat Dirks           Cleaned up definition of DBG_ASSERT to handle embedded '%' correctly.
   33  *      28-Apr-1998     Scott Roberts   Reorganized and added HFS_DEBUG_STAGE
   34  *      17-Nov-1997     Pat Dirks               Pat Dirks at Apple Computer
   35  *                                                              Derived from old hfs version.
   36  */
   37 
   38 struct componentname;
   39 
   40 /* Define the debugging stage...
   41                 4 -> Do all, aggresive, call_kdp
   42                 3 -> debug asserts and debug err, panic instead of call_kdp
   43                 2 -> debug error, no kdb
   44                 1 -> very little, panic only
   45 */
   46 #ifndef HFS_DIAGNOSTIC
   47         #define HFS_DIAGNOSTIC 0
   48 #endif /* HFS_DIAGNOSTIC */
   49 
   50 #ifndef HFS_DEBUG_STAGE
   51 #if HFS_DIAGNOSTIC
   52         #define HFS_DEBUG_STAGE 4
   53 #else
   54         #define HFS_DEBUG_STAGE 1
   55 #endif /* KERNEL */
   56 #endif  /* HFS_DEBUG_STAGE */
   57 
   58 #ifdef KERNEL
   59   #define PRINTIT kprintf
   60 #else /* KERNEL */
   61   #define PRINTIT printf
   62 #endif /* KERNEL */
   63 
   64 #if (HFS_DEBUG_STAGE > 3)
   65 #define DEBUG_BREAK Debugger("");
   66 #else
   67 #define DEBUG_BREAK
   68 #endif
   69 
   70 #if (HFS_DEBUG_STAGE == 4)
   71     #define DEBUG_BREAK_MSG(PRINTF_ARGS) { PRINTIT PRINTF_ARGS; DEBUG_BREAK };
   72 #elif (HFS_DEBUG_STAGE == 3)
   73     #define DEBUG_BREAK_MSG(PRINTF_ARGS) { panic PRINTF_ARGS;};
   74 #else
   75     #define DEBUG_BREAK_MSG(PRINTF_ARGS) { PRINTIT PRINTF_ARGS; };
   76 #endif
   77 
   78 
   79 //#define PRINT_DELAY (void) tsleep((caddr_t)&lbolt, PPAUSE, "hfs kprintf", 0)
   80 #define PRINT_DELAY
   81 
   82 /*
   83  * Debugging macros.
   84  */
   85 #if     HFS_DIAGNOSTIC
   86 extern int hfs_dbg_all;
   87 extern int hfs_dbg_err;
   88 
   89 #ifdef KERNEL
   90     #if (HFS_DEBUG_STAGE == 4)
   91                 char            gDebugAssertStr[255];
   92                 #define DBG_ASSERT(a) { if (!(a)) { \
   93                                 sprintf(gDebugAssertStr,"Oops - File "__FILE__", line %d: assertion '%s' failed.\n", __LINE__, #a); \
   94                 Debugger(gDebugAssertStr); } }
   95         #else
   96 #define DBG_ASSERT(a) { if (!(a)) { panic("File "__FILE__", line %d: assertion '%s' failed.\n", __LINE__, #a); } }
   97     #endif /* HFS_DEBUG_STAGE */
   98 #else
   99     #define DBG_ASSERT(a) assert(a)
  100 #endif /* KERNEL */
  101 
  102 #define DBG_ERR(x)      {               \
  103         if(hfs_dbg_all || hfs_dbg_err) {        \
  104         PRINTIT("%X: ", current_proc()->p_pid); \
  105             PRINTIT("HFS ERROR: "); \
  106             PRINTIT x;                  \
  107             PRINT_DELAY;  \
  108         };                      \
  109 }
  110 
  111 #else   /* HFS_DIAGNOSTIC */
  112 
  113 #define DBG_ASSERT(a)
  114 #define DBG_ERR(x)
  115 
  116 #endif  /* HFS_DIAGNOSTIC */
  117 

Cache object: 3eb9cc419343e61a1d659a90fed99c17


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.