Print this page
10886 smatch debug macro cleanup in usr/src/uts


   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
  23  */
  24 /*
  25  * Copyright 2011 cyril.galibern@opensvc.com
  26  * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.

  27  */
  28 
  29 #ifndef _SYS_SCSI_TARGETS_SDDEF_H
  30 #define _SYS_SCSI_TARGETS_SDDEF_H
  31 
  32 #include <sys/dktp/fdisk.h>
  33 #include <sys/note.h>
  34 #include <sys/mhd.h>
  35 #include <sys/cmlb.h>
  36 
  37 #ifdef  __cplusplus
  38 extern "C" {
  39 #endif
  40 
  41 
  42 #if defined(_KERNEL) || defined(_KMEMUSER)
  43 
  44 
  45 #define SD_SUCCESS              0
  46 #define SD_FAILURE              (-1)


1147                         "setting %s to %d\n",   \
1148                         d, ((fi_ ## b)->c));         \
1149         }
1150 
1151 /* SD FaultInjection ioctls */
1152 #define SDIOC                   ('T'<<8)
1153 #define SDIOCSTART              (SDIOC|1)
1154 #define SDIOCSTOP               (SDIOC|2)
1155 #define SDIOCINSERTPKT  (SDIOC|3)
1156 #define SDIOCINSERTXB   (SDIOC|4)
1157 #define SDIOCINSERTUN   (SDIOC|5)
1158 #define SDIOCINSERTARQ  (SDIOC|6)
1159 #define SDIOCPUSH               (SDIOC|7)
1160 #define SDIOCRETRIEVE   (SDIOC|8)
1161 #define SDIOCRUN                (SDIOC|9)
1162 #endif
1163 
1164 #else
1165 
1166 #undef  SDDEBUG
1167 #define SD_ERROR        { if (0) sd_log_err; }
1168 #define SD_TRACE        { if (0) sd_log_trace; }
1169 #define SD_INFO         { if (0) sd_log_info; }
1170 #define SD_DUMP_MEMORY  { if (0) sd_dump_memory; }
1171 #endif
1172 
1173 
1174 /*
1175  * Miscellaneous macros
1176  */
1177 
1178 #define SD_USECTOHZ(x)                  (drv_usectohz((x)*1000000))
1179 #define SD_GET_PKT_STATUS(pktp)         ((*(pktp)->pkt_scbp) & STATUS_MASK)
1180 
1181 #define SD_BIOERROR(bp, errcode)                                        \
1182         if ((bp)->b_resid == 0) {                                    \
1183                 (bp)->b_resid = (bp)->b_bcount;                           \
1184         }                                                               \
1185         if ((bp)->b_error == 0) {                                    \
1186                 bioerror(bp, errcode);                                  \
1187         }                                                               \
1188         (bp)->b_flags |= B_ERROR;
1189 
1190 #define SD_FILL_SCSI1_LUN_CDB(lunp, cdbp)                               \




   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
  23  */
  24 /*
  25  * Copyright 2011 cyril.galibern@opensvc.com
  26  * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  27  * Copyright 2019 Joyent, Inc.
  28  */
  29 
  30 #ifndef _SYS_SCSI_TARGETS_SDDEF_H
  31 #define _SYS_SCSI_TARGETS_SDDEF_H
  32 
  33 #include <sys/dktp/fdisk.h>
  34 #include <sys/note.h>
  35 #include <sys/mhd.h>
  36 #include <sys/cmlb.h>
  37 
  38 #ifdef  __cplusplus
  39 extern "C" {
  40 #endif
  41 
  42 
  43 #if defined(_KERNEL) || defined(_KMEMUSER)
  44 
  45 
  46 #define SD_SUCCESS              0
  47 #define SD_FAILURE              (-1)


1148                         "setting %s to %d\n",   \
1149                         d, ((fi_ ## b)->c));         \
1150         }
1151 
1152 /* SD FaultInjection ioctls */
1153 #define SDIOC                   ('T'<<8)
1154 #define SDIOCSTART              (SDIOC|1)
1155 #define SDIOCSTOP               (SDIOC|2)
1156 #define SDIOCINSERTPKT  (SDIOC|3)
1157 #define SDIOCINSERTXB   (SDIOC|4)
1158 #define SDIOCINSERTUN   (SDIOC|5)
1159 #define SDIOCINSERTARQ  (SDIOC|6)
1160 #define SDIOCPUSH               (SDIOC|7)
1161 #define SDIOCRETRIEVE   (SDIOC|8)
1162 #define SDIOCRUN                (SDIOC|9)
1163 #endif
1164 
1165 #else
1166 
1167 #undef  SDDEBUG
1168 #define SD_ERROR(...)           (void)(0)
1169 #define SD_TRACE(...)           (void)(0)
1170 #define SD_INFO(...)            (void)(0)
1171 #define SD_DUMP_MEMORY(...)     (void)(0)
1172 #endif
1173 
1174 
1175 /*
1176  * Miscellaneous macros
1177  */
1178 
1179 #define SD_USECTOHZ(x)                  (drv_usectohz((x)*1000000))
1180 #define SD_GET_PKT_STATUS(pktp)         ((*(pktp)->pkt_scbp) & STATUS_MASK)
1181 
1182 #define SD_BIOERROR(bp, errcode)                                        \
1183         if ((bp)->b_resid == 0) {                                    \
1184                 (bp)->b_resid = (bp)->b_bcount;                           \
1185         }                                                               \
1186         if ((bp)->b_error == 0) {                                    \
1187                 bioerror(bp, errcode);                                  \
1188         }                                                               \
1189         (bp)->b_flags |= B_ERROR;
1190 
1191 #define SD_FILL_SCSI1_LUN_CDB(lunp, cdbp)                               \