cam_debug.h (95ee2897e98f5d444f26ed2334cc7c439f9c16c6) | cam_debug.h (70f2356d364fdb7e2ff5487ae03125a338defd54) |
---|---|
1/*- 2 * Macros for tracing/loging information in the CAM layer 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 * 6 * Copyright (c) 1997 Justin T. Gibbs. 7 * All rights reserved. 8 * --- 67 unchanged lines hidden (view full) --- 76 77/* Path we want to debug */ 78extern struct cam_path *cam_dpath; 79/* Current debug levels set */ 80extern uint32_t cam_dflags; 81/* Printf delay value (to prevent scrolling) */ 82extern uint32_t cam_debug_delay; 83 | 1/*- 2 * Macros for tracing/loging information in the CAM layer 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 * 6 * Copyright (c) 1997 Justin T. Gibbs. 7 * All rights reserved. 8 * --- 67 unchanged lines hidden (view full) --- 76 77/* Path we want to debug */ 78extern struct cam_path *cam_dpath; 79/* Current debug levels set */ 80extern uint32_t cam_dflags; 81/* Printf delay value (to prevent scrolling) */ 82extern uint32_t cam_debug_delay; 83 |
84/* Helper routines -- helps conserve stack */ 85struct cam_ed; 86void xpt_cam_path_debug(struct cam_path *path, const char *fmt, ...); 87void xpt_cam_dev_debug(struct cam_ed *dev, const char *fmt, ...); 88void xpt_cam_debug(const char *fmt, ...); 89 90/* Stupid macro to remove a layer of parens */ 91#define _CAM_X(...) __VA_ARGS__ 92 |
|
84/* Debugging macros. */ | 93/* Debugging macros. */ |
85#define CAM_DEBUGGED(path, flag) \ 86 (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags) \ 87 && (cam_dpath != NULL) \ 88 && (xpt_path_comp(cam_dpath, path) >= 0) \ 89 && (xpt_path_comp(cam_dpath, path) < 2)) | 94#define CAM_DEBUGGED(path, flag) \ 95 (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags) \ 96 && (cam_dpath != NULL) \ 97 && (xpt_path_comp(cam_dpath, (path)) >= 0) \ 98 && (xpt_path_comp(cam_dpath, (path)) < 2)) |
90 | 99 |
91#define CAM_DEBUG(path, flag, printfargs) \ 92 if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags) \ 93 && (cam_dpath != NULL) \ 94 && (xpt_path_comp(cam_dpath, path) >= 0) \ 95 && (xpt_path_comp(cam_dpath, path) < 2)) { \ 96 xpt_print_path(path); \ 97 printf printfargs; \ 98 if (cam_debug_delay != 0) \ 99 DELAY(cam_debug_delay); \ | 100#define CAM_DEBUG(path, flag, printfargs) \ 101 if (CAM_DEBUGGED(path, flag)) { \ 102 xpt_cam_path_debug(path, _CAM_X printfargs); \ |
100 } 101 | 103 } 104 |
102#define CAM_DEBUG_DEV(dev, flag, printfargs) \ 103 if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags) \ 104 && (cam_dpath != NULL) \ 105 && (xpt_path_comp_dev(cam_dpath, dev) >= 0) \ 106 && (xpt_path_comp_dev(cam_dpath, dev) < 2)) { \ 107 xpt_print_device(dev); \ 108 printf printfargs; \ 109 if (cam_debug_delay != 0) \ 110 DELAY(cam_debug_delay); \ | 105#define CAM_DEBUG_DEV(dev, flag, printfargs) \ 106 if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags) \ 107 && (cam_dpath != NULL) \ 108 && (xpt_path_comp_dev(cam_dpath, (dev)) >= 0) \ 109 && (xpt_path_comp_dev(cam_dpath, (dev)) < 2)) { \ 110 xpt_cam_dev_debug(dev, _CAM_X printfargs); \ |
111 } 112 | 111 } 112 |
113#define CAM_DEBUG_PRINT(flag, printfargs) \ 114 if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)) { \ 115 printf("cam_debug: "); \ 116 printf printfargs; \ 117 if (cam_debug_delay != 0) \ 118 DELAY(cam_debug_delay); \ | 113#define CAM_DEBUG_PRINT(flag, printfargs) \ 114 if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)) { \ 115 xpt_cam_debug(_CAM_X printfargs); \ |
119 } 120 | 116 } 117 |
121#define CAM_DEBUG_PATH_PRINT(flag, path, printfargs) \ 122 if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)) { \ 123 xpt_print(path, "cam_debug: "); \ 124 printf printfargs; \ 125 if (cam_debug_delay != 0) \ 126 DELAY(cam_debug_delay); \ 127 } 128 | |
129#else /* !_KERNEL */ 130 131#define CAM_DEBUGGED(A, B) 0 132#define CAM_DEBUG(A, B, C) | 118#else /* !_KERNEL */ 119 120#define CAM_DEBUGGED(A, B) 0 121#define CAM_DEBUG(A, B, C) |
122#define CAM_DEBUG_DEV(A, B, C) |
|
133#define CAM_DEBUG_PRINT(A, B) | 123#define CAM_DEBUG_PRINT(A, B) |
134#define CAM_DEBUG_PATH_PRINT(A, B, C) | |
135 136#endif /* _KERNEL */ 137 138#endif /* _CAM_CAM_DEBUG_H */ | 124 125#endif /* _KERNEL */ 126 127#endif /* _CAM_CAM_DEBUG_H */ |