diff options
| author | Viswanathan Kannappan <Viswanathan.Kannappan@Sun.COM> | 2010-06-07 08:19:25 -0700 | 
|---|---|---|
| committer | Viswanathan Kannappan <Viswanathan.Kannappan@Sun.COM> | 2010-06-07 08:19:25 -0700 | 
| commit | 4558d122136f151d62acbbc02ddb42df89a5ef66 (patch) | |
| tree | 8d64ce46c2808403cc8b8b9460c105b99e9529b3 /usr/src | |
| parent | 2ea22bf74805dd8e4937701bfdce1da6c95c53b7 (diff) | |
| download | illumos-gate-4558d122136f151d62acbbc02ddb42df89a5ef66.tar.gz | |
6777077 COMSTAR drivers unnecessary NUL-terminate strings
6777085 COMSTAR Makefiles can take advantage of being ON citizens
Contributed by Sergio Gutierriez <saguti@gmail.com>
Diffstat (limited to 'usr/src')
54 files changed, 275 insertions, 353 deletions
| diff --git a/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd.c b/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd.c index 532ea5052f..0b45c9cc9b 100644 --- a/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd.c +++ b/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd.c @@ -39,12 +39,13 @@  #include <sys/dkio.h>  #include <sys/zfs_ioctl.h> -#include <stmf.h> -#include <lpif.h> -#include <stmf_ioctl.h> -#include <stmf_sbd.h> -#include <sbd_impl.h> -#include <stmf_sbd_ioctl.h> +#include <sys/stmf.h> +#include <sys/lpif.h> +#include <sys/stmf_ioctl.h> +#include <sys/stmf_sbd_ioctl.h> + +#include "stmf_sbd.h" +#include "sbd_impl.h"  #define	SBD_IS_ZVOL(zvol)	(strncmp("/dev/zvol", zvol, 9)) diff --git a/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_pgr.c b/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_pgr.c index dfcc71261e..42807053ce 100644 --- a/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_pgr.c +++ b/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_pgr.c @@ -28,13 +28,14 @@  #include <sys/scsi/scsi_types.h>  #include <sys/scsi/generic/persist.h> -#include <lpif.h> -#include <stmf.h> -#include <stmf_ioctl.h> -#include <stmf_sbd.h> -#include <sbd_impl.h> -#include <portif.h> -#include <stmf_sbd_ioctl.h> +#include <sys/lpif.h> +#include <sys/stmf.h> +#include <sys/stmf_ioctl.h> +#include <sys/portif.h> +#include <sys/stmf_sbd_ioctl.h> + +#include "stmf_sbd.h" +#include "sbd_impl.h"  #define	MAX_PGR_PARAM_LIST_LENGTH	(256 * 1024) diff --git a/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_scsi.c b/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_scsi.c index 1d5406d048..644dbdaff2 100644 --- a/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_scsi.c +++ b/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_scsi.c @@ -36,13 +36,14 @@  #include <sys/sdt.h>  #include <sys/dkio.h> -#include <stmf.h> -#include <lpif.h> -#include <portif.h> -#include <stmf_ioctl.h> -#include <stmf_sbd.h> -#include <stmf_sbd_ioctl.h> -#include <sbd_impl.h> +#include <sys/stmf.h> +#include <sys/lpif.h> +#include <sys/portif.h> +#include <sys/stmf_ioctl.h> +#include <sys/stmf_sbd_ioctl.h> + +#include "stmf_sbd.h" +#include "sbd_impl.h"  #define	SCSI2_CONFLICT_FREE_CMDS(cdb)	( \  	/* ----------------------- */                                      \ diff --git a/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_zvol.c b/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_zvol.c index 8dd496f26b..65e418141c 100644 --- a/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_zvol.c +++ b/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd_zvol.c @@ -40,13 +40,14 @@  #include <sys/zvol.h>  #include <sys/zfs_rlock.h> -#include <stmf.h> -#include <lpif.h> -#include <portif.h> -#include <stmf_ioctl.h> -#include <stmf_sbd.h> -#include <stmf_sbd_ioctl.h> -#include <sbd_impl.h> +#include <sys/stmf.h> +#include <sys/lpif.h> +#include <sys/portif.h> +#include <sys/stmf_ioctl.h> +#include <sys/stmf_sbd_ioctl.h> + +#include "stmf_sbd.h" +#include "sbd_impl.h"  /* diff --git a/usr/src/uts/common/io/comstar/port/fcoet/fcoet.c b/usr/src/uts/common/io/comstar/port/fcoet/fcoet.c index 60362ef123..6dee5917b6 100644 --- a/usr/src/uts/common/io/comstar/port/fcoet/fcoet.c +++ b/usr/src/uts/common/io/comstar/port/fcoet/fcoet.c @@ -19,8 +19,7 @@   * CDDL HEADER END   */  /* - * Copyright 2009 Sun Microsystems, Inc.  All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.   */  /* @@ -92,9 +91,9 @@  /*   * Driver's own header files   */ -#include <fcoet.h> -#include <fcoet_eth.h> -#include <fcoet_fc.h> +#include "fcoet.h" +#include "fcoet_eth.h" +#include "fcoet_fc.h"  /*   * static function forward declaration @@ -438,7 +437,7 @@ fcoet_attach_init(fcoet_soft_state_t *ss)  	fcoe_port_t		*eport;  	fct_local_port_t	*port;  	fct_dbuf_store_t	*fds; -	char			 taskq_name[32]; +	char			 taskq_name[FCOET_TASKQ_NAME_LEN];  	int			 ret;  	/* @@ -585,9 +584,8 @@ fcoet_attach_init(fcoet_soft_state_t *ss)  	/*  	 * Start watchdog thread  	 */ -	(void) snprintf(taskq_name, 32, "stmf_fct_fcoet_%d_taskq", -	    ss->ss_instance); -	taskq_name[31] = 0; +	(void) snprintf(taskq_name, sizeof (taskq_name), +	    "stmf_fct_fcoet_%d_taskq", ss->ss_instance);  	if ((ss->ss_watchdog_taskq = ddi_taskq_create(NULL,  	    taskq_name, 2, TASKQ_DEFAULTPRI, 0)) == NULL) {  		goto fail_create_taskq; diff --git a/usr/src/uts/common/io/comstar/port/fcoet/fcoet.h b/usr/src/uts/common/io/comstar/port/fcoet/fcoet.h index b5e5154583..2aa591cf3c 100644 --- a/usr/src/uts/common/io/comstar/port/fcoet/fcoet.h +++ b/usr/src/uts/common/io/comstar/port/fcoet/fcoet.h @@ -19,8 +19,7 @@   * CDDL HEADER END   */  /* - * Copyright 2009 Sun Microsystems, Inc.  All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.   */  #ifndef	_FCOET_H  #define	_FCOET_H @@ -37,6 +36,8 @@ extern "C" {  #define	FCOET_NAME	"COMSTAR FCoET "  #define	FCOET_MOD_NAME	FCOET_NAME FCOET_VERSION +#define	FCOET_TASKQ_NAME_LEN	32 +  /*   * FCOET logging   */ diff --git a/usr/src/uts/common/io/comstar/port/fcoet/fcoet_eth.c b/usr/src/uts/common/io/comstar/port/fcoet/fcoet_eth.c index d68d59ecc2..be6edaa3f2 100644 --- a/usr/src/uts/common/io/comstar/port/fcoet/fcoet_eth.c +++ b/usr/src/uts/common/io/comstar/port/fcoet/fcoet_eth.c @@ -20,8 +20,7 @@   */  /* - * Copyright 2009 Sun Microsystems, Inc.  All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.   */  /* @@ -97,8 +96,8 @@  /*   * Driver's own header files   */ -#include <fcoet.h> -#include <fcoet_eth.h> +#include "fcoet.h" +#include "fcoet_eth.h"  /*   * function forward declaration diff --git a/usr/src/uts/common/io/comstar/port/fcoet/fcoet_fc.c b/usr/src/uts/common/io/comstar/port/fcoet/fcoet_fc.c index 2cf3f58fe3..4992db96c3 100644 --- a/usr/src/uts/common/io/comstar/port/fcoet/fcoet_fc.c +++ b/usr/src/uts/common/io/comstar/port/fcoet/fcoet_fc.c @@ -20,8 +20,7 @@   */  /* - * Copyright 2009 Sun Microsystems, Inc.  All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.   */  /* @@ -62,9 +61,9 @@  /*   * Driver's own header files   */ -#include <fcoet.h> -#include <fcoet_fc.h> -#include <fcoet_eth.h> +#include "fcoet.h" +#include "fcoet_fc.h" +#include "fcoet_eth.h"  /*   * function forward declaration @@ -168,7 +167,7 @@ fcoet_send_cmd(fct_cmd_t *cmd)  fct_status_t  fcoet_send_cmd_response(fct_cmd_t *cmd, uint32_t ioflags)  { -	char	info[160]; +	char	info[FCT_INFO_LEN];  	if (cmd->cmd_type == FCT_CMD_FCP_XCHG) {  		if (ioflags & FCT_IOF_FORCE_FCA_DONE) { @@ -198,10 +197,9 @@ fcoet_send_cmd_response(fct_cmd_t *cmd, uint32_t ioflags)  	}  send_cmd_rsp_error: -	(void) snprintf(info, 160, "fcoet_send_cmd_response: can not handle " -	    "FCT_IOF_FORCE_FCA_DONE for cmd %p, ioflags-%x", (void *)cmd, +	(void) snprintf(info, sizeof (info), "fcoet_send_cmd_response: can not " +	    "handle FCT_IOF_FORCE_FCA_DONE for cmd %p, ioflags-%x", (void *)cmd,  	    ioflags); -	info[159] = 0;  	(void) fct_port_shutdown(CMD2SS(cmd)->ss_port,  	    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info);  	return (FCT_FAILURE); diff --git a/usr/src/uts/common/io/comstar/port/fct/discovery.c b/usr/src/uts/common/io/comstar/port/fct/discovery.c index a9e16bb39d..47553b20ba 100644 --- a/usr/src/uts/common/io/comstar/port/fct/discovery.c +++ b/usr/src/uts/common/io/comstar/port/fct/discovery.c @@ -19,8 +19,7 @@   * CDDL HEADER END   */  /* - * Copyright 2009 Sun Microsystems, Inc.  All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.   */  #include <sys/conf.h> @@ -36,13 +35,14 @@  #include <sys/atomic.h>  #include <sys/sdt.h> -#include <stmf.h> -#include <stmf_ioctl.h> -#include <portif.h> -#include <fct.h> -#include <fct_impl.h> -#include <discovery.h> -#include <fctio.h> +#include <sys/stmf.h> +#include <sys/stmf_ioctl.h> +#include <sys/portif.h> +#include <sys/fct.h> +#include <sys/fctio.h> + +#include "fct_impl.h" +#include "discovery.h"  disc_action_t fct_handle_local_port_event(fct_i_local_port_t *iport);  disc_action_t fct_walk_discovery_queue(fct_i_local_port_t *iport); @@ -1106,7 +1106,7 @@ fct_register_remote_port(fct_local_port_t *port, fct_remote_port_t *rp,  	fct_i_local_port_t	*iport;  	fct_i_remote_port_t	*irp;  	int			i; -	char			info[160]; +	char			info[FCT_INFO_LEN];  	iport = (fct_i_local_port_t *)port->port_fct_private;  	irp = (fct_i_remote_port_t *)rp->rp_fct_private; @@ -1119,24 +1119,23 @@ fct_register_remote_port(fct_local_port_t *port, fct_remote_port_t *rp,  	rw_enter(&irp->irp_lock, RW_WRITER);  	if (rp->rp_handle != FCT_HANDLE_NONE) {  		if (rp->rp_handle >= port->port_max_logins) { -			(void) snprintf(info, 160, +			(void) snprintf(info, sizeof (info),  			    "fct_register_remote_port: FCA "  			    "returned a	handle (%d) for portid %x which is "  			    "out of range (max logins = %d)", rp->rp_handle,  			    rp->rp_id, port->port_max_logins); -			info[159] = 0;  			goto hba_fatal_err;  		}  		if ((iport->iport_rp_slots[rp->rp_handle] != NULL) &&  		    (iport->iport_rp_slots[rp->rp_handle] != irp)) {  			fct_i_remote_port_t *t_irp =  			    iport->iport_rp_slots[rp->rp_handle]; -			(void) snprintf(info, 160, "fct_register_remote_port: " +			(void) snprintf(info, sizeof (info), +			    "fct_register_remote_port: "  			    "FCA returned a handle %d for portid %x "  			    "which was already in use for a different "  			    "portid (%x)", rp->rp_handle, rp->rp_id,  			    t_irp->irp_rp->rp_id); -			info[159] = 0;  			goto hba_fatal_err;  		}  	} else { @@ -1148,10 +1147,10 @@ fct_register_remote_port(fct_local_port_t *port, fct_remote_port_t *rp,  		}  		if (i == port->port_max_logins) {  			/* This is really pushing it. */ -			(void) snprintf(info, 160, "fct_register_remote_port " +			(void) snprintf(info, sizeof (info), +			    "fct_register_remote_port "  			    "Cannot register portid %x because all the "  			    "handles are used up", rp->rp_id); -			info[159] = 0;  			goto hba_fatal_err;  		}  		rp->rp_handle = i; @@ -1236,7 +1235,7 @@ fct_send_accrjt(fct_cmd_t *cmd, uint8_t accrjt, uint8_t reason, uint8_t expl)  disc_action_t  fct_walk_discovery_queue(fct_i_local_port_t *iport)  { -	char			info[80]; +	char			info[FCT_INFO_LEN];  	fct_i_remote_port_t	**pirp;  	fct_i_remote_port_t	*prev_irp = NULL;  	disc_action_t		suggested_action = DISC_ACTION_NO_WORK; @@ -1345,12 +1344,11 @@ fct_walk_discovery_queue(fct_i_local_port_t *iport)  				 * It looks like we can't deregister it in the  				 * normal way, so we have to use extrem way  				 */ -				(void) snprintf(info, 80, +				(void) snprintf(info, sizeof (info),  				    "fct_walk_discovery_queue: "  				    "iport-%p, can't deregister irp-%p after "  				    "trying 5 times", (void *)iport,  				    (void *)irp_cur_item); -				info[79] = 0;  				(void) fct_port_shutdown(iport->iport_port,  				    STMF_RFLAG_FATAL_ERROR |  				    STMF_RFLAG_RESET, info); @@ -1393,7 +1391,7 @@ fct_process_plogi(fct_i_cmd_t *icmd)  	uint8_t			 cmd_type   = cmd->cmd_type;  	uint32_t		 icmd_flags = icmd->icmd_flags;  	clock_t			 end_time; -	char			 info[160]; +	char			 info[FCT_INFO_LEN];  	DTRACE_FC_4(rport__login__start,  	    fct_cmd_t, cmd, @@ -1420,11 +1418,10 @@ fct_process_plogi(fct_i_cmd_t *icmd)  		end_time = icmd->icmd_start_time +  		    drv_usectohz(USEC_ELS_TIMEOUT);  		if (ddi_get_lbolt() > end_time) { -			(void) snprintf(info, 160, +			(void) snprintf(info, sizeof (info),  			    "fct_process_plogi: unable to "  			    "clean up I/O. iport-%p, icmd-%p", (void *)iport,  			    (void *)icmd); -			info[159] = 0;  			(void) fct_port_shutdown(iport->iport_port,  			    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info); @@ -1570,7 +1567,7 @@ fct_process_prli(fct_i_cmd_t *icmd)  	stmf_scsi_session_t	*ses   = NULL;  	fct_status_t		 ret;  	clock_t			 end_time; -	char			 info[160]; +	char			 info[FCT_INFO_LEN];  	/* We dont support solicited PRLIs yet */  	ASSERT(cmd->cmd_type == FCT_CMD_RCVD_ELS); @@ -1621,11 +1618,10 @@ fct_process_prli(fct_i_cmd_t *icmd)  		end_time = icmd->icmd_start_time +  		    drv_usectohz(USEC_ELS_TIMEOUT);  		if (ddi_get_lbolt() > end_time) { -			(void) snprintf(info, 160, +			(void) snprintf(info, sizeof (info),  			    "fct_process_prli: unable to clean "  			    "up I/O. iport-%p, icmd-%p", (void *)iport,  			    (void *)icmd); -			info[159] = 0;  			(void) fct_port_shutdown(iport->iport_port,  			    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info); @@ -1722,7 +1718,7 @@ fct_process_logo(fct_i_cmd_t *icmd)  	fct_i_remote_port_t	*irp   = (fct_i_remote_port_t *)  	    rp->rp_fct_private;  	fct_status_t		 ret; -	char			 info[160]; +	char			 info[FCT_INFO_LEN];  	clock_t			 end_time;  	DTRACE_FC_4(rport__logout__start, @@ -1750,11 +1746,10 @@ fct_process_logo(fct_i_cmd_t *icmd)  		end_time = icmd->icmd_start_time +  		    drv_usectohz(USEC_ELS_TIMEOUT);  		if (ddi_get_lbolt() > end_time) { -			(void) snprintf(info, 160, +			(void) snprintf(info, sizeof (info),  			    "fct_process_logo: unable to clean "  			    "up I/O. iport-%p, icmd-%p", (void *)iport,  			    (void *)icmd); -			info[159] = 0;  			(void) fct_port_shutdown(iport->iport_port,  			    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info); @@ -1838,7 +1833,7 @@ fct_process_prlo(fct_i_cmd_t *icmd)  	    rp->rp_fct_private;  	fct_status_t		 ret;  	clock_t			 end_time; -	char			 info[160]; +	char			 info[FCT_INFO_LEN];  	/* We do not support solicited PRLOs yet */  	ASSERT(cmd->cmd_type == FCT_CMD_RCVD_ELS); @@ -1862,11 +1857,10 @@ fct_process_prlo(fct_i_cmd_t *icmd)  		end_time = icmd->icmd_start_time +  		    drv_usectohz(USEC_ELS_TIMEOUT);  		if (ddi_get_lbolt() > end_time) { -			(void) snprintf(info, 160, +			(void) snprintf(info, sizeof (info),  			    "fct_process_prlo: unable to "  			    "clean up I/O. iport-%p, icmd-%p", (void *)iport,  			    (void *)icmd); -			info[159] = 0;  			(void) fct_port_shutdown(iport->iport_port,  			    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info); diff --git a/usr/src/uts/common/io/comstar/port/fct/fct.c b/usr/src/uts/common/io/comstar/port/fct/fct.c index a50f5e4106..636ca74d32 100644 --- a/usr/src/uts/common/io/comstar/port/fct/fct.c +++ b/usr/src/uts/common/io/comstar/port/fct/fct.c @@ -35,13 +35,14 @@  #include <sys/atomic.h>  #include <sys/sdt.h> -#include <stmf.h> -#include <stmf_ioctl.h> -#include <portif.h> -#include <fct.h> -#include <fctio.h> -#include <fct_impl.h> -#include <discovery.h> +#include <sys/stmf.h> +#include <sys/stmf_ioctl.h> +#include <sys/portif.h> +#include <sys/fct.h> +#include <sys/fctio.h> + +#include "fct_impl.h" +#include "discovery.h"  static int fct_attach(dev_info_t *dip, ddi_attach_cmd_t cmd);  static int fct_detach(dev_info_t *dip, ddi_detach_cmd_t cmd); @@ -1135,7 +1136,7 @@ fct_register_local_port(fct_local_port_t *port)  	stmf_local_port_t	*lport;  	fct_cmd_slot_t		*slot;  	int			i; -	char			taskq_name[24]; +	char			taskq_name[FCT_TASKQ_NAME_LEN];  	iport = (fct_i_local_port_t *)port->port_fct_private;  	if (port->port_fca_version != FCT_FCA_MODREV_1) { @@ -1159,9 +1160,8 @@ fct_register_local_port(fct_local_port_t *port)  	}  	stmf_wwn_to_devid_desc((scsi_devid_desc_t *)iport->iport_id,  	    port->port_pwwn, PROTOCOL_FIBRE_CHANNEL); -	(void) snprintf(taskq_name, 24, "stmf_fct_taskq_%d", +	(void) snprintf(taskq_name, sizeof (taskq_name), "stmf_fct_taskq_%d",  	    atomic_add_32_nv(&taskq_cntr, 1)); -	taskq_name[23] = 0;  	if ((iport->iport_worker_taskq = ddi_taskq_create(NULL,  	    taskq_name, 1, TASKQ_DEFAULTPRI, 0)) == NULL) {  		return (FCT_FAILURE); @@ -1359,7 +1359,7 @@ void  fct_handle_event(fct_local_port_t *port, int event_id, uint32_t event_flags,  		caddr_t arg)  { -	char			info[80]; +	char			info[FCT_INFO_LEN];  	fct_i_event_t		*e;  	fct_i_local_port_t	*iport = (fct_i_local_port_t *)  	    port->port_fct_private; @@ -1370,10 +1370,9 @@ fct_handle_event(fct_local_port_t *port, int event_id, uint32_t event_flags,  		/*  		 * XXX Throw HBA fatal error event  		 */ -		(void) snprintf(info, 80, +		(void) snprintf(info, sizeof (info),  		    "fct_handle_event: iport-%p, allocation "  		    "of fct_i_event failed", (void *)iport); -		info[79] = 0;  		(void) fct_port_shutdown(iport->iport_port,  		    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info);  		return; @@ -2028,7 +2027,7 @@ fct_send_response_done(fct_cmd_t *cmd, fct_status_t s, uint32_t ioflags)  void  fct_cmd_free(fct_cmd_t *cmd)  { -	char			info[80]; +	char			info[FCT_INFO_LEN];  	fct_i_cmd_t		*icmd = (fct_i_cmd_t *)cmd->cmd_fct_private;  	fct_local_port_t	*port = cmd->cmd_port;  	fct_i_local_port_t	*iport = (fct_i_local_port_t *) @@ -2104,10 +2103,9 @@ fct_cmd_free(fct_cmd_t *cmd)  			 * XXX Throw HBA fatal error event  			 * Later shutdown svc will terminate the ABTS in the end  			 */ -			(void) snprintf(info, 80, +			(void) snprintf(info, sizeof (info),  			    "fct_cmd_free: iport-%p, ABTS_ACC"  			    " port_send_cmd_response failed", (void *)iport); -			info[79] = 0;  			(void) fct_port_shutdown(iport->iport_port,  			    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info);  			return; @@ -2807,16 +2805,16 @@ void  fct_cmd_fca_aborted(fct_cmd_t *cmd, fct_status_t s, uint32_t ioflags)  {  	fct_i_cmd_t		*icmd = (fct_i_cmd_t *)cmd->cmd_fct_private; -	char			info[160]; +	char			info[FCT_INFO_LEN];  	unsigned long long	st;  	st = s;	/* To make gcc happy */  	ASSERT(icmd->icmd_flags & ICMD_BEING_ABORTED);  	if ((((s != FCT_ABORT_SUCCESS) && (s != FCT_NOT_FOUND))) ||  	    ((ioflags & FCT_IOF_FCA_DONE) == 0)) { -		(void) snprintf(info, 160, "fct_cmd_fca_aborted: cmd-%p, " +		(void) snprintf(info, sizeof (info), +		    "fct_cmd_fca_aborted: cmd-%p, "  		    "s-%llx, iofalgs-%x", (void *)cmd, st, ioflags); -		info[159] = 0;  		(void) fct_port_shutdown(cmd->cmd_port,  		    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info);  		return; @@ -2903,7 +2901,7 @@ fct_fill_abts_acc(fct_cmd_t *cmd)  void  fct_handle_rcvd_abts(fct_cmd_t *cmd)  { -	char			info[80]; +	char			info[FCT_INFO_LEN];  	fct_local_port_t	*port = cmd->cmd_port;  	fct_i_local_port_t	*iport =  	    (fct_i_local_port_t *)port->port_fct_private; @@ -2983,11 +2981,10 @@ fct_handle_rcvd_abts(fct_cmd_t *cmd)  			 * XXX Throw HBA fatal error event  			 * Later shutdown svc will terminate the ABTS in the end  			 */ -			(void) snprintf(info, 80, +			(void) snprintf(info, sizeof (info),  			    "fct_handle_rcvd_abts: iport-%p, "  			    "ABTS_ACC port_send_cmd_response failed",  			    (void *)iport); -			info[79] = 0;  			(void) fct_port_shutdown(iport->iport_port,  			    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info);  		} else { @@ -3237,7 +3234,7 @@ fct_port_shutdown(fct_local_port_t *port, uint32_t rflags,  disc_action_t  fct_cmd_terminator(fct_i_local_port_t *iport)  { -	char			info[80]; +	char			info[FCT_INFO_LEN];  	clock_t			endtime;  	fct_i_cmd_t		**ppicmd;  	fct_i_cmd_t		*icmd; @@ -3288,12 +3285,11 @@ fct_cmd_terminator(fct_i_local_port_t *iport)  					 * svc will trigger fct_cmd_termination  					 * again.  					 */ -					(void) snprintf(info, 80, +					(void) snprintf(info, sizeof (info),  					    "fct_cmd_terminator:"  					    " iport-%p, port_abort_cmd with "  					    "FORCE_FCA_DONE failed",  					    (void *)iport); -					info[79] = 0;  					(void) fct_port_shutdown(  					    iport->iport_port,  					    STMF_RFLAG_FATAL_ERROR | @@ -3397,11 +3393,11 @@ fct_cmd_terminator(fct_i_local_port_t *iport)  					cmd_type[0] = 0;  				}  				st = cmd->cmd_comp_status;	/* gcc fix */ -				(void) snprintf(info, 80, "fct_cmd_terminator:" +				(void) snprintf(info, sizeof (info), +				    "fct_cmd_terminator:"  				    " iport-%p, cmd_type(0x%s),"  				    " reason(%llx)", (void *)iport, cmd_type,  				    st); -				info[79] = 0;  				(void) fct_port_shutdown(port,  				    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET,  				    info); diff --git a/usr/src/uts/common/io/comstar/port/iscsit/iscsit.c b/usr/src/uts/common/io/comstar/port/iscsit/iscsit.c index a53ab0755a..b8a1f2cc93 100644 --- a/usr/src/uts/common/io/comstar/port/iscsit/iscsit.c +++ b/usr/src/uts/common/io/comstar/port/iscsit/iscsit.c @@ -40,8 +40,9 @@  #include <sys/portif.h>  #include <sys/idm/idm.h>  #include <sys/idm/idm_conn_sm.h> -#include <iscsit_isns.h> -#include <iscsit.h> + +#include "iscsit_isns.h" +#include "iscsit.h"  #define	ISCSIT_VERSION		BUILD_DATE "-1.18dev"  #define	ISCSIT_NAME_VERSION	"COMSTAR ISCSIT v" ISCSIT_VERSION diff --git a/usr/src/uts/common/io/comstar/port/iscsit/iscsit.h b/usr/src/uts/common/io/comstar/port/iscsit/iscsit.h index 1da86e4138..b7a15d9759 100644 --- a/usr/src/uts/common/io/comstar/port/iscsit/iscsit.h +++ b/usr/src/uts/common/io/comstar/port/iscsit/iscsit.h @@ -25,9 +25,10 @@  #define	_ISCSIT_H_  #include <sys/iscsit/iscsi_if.h> -#include <iscsit_authclient.h>  #include <sys/iscsit/iscsit_common.h> +#include "iscsit_authclient.h" +  /*   * For some reason iscsi_protocol.h lists the max version as "0x02" and the   * min version as "0x00".  RFC3720 clearly states that the current version diff --git a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_auth.c b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_auth.c index 2281380b94..5ab5647ad1 100644 --- a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_auth.c +++ b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_auth.c @@ -19,8 +19,7 @@   * CDDL HEADER END   */  /* - * Copyright 2009 Sun Microsystems, Inc.  All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.   */  #include <sys/cpuvar.h> @@ -40,8 +39,9 @@  #include <sys/portif.h>  #include <sys/idm/idm.h>  #include <sys/idm/idm_text.h> -#include <iscsit.h> -#include <iscsit_auth.h> + +#include "iscsit.h" +#include "iscsit_auth.h"  static kv_status_t  iscsit_select_auth(iscsit_conn_t *ict, nvpair_t *nvp, diff --git a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_authclient.c b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_authclient.c index 85f101b7d8..6694f35a41 100644 --- a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_authclient.c +++ b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_authclient.c @@ -19,8 +19,7 @@   * CDDL HEADER END   */  /* - * Copyright 2009 Sun Microsystems, Inc.  All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.   */  #include <sys/types.h> @@ -36,11 +35,10 @@  #include <sys/stmf_ioctl.h>  #include <sys/portif.h>  #include <sys/idm/idm.h> - -#include <iscsit.h> -  #include <sys/iscsit/chap.h> -#include <radius_auth.h> + +#include "iscsit.h" +#include "radius_auth.h"  void  client_set_numeric_data(auth_key_block_t *keyBlock, diff --git a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_isns.c b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_isns.c index 2b610b5fa4..9cf733e43c 100644 --- a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_isns.c +++ b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_isns.c @@ -39,10 +39,11 @@  #include <sys/idm/idm_so.h>  #include <sys/iscsit/iscsit_common.h>  #include <sys/iscsit/isns_protocol.h> -#include <iscsit.h> -#include <iscsit_isns.h>  #include <sys/ksocket.h> +#include "iscsit.h" +#include "iscsit_isns.h" +  /*   * iscsit_isns.c -- isns client that is part of the iscsit server   * diff --git a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_isns.h b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_isns.h index 770a0da8e1..9c1b638faf 100644 --- a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_isns.h +++ b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_isns.h @@ -19,13 +19,12 @@   * CDDL HEADER END   */  /* - * Copyright 2009 Sun Microsystems, Inc.  All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.   */  #ifndef _ISNS_CLIENT_H_  #define	_ISNS_CLIENT_H_ -#include <iscsit.h> +#include "iscsit.h"  /*   * List of iSNS servers with which we register. diff --git a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_login.c b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_login.c index 9b32e589ec..a79a7c77db 100644 --- a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_login.c +++ b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_login.c @@ -19,8 +19,7 @@   * CDDL HEADER END   */  /* - * Copyright 2010 Sun Microsystems, Inc.  All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.   */  #include <sys/cpuvar.h> @@ -44,8 +43,8 @@  #include <sys/idm/idm_text.h>  #define	ISCSIT_LOGIN_SM_STRINGS -#include <iscsit.h> -#include <iscsit_auth.h> +#include "iscsit.h" +#include "iscsit_auth.h"  typedef struct {  	list_node_t		le_ctx_node; diff --git a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_radiusauth.c b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_radiusauth.c index ba515c2b59..de7de5bf9c 100644 --- a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_radiusauth.c +++ b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_radiusauth.c @@ -19,8 +19,7 @@   * CDDL HEADER END   */  /* - * Copyright 2008 Sun Microsystems, Inc.  All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.   */  #include <sys/random.h> @@ -32,7 +31,8 @@  #include <sys/idm/idm_so.h>  #include <sys/iscsit/radius_packet.h>  #include <sys/iscsit/radius_protocol.h> -#include <radius_auth.h> + +#include "radius_auth.h"  /* Forward declaration */  /* diff --git a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_sess.c b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_sess.c index 39eda2afb7..4544abe069 100644 --- a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_sess.c +++ b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_sess.c @@ -42,7 +42,7 @@  #include <sys/idm/idm.h>  #define	ISCSIT_SESS_SM_STRINGS -#include <iscsit.h> +#include "iscsit.h"  typedef struct {  	list_node_t		se_ctx_node; diff --git a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_text.c b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_text.c index 56574f9bf2..ff812ea722 100644 --- a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_text.c +++ b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_text.c @@ -19,8 +19,7 @@   * CDDL HEADER END   */  /* - * Copyright 2010 Sun Microsystems, Inc.  All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.   */  #include <sys/cpuvar.h> @@ -43,8 +42,9 @@  #include <sys/idm/idm_conn_sm.h>  #include <sys/idm/idm_text.h>  #include <sys/idm/idm_so.h> -#include <iscsit_isns.h> -#include <iscsit.h> + +#include "iscsit_isns.h" +#include "iscsit.h"  #define	IPADDRSTRLEN	INET6_ADDRSTRLEN	/* space for ipaddr string */  #define	PORTALSTRLEN	(IPADDRSTRLEN+16)	/* add space for :port,tag */ diff --git a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_tgt.c b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_tgt.c index 803ef239fb..4f42d45277 100644 --- a/usr/src/uts/common/io/comstar/port/iscsit/iscsit_tgt.c +++ b/usr/src/uts/common/io/comstar/port/iscsit/iscsit_tgt.c @@ -41,8 +41,8 @@  #include <sys/idm/idm.h>  #define	ISCSIT_TGT_SM_STRINGS -#include <iscsit.h> -#include <iscsit_isns.h> +#include "iscsit.h" +#include "iscsit_isns.h"  typedef struct {  	list_node_t		te_ctx_node; diff --git a/usr/src/uts/common/io/comstar/port/pppt/alua_ic_if.c b/usr/src/uts/common/io/comstar/port/pppt/alua_ic_if.c index 793aee301a..5883af6e15 100644 --- a/usr/src/uts/common/io/comstar/port/pppt/alua_ic_if.c +++ b/usr/src/uts/common/io/comstar/port/pppt/alua_ic_if.c @@ -40,9 +40,9 @@  #include <sys/lpif.h>  #include <sys/stmf_ioctl.h>  #include <sys/portif.h> -#include <pppt.h>  #include <sys/pppt_ic_if.h> +#include "pppt.h"  /*   * Macros diff --git a/usr/src/uts/common/io/comstar/port/pppt/pppt.c b/usr/src/uts/common/io/comstar/port/pppt/pppt.c index 82094a9625..64989e7109 100644 --- a/usr/src/uts/common/io/comstar/port/pppt/pppt.c +++ b/usr/src/uts/common/io/comstar/port/pppt/pppt.c @@ -19,8 +19,7 @@   * CDDL HEADER END   */  /* - * Copyright 2009 Sun Microsystems, Inc.  All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.   */  #include <sys/cpuvar.h> @@ -40,7 +39,8 @@  #include <sys/stmf_ioctl.h>  #include <sys/pppt_ioctl.h>  #include <sys/portif.h> -#include <pppt.h> + +#include "pppt.h"  #define	PPPT_VERSION		BUILD_DATE "-1.18dev"  #define	PPPT_NAME_VERSION	"COMSTAR PPPT v" PPPT_VERSION diff --git a/usr/src/uts/common/io/comstar/port/pppt/pppt_msg.c b/usr/src/uts/common/io/comstar/port/pppt/pppt_msg.c index 83c3f5e3d1..d15374b773 100644 --- a/usr/src/uts/common/io/comstar/port/pppt/pppt_msg.c +++ b/usr/src/uts/common/io/comstar/port/pppt/pppt_msg.c @@ -38,7 +38,8 @@  #include <sys/stmf.h>  #include <sys/stmf_ioctl.h>  #include <sys/portif.h> -#include <pppt.h> + +#include "pppt.h"  static void pppt_msg_tgt_register(stmf_ic_msg_t *reg_port); diff --git a/usr/src/uts/common/io/comstar/port/pppt/pppt_tgt.c b/usr/src/uts/common/io/comstar/port/pppt/pppt_tgt.c index 60408027dc..fbf8ad876f 100644 --- a/usr/src/uts/common/io/comstar/port/pppt/pppt_tgt.c +++ b/usr/src/uts/common/io/comstar/port/pppt/pppt_tgt.c @@ -19,8 +19,7 @@   * CDDL HEADER END   */  /* - * Copyright 2009 Sun Microsystems, Inc.  All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.   */  #include <sys/cpuvar.h> @@ -42,7 +41,7 @@  #include <sys/stmf_ioctl.h>  #include <sys/portif.h>  #define	PPPT_TGT_SM_STRINGS -#include <pppt.h> +#include "pppt.h"  typedef struct {  	list_node_t		te_ctx_node; diff --git a/usr/src/uts/common/io/comstar/port/qlt/qlt.c b/usr/src/uts/common/io/comstar/port/qlt/qlt.c index b4941b5fd6..ff7dcad9eb 100644 --- a/usr/src/uts/common/io/comstar/port/qlt/qlt.c +++ b/usr/src/uts/common/io/comstar/port/qlt/qlt.c @@ -40,16 +40,17 @@  #include <sys/atomic.h>  #include <sys/scsi/scsi.h> -#include <stmf_defines.h> -#include <fct_defines.h> -#include <stmf.h> -#include <portif.h> -#include <fct.h> -#include <qlt.h> -#include <qlt_dma.h> -#include <qlt_ioctl.h> -#include <qlt_open.h> -#include <stmf_ioctl.h> +#include <sys/stmf_defines.h> +#include <sys/fct_defines.h> +#include <sys/stmf.h> +#include <sys/stmf_ioctl.h> +#include <sys/portif.h> +#include <sys/fct.h> + +#include "qlt.h" +#include "qlt_dma.h" +#include "qlt_ioctl.h" +#include "qlt_open.h"  static int qlt_attach(dev_info_t *dip, ddi_attach_cmd_t cmd);  static int qlt_detach(dev_info_t *dip, ddi_detach_cmd_t cmd); @@ -1694,7 +1695,7 @@ qlt_ioctl(dev_t dev, int cmd, intptr_t data, int mode,  	qlt_fw_info_t	*fwi;  	mbox_cmd_t	*mcp;  	fct_status_t	st; -	char		info[80]; +	char		info[QLT_INFO_LEN];  	fct_status_t	ret2;  	if (drv_priv(credp) != 0) @@ -1748,9 +1749,8 @@ qlt_ioctl(dev_t dev, int cmd, intptr_t data, int mode,  			iocd->stmf_error = QLTIO_NOT_ONLINE;  			break;  		} -		(void) snprintf(info, 80, "qlt_ioctl: qlt-%p, " +		(void) snprintf(info, sizeof (info), "qlt_ioctl: qlt-%p, "  		    "user triggered FWDUMP with RFLAG_RESET", (void *)qlt); -		info[79] = 0;  		if ((ret2 = fct_port_shutdown(qlt->qlt_port,  		    STMF_RFLAG_USER_REQUEST | STMF_RFLAG_RESET |  		    STMF_RFLAG_COLLECT_DEBUG_DUMP, info)) != FCT_SUCCESS) { @@ -2501,7 +2501,7 @@ qlt_mailbox_command(qlt_state_t *qlt, mbox_cmd_t *mcp)  {  	int	retries;  	int	i; -	char	info[80]; +	char	info[QLT_INFO_LEN];  	if (curthread->t_flag & T_INTR_THREAD) {  		ASSERT(0); @@ -2541,9 +2541,9 @@ qlt_mbox_wait_loop:;  	/* Wait for mailbox command completion */  	if (cv_timedwait(&qlt->mbox_cv, &qlt->mbox_lock, ddi_get_lbolt()  	    + drv_usectohz(MBOX_TIMEOUT)) < 0) { -		(void) snprintf(info, 80, "qlt_mailbox_command: qlt-%p, " +		(void) snprintf(info, sizeof (info), +		    "qlt_mailbox_command: qlt-%p, "  		    "cmd-0x%02X timed out", (void *)qlt, qlt->mcp->to_fw[0]); -		info[79] = 0;  		qlt->mcp = NULL;  		qlt->mbox_io_state = MBOX_STATE_UNKNOWN;  		mutex_exit(&qlt->mbox_lock); @@ -2588,7 +2588,7 @@ qlt_isr(caddr_t arg, caddr_t arg2)  	uint32_t	risc_status, intr_type;  	int		i;  	int		intr_loop_count; -	char		info[80]; +	char		info[QLT_INFO_LEN];  	risc_status = REG_RD32(qlt, REG_RISC_STATUS);  	if (!mutex_tryenter(&qlt->intr_lock)) { @@ -2643,8 +2643,8 @@ intr_again:;  		EL(qlt, "Risc Pause status=%xh\n", risc_status);  		cmn_err(CE_WARN, "qlt(%d): Risc Pause %08x",  		    qlt->instance, risc_status); -		(void) snprintf(info, 80, "Risc Pause %08x", risc_status); -		info[79] = 0; +		(void) snprintf(info, sizeof (info), "Risc Pause %08x", +		    risc_status);  		(void) fct_port_shutdown(qlt->qlt_port,  		    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET |  		    STMF_RFLAG_COLLECT_DEBUG_DUMP, info); @@ -2712,15 +2712,14 @@ intr_again:;  			    0, 0);  		} else if ((code == 0x8002) || (code == 0x8003) ||  		    (code == 0x8004) || (code == 0x8005)) { -			(void) snprintf(info, 80, +			(void) snprintf(info, sizeof (info),  			    "Got %04x, mb1=%x mb2=%x mb5=%x mb6=%x",  			    code, mbox1, mbox2, mbox5, mbox6); -			info[79] = 0;  			(void) fct_port_shutdown(qlt->qlt_port,  			    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET |  			    STMF_RFLAG_COLLECT_DEBUG_DUMP, info);  		} else if (code == 0x800F) { -			(void) snprintf(info, 80, +			(void) snprintf(info, sizeof (info),  			    "Got 800F, mb1=%x mb2=%x mb3=%x",  			    mbox1, mbox2, mbox3); @@ -2729,10 +2728,9 @@ intr_again:;  				qlt_verify_fw(qlt);  			}  		} else if (code == 0x8101) { -			(void) snprintf(info, 80, +			(void) snprintf(info, sizeof (info),  			    "IDC Req Rcvd:%04x, mb1=%x mb2=%x mb3=%x",  			    code, mbox1, mbox2, mbox3); -			info[79] = 0;  			/* check if "ACK" is required (timeout != 0) */  			if (mbox1 & 0x0f00) { @@ -2756,9 +2754,8 @@ intr_again:;  					QMEM_WR16(qlt, req+20, mbox6);  					qlt_submit_req_entries(qlt, 1);  				} else { -					(void) snprintf(info, 80, +					(void) snprintf(info, sizeof (info),  					    "IDC ACK failed"); -					info[79] = 0;  				}  				mutex_exit(&qlt->req_lock);  			} @@ -3266,7 +3263,7 @@ qlt_handle_purex(qlt_state_t *qlt, uint8_t *resp)  	uint8_t			*pldptr, *bndrptr;  	int			i, off;  	uint16_t		iocb_flags; -	char			info[160]; +	char			info[QLT_INFO_LEN];  	remote_portid = ((uint32_t)(QMEM_RD16(qlt, (&resp[0x18])))) |  	    ((uint32_t)(resp[0x1A])) << 16; @@ -3288,9 +3285,9 @@ qlt_handle_purex(qlt_state_t *qlt, uint8_t *resp)  	if (cmd == NULL) {  		EL(qlt, "fct_alloc cmd==NULL\n");  cmd_null:; -		(void) snprintf(info, 160, "qlt_handle_purex: qlt-%p, can't " -		    "allocate space for fct_cmd", (void *)qlt); -		info[159] = 0; +		(void) snprintf(info, sizeof (info), +		    "qlt_handle_purex: qlt-%p, " +		    "can't allocate space for fct_cmd", (void *)qlt);  		(void) fct_port_shutdown(qlt->qlt_port,  		    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info);  		return; @@ -3337,7 +3334,7 @@ fct_status_t  qlt_send_cmd_response(fct_cmd_t *cmd, uint32_t ioflags)  {  	qlt_state_t	*qlt; -	char		info[160]; +	char		info[QLT_INFO_LEN];  	qlt = (qlt_state_t *)cmd->cmd_port->port_fca_private; @@ -3371,10 +3368,10 @@ qlt_send_cmd_response(fct_cmd_t *cmd, uint32_t ioflags)  	}  fatal_panic:; -	(void) snprintf(info, 160, "qlt_send_cmd_response: can not handle " +	(void) snprintf(info, sizeof (info), +	    "qlt_send_cmd_response: can not handle "  	    "FCT_IOF_FORCE_FCA_DONE for cmd %p, ioflags-%x", (void *)cmd,  	    ioflags); -	info[159] = 0;  	(void) fct_port_shutdown(qlt->qlt_port,  	    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info);  	return (FCT_FAILURE); @@ -3901,7 +3898,7 @@ qlt_handle_atio(qlt_state_t *qlt, uint8_t *atio)  	uint32_t	rportid, fw_xchg_addr;  	uint8_t		*p, *q, *req, tm;  	uint16_t	cdb_size, flags, oxid; -	char		info[160]; +	char		info[QLT_INFO_LEN];  	/*  	 * If either bidirection xfer is requested of there is extended @@ -3964,10 +3961,9 @@ qlt_handle_atio(qlt_state_t *qlt, uint8_t *atio)  		if (req == NULL) {  			mutex_exit(&qlt->req_lock); -			(void) snprintf(info, 160, +			(void) snprintf(info, sizeof (info),  			    "qlt_handle_atio: qlt-%p, can't "  			    "allocate space for scsi_task", (void *)qlt); -			info[159] = 0;  			(void) fct_port_shutdown(qlt->qlt_port,  			    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info);  			return; @@ -4112,7 +4108,7 @@ qlt_handle_dereg_completion(qlt_state_t *qlt, uint8_t *rsp)  static void  qlt_handle_unsol_els_completion(qlt_state_t *qlt, uint8_t *rsp)  { -	char		info[160]; +	char		info[QLT_INFO_LEN];  	fct_cmd_t	*cmd;  	qlt_cmd_t	*qcmd;  	uint32_t	hndl; @@ -4131,10 +4127,10 @@ qlt_handle_unsol_els_completion(qlt_state_t *qlt, uint8_t *rsp)  		 * only happen when abort for an unsol els completes.  		 * This condition indicates a firmware bug.  		 */ -		(void) snprintf(info, 160, "qlt_handle_unsol_els_completion: " +		(void) snprintf(info, sizeof (info), +		    "qlt_handle_unsol_els_completion: "  		    "Invalid handle: hndl-%x, status-%x/%x/%x, rsp-%p",  		    hndl, status, subcode1, subcode2, (void *)rsp); -		info[159] = 0;  		(void) fct_port_shutdown(qlt->qlt_port,  		    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET |  		    STMF_RFLAG_COLLECT_DEBUG_DUMP, info); @@ -4159,11 +4155,10 @@ qlt_handle_unsol_els_completion(qlt_state_t *qlt, uint8_t *rsp)  		/*  		 * Now why would this happen ???  		 */ -		(void) snprintf(info, 160, +		(void) snprintf(info, sizeof (info),  		    "qlt_handle_unsol_els_completion: can not "  		    "get cmd, hndl-%x, status-%x, rsp-%p", hndl, status,  		    (void *)rsp); -		info[159] = 0;  		(void) fct_port_shutdown(qlt->qlt_port,  		    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info); @@ -4200,7 +4195,7 @@ qlt_handle_unsol_els_completion(qlt_state_t *qlt, uint8_t *rsp)  static void  qlt_handle_unsol_els_abort_completion(qlt_state_t *qlt, uint8_t *rsp)  { -	char		info[160]; +	char		info[QLT_INFO_LEN];  	fct_cmd_t	*cmd;  	qlt_cmd_t	*qcmd;  	uint32_t	hndl; @@ -4225,11 +4220,10 @@ qlt_handle_unsol_els_abort_completion(qlt_state_t *qlt, uint8_t *rsp)  			 * There could be exchange resource leakage, so  			 * throw HBA fatal error event now  			 */ -			(void) snprintf(info, 160, +			(void) snprintf(info, sizeof (info),  			    "qlt_handle_unsol_els_abort_completion: "  			    "Invalid handle: hndl-%x, status-%x/%x/%x, rsp-%p",  			    hndl, status, subcode1, subcode2, (void *)rsp); -			info[159] = 0;  			(void) fct_port_shutdown(qlt->qlt_port,  			    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET |  			    STMF_RFLAG_COLLECT_DEBUG_DUMP, info); @@ -4245,11 +4239,10 @@ qlt_handle_unsol_els_abort_completion(qlt_state_t *qlt, uint8_t *rsp)  		/*  		 * Why would this happen ??  		 */ -		(void) snprintf(info, 160, +		(void) snprintf(info, sizeof (info),  		    "qlt_handle_unsol_els_abort_completion: can not get "  		    "cmd, hndl-%x, status-%x, rsp-%p", hndl, status,  		    (void *)rsp); -		info[159] = 0;  		(void) fct_port_shutdown(qlt->qlt_port,  		    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info); @@ -4278,7 +4271,7 @@ qlt_handle_unsol_els_abort_completion(qlt_state_t *qlt, uint8_t *rsp)  static void  qlt_handle_sol_els_completion(qlt_state_t *qlt, uint8_t *rsp)  { -	char		info[160]; +	char		info[QLT_INFO_LEN];  	fct_cmd_t	*cmd;  	fct_els_t	*els;  	qlt_cmd_t	*qcmd; @@ -4296,10 +4289,10 @@ qlt_handle_sol_els_completion(qlt_state_t *qlt, uint8_t *rsp)  		/*  		 * This cannot happen for sol els completion.  		 */ -		(void) snprintf(info, 160, "qlt_handle_sol_els_completion: " +		(void) snprintf(info, sizeof (info), +		    "qlt_handle_sol_els_completion: "  		    "Invalid handle: hndl-%x, status-%x/%x/%x, rsp-%p",  		    hndl, status, subcode1, subcode2, (void *)rsp); -		info[159] = 0;  		(void) fct_port_shutdown(qlt->qlt_port,  		    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET |  		    STMF_RFLAG_COLLECT_DEBUG_DUMP, info); @@ -4309,11 +4302,10 @@ qlt_handle_sol_els_completion(qlt_state_t *qlt, uint8_t *rsp)  	cmd = fct_handle_to_cmd(qlt->qlt_port, hndl);  	if (cmd == NULL) {  		EL(qlt, "fct_handle_to_cmd cmd==NULL, hndl=%xh\n", hndl); -		(void) snprintf(info, 160, +		(void) snprintf(info, sizeof (info),  		    "qlt_handle_sol_els_completion: can not "  		    "get cmd, hndl-%x, status-%x, rsp-%p", hndl, status,  		    (void *)rsp); -		info[159] = 0;  		(void) fct_port_shutdown(qlt->qlt_port,  		    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info); @@ -4359,7 +4351,7 @@ qlt_handle_ct_completion(qlt_state_t *qlt, uint8_t *rsp)  	qlt_cmd_t	*qcmd;  	uint32_t	 hndl;  	uint16_t	 status; -	char		 info[160]; +	char		 info[QLT_INFO_LEN];  	hndl = QMEM_RD32(qlt, rsp+4);  	status = QMEM_RD16(qlt, rsp+8); @@ -4369,9 +4361,9 @@ qlt_handle_ct_completion(qlt_state_t *qlt, uint8_t *rsp)  		/*  		 * Solicited commands will always have a valid handle.  		 */ -		(void) snprintf(info, 160, "qlt_handle_ct_completion: hndl-" -		    "%x, status-%x, rsp-%p", hndl, status, (void *)rsp); -		info[159] = 0; +		(void) snprintf(info, sizeof (info), +		    "qlt_handle_ct_completion: " +		    "hndl-%x, status-%x, rsp-%p", hndl, status, (void *)rsp);  		(void) fct_port_shutdown(qlt->qlt_port,  		    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET |  		    STMF_RFLAG_COLLECT_DEBUG_DUMP, info); @@ -4381,11 +4373,10 @@ qlt_handle_ct_completion(qlt_state_t *qlt, uint8_t *rsp)  	cmd = fct_handle_to_cmd(qlt->qlt_port, hndl);  	if (cmd == NULL) {  		EL(qlt, "fct_handle_to_cmd cmd==NULL, hndl=%xh\n", hndl); -		(void) snprintf(info, 160, +		(void) snprintf(info, sizeof (info),  		    "qlt_handle_ct_completion: cannot find "  		    "cmd, hndl-%x, status-%x, rsp-%p", hndl, status,  		    (void *)rsp); -		info[159] = 0;  		(void) fct_port_shutdown(qlt->qlt_port,  		    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info); @@ -4434,7 +4425,7 @@ qlt_handle_ctio_completion(qlt_state_t *qlt, uint8_t *rsp)  	uint16_t	flags;  	uint8_t		abort_req;  	uint8_t		n; -	char		info[160]; +	char		info[QLT_INFO_LEN];  	/* XXX: Check validity of the IOCB by checking 4th byte. */  	hndl = QMEM_RD32(qlt, rsp+4); @@ -4457,10 +4448,9 @@ qlt_handle_ctio_completion(qlt_state_t *qlt, uint8_t *rsp)  			 * There could be exchange resource leakage, so  			 * throw HBA fatal error event now  			 */ -			(void) snprintf(info, 160, +			(void) snprintf(info, sizeof (info),  			    "qlt_handle_ctio_completion: hndl-"  			    "%x, status-%x, rsp-%p", hndl, status, (void *)rsp); -			info[159] = 0;  			(void) fct_port_shutdown(qlt->qlt_port,  			    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info); @@ -4480,11 +4470,10 @@ qlt_handle_ctio_completion(qlt_state_t *qlt, uint8_t *rsp)  	cmd = fct_handle_to_cmd(qlt->qlt_port, hndl);  	if (cmd == NULL) {  		EL(qlt, "fct_handle_to_cmd cmd==NULL, hndl=%xh\n", hndl); -		(void) snprintf(info, 160, +		(void) snprintf(info, sizeof (info),  		    "qlt_handle_ctio_completion: cannot find "  		    "cmd, hndl-%x, status-%x, rsp-%p", hndl, status,  		    (void *)rsp); -		info[159] = 0;  		(void) fct_port_shutdown(qlt->qlt_port,  		    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info); @@ -4553,7 +4542,7 @@ qlt_handle_ctio_completion(qlt_state_t *qlt, uint8_t *rsp)  static void  qlt_handle_sol_abort_completion(qlt_state_t *qlt, uint8_t *rsp)  { -	char		info[80]; +	char		info[QLT_INFO_LEN];  	fct_cmd_t	*cmd;  	qlt_cmd_t	*qcmd;  	uint32_t	h; @@ -4567,10 +4556,9 @@ qlt_handle_sol_abort_completion(qlt_state_t *qlt, uint8_t *rsp)  		/*  		 * Solicited commands always have a valid handle.  		 */ -		(void) snprintf(info, 80, +		(void) snprintf(info, sizeof (info),  		    "qlt_handle_sol_abort_completion: hndl-"  		    "%x, status-%x, rsp-%p", h, status, (void *)rsp); -		info[79] = 0;  		(void) fct_port_shutdown(qlt->qlt_port,  		    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET |  		    STMF_RFLAG_COLLECT_DEBUG_DUMP, info); @@ -4582,11 +4570,10 @@ qlt_handle_sol_abort_completion(qlt_state_t *qlt, uint8_t *rsp)  		/*  		 * What happened to the cmd ??  		 */ -		(void) snprintf(info, 80, +		(void) snprintf(info, sizeof (info),  		    "qlt_handle_sol_abort_completion: cannot "  		    "find cmd, hndl-%x, status-%x, rsp-%p", h, status,  		    (void *)rsp); -		info[79] = 0;  		(void) fct_port_shutdown(qlt->qlt_port,  		    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info); @@ -4616,7 +4603,7 @@ qlt_handle_rcvd_abts(qlt_state_t *qlt, uint8_t *resp)  	qlt_abts_cmd_t	*qcmd;  	fct_cmd_t	*cmd;  	uint32_t	remote_portid; -	char		info[160]; +	char		info[QLT_INFO_LEN];  	remote_portid = ((uint32_t)(QMEM_RD16(qlt, (&resp[0x18])))) |  	    ((uint32_t)(resp[0x1A])) << 16; @@ -4624,10 +4611,9 @@ qlt_handle_rcvd_abts(qlt_state_t *qlt, uint8_t *resp)  	    sizeof (qlt_abts_cmd_t), 0);  	if (cmd == NULL) {  		EL(qlt, "fct_alloc cmd==NULL\n"); -		(void) snprintf(info, 160, +		(void) snprintf(info, sizeof (info),  		    "qlt_handle_rcvd_abts: qlt-%p, can't "  		    "allocate space for fct_cmd", (void *)qlt); -		info[159] = 0;  		(void) fct_port_shutdown(qlt->qlt_port,  		    STMF_RFLAG_FATAL_ERROR | STMF_RFLAG_RESET, info);  		return; @@ -4653,7 +4639,7 @@ static void  qlt_handle_abts_completion(qlt_state_t *qlt, uint8_t *resp)  {  	uint16_t status; -	char	info[80]; +	char	info[QLT_INFO_LEN];  	status = QMEM_RD16(qlt, resp+8); @@ -4661,10 +4647,10 @@ qlt_handle_abts_completion(qlt_state_t *qlt, uint8_t *resp)  		return;  	}  	EL(qlt, "status = %xh\n", status); -	(void) snprintf(info, 80, "ABTS completion failed %x/%x/%x resp_off %x", +	(void) snprintf(info, sizeof (info), +	    "ABTS completion failed %x/%x/%x resp_off %x",  	    status, QMEM_RD32(qlt, resp+0x34), QMEM_RD32(qlt, resp+0x38),  	    ((uint32_t)(qlt->resp_ndx_to_fw)) << 6); -	info[79] = 0;  	(void) fct_port_shutdown(qlt->qlt_port, STMF_RFLAG_FATAL_ERROR |  	    STMF_RFLAG_RESET | STMF_RFLAG_COLLECT_DEBUG_DUMP, info);  } @@ -5872,18 +5858,20 @@ static void  qlt_handle_verify_fw_completion(qlt_state_t *qlt, uint8_t *rsp)  {  	uint16_t	status; -	char		info[80]; +	char		info[QLT_INFO_LEN];  	status = QMEM_RD16(qlt, rsp+8);  	if (status != 0) { -		(void) snprintf(info, 80, "qlt_handle_verify_fw_completion: " +		(void) snprintf(info, sizeof (info), +		    "qlt_handle_verify_fw_completion: "  		    "status:%x, rsp:%p", status, (void *)rsp);  		if (status == 3) {  			uint16_t error_code;  			error_code = QMEM_RD16(qlt, rsp+0xA); -			(void) snprintf(info, 80, "qlt_handle_verify_fw_" -			    "completion: error code:%x", error_code); +			(void) snprintf(info, sizeof (info), +			    "qlt_handle_verify_fw_completion: error code:%x", +			    error_code);  		}  	}  } diff --git a/usr/src/uts/common/io/comstar/port/qlt/qlt.h b/usr/src/uts/common/io/comstar/port/qlt/qlt.h index 8d9c6bebce..a9e6019062 100644 --- a/usr/src/uts/common/io/comstar/port/qlt/qlt.h +++ b/usr/src/uts/common/io/comstar/port/qlt/qlt.h @@ -31,8 +31,8 @@  #ifndef	_QLT_H  #define	_QLT_H -#include <stmf_defines.h> -#include <qlt_regs.h> +#include <sys/stmf_defines.h> +#include "qlt_regs.h"  #ifdef	__cplusplus  extern "C" { @@ -412,6 +412,7 @@ typedef struct {  #define	TOTAL_DMA_MEM_SIZE	(MBOX_DMA_MEM_OFFSET + MBOX_DMA_MEM_SIZE)  #define	QLT_MAX_ITERATIONS_PER_INTR	32 +#define	QLT_INFO_LEN			160  #define	REG_RD16(qlt, addr) \  	ddi_get16(qlt->regs_acc_handle, (uint16_t *)(qlt->regs + addr)) diff --git a/usr/src/uts/common/io/comstar/port/qlt/qlt_dma.c b/usr/src/uts/common/io/comstar/port/qlt/qlt_dma.c index 7020a56566..eb35b73bd3 100644 --- a/usr/src/uts/common/io/comstar/port/qlt/qlt_dma.c +++ b/usr/src/uts/common/io/comstar/port/qlt/qlt_dma.c @@ -33,13 +33,14 @@  #include <sys/sunddi.h>  #include <sys/modctl.h> -#include <stmf_defines.h> -#include <fct_defines.h> -#include <stmf.h> -#include <portif.h> -#include <fct.h> -#include <qlt.h> -#include <qlt_dma.h> +#include <sys/stmf_defines.h> +#include <sys/fct_defines.h> +#include <sys/stmf.h> +#include <sys/portif.h> +#include <sys/fct.h> + +#include "qlt.h" +#include "qlt_dma.h"  /*   *  Local Function Prototypes. diff --git a/usr/src/uts/common/io/comstar/port/qlt/qlt_dma.h b/usr/src/uts/common/io/comstar/port/qlt/qlt_dma.h index 28e107bbc7..e2df49c0ed 100644 --- a/usr/src/uts/common/io/comstar/port/qlt/qlt_dma.h +++ b/usr/src/uts/common/io/comstar/port/qlt/qlt_dma.h @@ -31,7 +31,7 @@  #ifndef	_QLT_DMA_H  #define	_QLT_DMA_H -#include <stmf.h> +#include <sys/stmf.h>  #ifdef	__cplusplus  extern "C" { diff --git a/usr/src/uts/common/io/comstar/port/qlt/qlt_regs.h b/usr/src/uts/common/io/comstar/port/qlt/qlt_regs.h index 0bf52b3ba6..1e2570e4e8 100644 --- a/usr/src/uts/common/io/comstar/port/qlt/qlt_regs.h +++ b/usr/src/uts/common/io/comstar/port/qlt/qlt_regs.h @@ -25,14 +25,13 @@   */  /* - * Copyright 2008 Sun Microsystems, Inc.  All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.   */  #ifndef	_QLT_REGS_H  #define	_QLT_REGS_H -#include <stmf_defines.h> +#include <sys/stmf_defines.h>  #ifdef	__cplusplus  extern "C" { diff --git a/usr/src/uts/common/io/comstar/port/srpt/srpt_ch.c b/usr/src/uts/common/io/comstar/port/srpt/srpt_ch.c index 271aea6c36..12e391eea8 100644 --- a/usr/src/uts/common/io/comstar/port/srpt/srpt_ch.c +++ b/usr/src/uts/common/io/comstar/port/srpt/srpt_ch.c @@ -20,8 +20,7 @@   */  /* - * Copyright 2010 Sun Microsystems, Inc.  All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.   */  /* @@ -43,9 +42,9 @@  #include <sys/scsi/scsi.h>  #include <sys/ib/ibtl/ibti.h> -#include <stmf.h> -#include <stmf_ioctl.h> -#include <portif.h> +#include <sys/stmf.h> +#include <sys/stmf_ioctl.h> +#include <sys/portif.h>  #include "srp.h"  #include "srpt_impl.h" diff --git a/usr/src/uts/common/io/comstar/port/srpt/srpt_cm.c b/usr/src/uts/common/io/comstar/port/srpt/srpt_cm.c index 2c801ed61c..078a84730d 100644 --- a/usr/src/uts/common/io/comstar/port/srpt/srpt_cm.c +++ b/usr/src/uts/common/io/comstar/port/srpt/srpt_cm.c @@ -20,8 +20,7 @@   */  /* - * Copyright 2009 Sun Microsystems, Inc.  All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.   */  /* @@ -42,9 +41,9 @@  #include <sys/taskq.h>  #include <sys/ib/ibtl/ibti.h> -#include <stmf.h> -#include <stmf_ioctl.h> -#include <portif.h> +#include <sys/stmf.h> +#include <sys/stmf_ioctl.h> +#include <sys/portif.h>  #include "srp.h"  #include "srpt_impl.h" diff --git a/usr/src/uts/common/io/comstar/port/srpt/srpt_impl.h b/usr/src/uts/common/io/comstar/port/srpt/srpt_impl.h index ebb7d7a8eb..e5ef739a87 100644 --- a/usr/src/uts/common/io/comstar/port/srpt/srpt_impl.h +++ b/usr/src/uts/common/io/comstar/port/srpt/srpt_impl.h @@ -35,9 +35,9 @@  #include <sys/ib/ibtl/ibti.h>  #include <sys/modctl.h> -#include <stmf.h> -#include <stmf_ioctl.h> -#include <portif.h> +#include <sys/stmf.h> +#include <sys/stmf_ioctl.h> +#include <sys/portif.h>  #include <sys/ib/mgt/ibdma/ibdma.h> diff --git a/usr/src/uts/common/io/comstar/port/srpt/srpt_mod.c b/usr/src/uts/common/io/comstar/port/srpt/srpt_mod.c index 829d67eca8..979f3547b3 100644 --- a/usr/src/uts/common/io/comstar/port/srpt/srpt_mod.c +++ b/usr/src/uts/common/io/comstar/port/srpt/srpt_mod.c @@ -40,9 +40,9 @@  #include <sys/sdt.h>  #include <sys/taskq.h> -#include <stmf.h> -#include <stmf_ioctl.h> -#include <portif.h> +#include <sys/stmf.h> +#include <sys/stmf_ioctl.h> +#include <sys/portif.h>  #include "srp.h"  #include "srpt_impl.h" diff --git a/usr/src/uts/common/io/comstar/port/srpt/srpt_stp.c b/usr/src/uts/common/io/comstar/port/srpt/srpt_stp.c index d7da726086..29fa0fb634 100644 --- a/usr/src/uts/common/io/comstar/port/srpt/srpt_stp.c +++ b/usr/src/uts/common/io/comstar/port/srpt/srpt_stp.c @@ -41,9 +41,9 @@  #include <sys/taskq.h>  #include <sys/atomic.h> -#include <stmf.h> -#include <stmf_ioctl.h> -#include <portif.h> +#include <sys/stmf.h> +#include <sys/stmf_ioctl.h> +#include <sys/portif.h>  #include <sys/ib/mgt/ibdma/ibdma.h> diff --git a/usr/src/uts/common/io/comstar/stmf/lun_map.c b/usr/src/uts/common/io/comstar/stmf/lun_map.c index f6cebfd6a2..f95a05aa86 100644 --- a/usr/src/uts/common/io/comstar/stmf/lun_map.c +++ b/usr/src/uts/common/io/comstar/stmf/lun_map.c @@ -19,8 +19,7 @@   * CDDL HEADER END   */  /* - * Copyright 2010 Sun Microsystems, Inc.  All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.   */  #include <sys/conf.h> @@ -34,10 +33,11 @@  #include <sys/byteorder.h>  #include <sys/atomic.h> -#include "stmf.h" -#include "lpif.h" -#include "portif.h" -#include "stmf_ioctl.h" +#include <sys/stmf.h> +#include <sys/lpif.h> +#include <sys/portif.h> +#include <sys/stmf_ioctl.h> +  #include "stmf_impl.h"  #include "lun_map.h"  #include "stmf_state.h" diff --git a/usr/src/uts/common/io/comstar/stmf/stmf.c b/usr/src/uts/common/io/comstar/stmf/stmf.c index efa881156b..438a34c7aa 100644 --- a/usr/src/uts/common/io/comstar/stmf/stmf.c +++ b/usr/src/uts/common/io/comstar/stmf/stmf.c @@ -38,15 +38,16 @@  #include <sys/zone.h>  #include <sys/id_space.h> -#include <stmf.h> -#include <lpif.h> -#include <portif.h> -#include <stmf_ioctl.h> -#include <stmf_impl.h> -#include <lun_map.h> -#include <stmf_state.h> -#include <pppt_ic_if.h> -#include <stmf_stats.h> +#include <sys/stmf.h> +#include <sys/lpif.h> +#include <sys/portif.h> +#include <sys/stmf_ioctl.h> +#include <sys/pppt_ic_if.h> + +#include "stmf_impl.h" +#include "lun_map.h" +#include "stmf_state.h" +#include "stmf_stats.h"  /*   * Lock order: @@ -5256,10 +5257,10 @@ stmf_task_lu_aborted(scsi_task_t *task, stmf_status_t s, uint32_t iof)  	st = s;	/* gcc fix */  	if ((s != STMF_ABORT_SUCCESS) && (s != STMF_NOT_FOUND)) { -		(void) snprintf(info, STMF_CHANGE_INFO_LEN, +		(void) snprintf(info, sizeof (info),  		    "task %p, lu failed to abort ret=%llx", (void *)task, st);  	} else if ((iof & STMF_IOF_LU_DONE) == 0) { -		(void) snprintf(info, STMF_CHANGE_INFO_LEN, +		(void) snprintf(info, sizeof (info),  		    "Task aborted but LU is not finished, task ="  		    "%p, s=%llx, iof=%x", (void *)task, st, iof);  	} else { @@ -5270,7 +5271,6 @@ stmf_task_lu_aborted(scsi_task_t *task, stmf_status_t s, uint32_t iof)  		return;  	} -	info[STMF_CHANGE_INFO_LEN - 1] = 0;  	stmf_abort_task_offline(task, 1, info);  } @@ -5284,11 +5284,11 @@ stmf_task_lport_aborted(scsi_task_t *task, stmf_status_t s, uint32_t iof)  	st = s;  	if ((s != STMF_ABORT_SUCCESS) && (s != STMF_NOT_FOUND)) { -		(void) snprintf(info, STMF_CHANGE_INFO_LEN, +		(void) snprintf(info, sizeof (info),  		    "task %p, tgt port failed to abort ret=%llx", (void *)task,  		    st);  	} else if ((iof & STMF_IOF_LPORT_DONE) == 0) { -		(void) snprintf(info, STMF_CHANGE_INFO_LEN, +		(void) snprintf(info, sizeof (info),  		    "Task aborted but tgt port is not finished, "  		    "task=%p, s=%llx, iof=%x", (void *)task, st, iof);  	} else { @@ -5304,7 +5304,6 @@ stmf_task_lport_aborted(scsi_task_t *task, stmf_status_t s, uint32_t iof)  		return;  	} -	info[STMF_CHANGE_INFO_LEN - 1] = 0;  	stmf_abort_task_offline(task, 0, info);  } @@ -5439,18 +5438,16 @@ stmf_do_task_abort(scsi_task_t *task)  			atomic_and_32(&itask->itask_flags,  			    ~ITASK_LU_ABORT_CALLED);  		} else if (ret != STMF_SUCCESS) { -			(void) snprintf(info, STMF_CHANGE_INFO_LEN, +			(void) snprintf(info, sizeof (info),  			    "Abort failed by LU %p, ret %llx", (void *)lu, ret); -			info[STMF_CHANGE_INFO_LEN - 1] = 0;  			stmf_abort_task_offline(task, 1, info);  		}  	} else if (itask->itask_flags & ITASK_KNOWN_TO_LU) {  		if (ddi_get_lbolt() > (itask->itask_start_time +  		    STMF_SEC2TICK(lu->lu_abort_timeout?  		    lu->lu_abort_timeout : ITASK_DEFAULT_ABORT_TIMEOUT))) { -			(void) snprintf(info, STMF_CHANGE_INFO_LEN, +			(void) snprintf(info, sizeof (info),  			    "lu abort timed out"); -			info[STMF_CHANGE_INFO_LEN - 1] = 0;  			stmf_abort_task_offline(itask->itask_task, 1, info);  		}  	} @@ -5473,10 +5470,9 @@ stmf_do_task_abort(scsi_task_t *task)  			atomic_and_32(&itask->itask_flags,  			    ~ITASK_TGT_PORT_ABORT_CALLED);  		} else if (ret != STMF_SUCCESS) { -			(void) snprintf(info, STMF_CHANGE_INFO_LEN, +			(void) snprintf(info, sizeof (info),  			    "Abort failed by tgt port %p ret %llx",  			    (void *)lport, ret); -			info[STMF_CHANGE_INFO_LEN - 1] = 0;  			stmf_abort_task_offline(task, 0, info);  		}  	} else if (itask->itask_flags & ITASK_KNOWN_TO_TGT_PORT) { @@ -5484,9 +5480,8 @@ stmf_do_task_abort(scsi_task_t *task)  		    STMF_SEC2TICK(lport->lport_abort_timeout?  		    lport->lport_abort_timeout :  		    ITASK_DEFAULT_ABORT_TIMEOUT))) { -			(void) snprintf(info, STMF_CHANGE_INFO_LEN, +			(void) snprintf(info, sizeof (info),  			    "lport abort timed out"); -			info[STMF_CHANGE_INFO_LEN - 1] = 0;  			stmf_abort_task_offline(itask->itask_task, 0, info);  		}  	} diff --git a/usr/src/uts/common/sys/fct.h b/usr/src/uts/common/sys/fct.h index 611090a984..7b464f3e86 100644 --- a/usr/src/uts/common/sys/fct.h +++ b/usr/src/uts/common/sys/fct.h @@ -157,6 +157,9 @@ typedef struct fct_rcvd_abts {  #define	FCHBA_DRIVER_NAME_LEN		256  #define	FCHBA_SYMB_NAME_LEN		255 +#define	FCT_INFO_LEN			160 +#define	FCT_TASKQ_NAME_LEN		24 +  #define	FC_TGT_PORT_INFO_CMD		(((uint32_t)'I') << 24)  #define	FC_TGT_PORT_RLS			FC_TGT_PORT_INFO_CMD + 0x1 diff --git a/usr/src/uts/intel/fcoet/Makefile b/usr/src/uts/intel/fcoet/Makefile index ca049c7c3a..b253318455 100644 --- a/usr/src/uts/intel/fcoet/Makefile +++ b/usr/src/uts/intel/fcoet/Makefile @@ -20,8 +20,7 @@  #  # uts/intel/fcoet/Makefile  # -# Copyright 2009 Sun Microsystems, Inc.  All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.  #  # This makefile drives the production of the fcoet driver for COMSTAR.  # @@ -57,7 +56,6 @@ INSTALL_TARGET	= $(BINARY) $(ROOTMODULE)  #  MODSTUBS_DIR	 = $(OBJS_DIR)  LDFLAGS		+= -dy -Ndrv/stmf -Ndrv/fct -Ndrv/fcoe -INC_PATH	+= -I$(UTSBASE)/common/io/comstar/port/fcoet  #  #	Default build targets. diff --git a/usr/src/uts/intel/fct/Makefile b/usr/src/uts/intel/fct/Makefile index 24e0d9113a..d2c3f861dc 100644 --- a/usr/src/uts/intel/fct/Makefile +++ b/usr/src/uts/intel/fct/Makefile @@ -19,8 +19,7 @@  # CDDL HEADER END  #  # -# Copyright 2008 Sun Microsystems, Inc.  All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.  #  #	This makefile drives the production of the fct driver for   #	COMSTAR. @@ -61,9 +60,6 @@ INSTALL_TARGET	= $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)  MODSTUBS_DIR	 = $(OBJS_DIR)  LDFLAGS		+= -dy -Ndrv/stmf -INC_PATH	+= -I$(UTSBASE)/common/io/comstar/port/fct -INC_PATH	+= -I$(UTSBASE)/common/sys -  C99MODE=	-xc99=%all  C99LMODE=	-Xc99=%all diff --git a/usr/src/uts/intel/iscsit/Makefile b/usr/src/uts/intel/iscsit/Makefile index 7ecd8be223..d7cfc24314 100644 --- a/usr/src/uts/intel/iscsit/Makefile +++ b/usr/src/uts/intel/iscsit/Makefile @@ -19,8 +19,7 @@  # CDDL HEADER END  #  # -# Copyright 2008 Sun Microsystems, Inc.  All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.  #  #	This makefile drives the production of the iscsit pseudo-driver for   #	COMSTAR. @@ -61,8 +60,6 @@ INSTALL_TARGET	= $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)  MODSTUBS_DIR	 = $(OBJS_DIR)  LDFLAGS		+= -dy -Ndrv/stmf -Nmisc/idm -Nfs/sockfs -Nmisc/md5 -Nmisc/ksocket -INC_PATH	+= -I$(UTSBASE)/common/io/comstar/port/iscsit -  C99MODE=	-xc99=%all  C99LMODE=	-Xc99=%all diff --git a/usr/src/uts/intel/pppt/Makefile b/usr/src/uts/intel/pppt/Makefile index 316d936009..3731c52d24 100644 --- a/usr/src/uts/intel/pppt/Makefile +++ b/usr/src/uts/intel/pppt/Makefile @@ -19,8 +19,7 @@  # CDDL HEADER END  #  # -# Copyright 2009 Sun Microsystems, Inc.  All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.  #  #	This makefile drives the production of the pppt pseudo-driver for   #	COMSTAR. @@ -61,8 +60,6 @@ INSTALL_TARGET	= $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)  MODSTUBS_DIR	 = $(OBJS_DIR)  LDFLAGS		+= -dy -Ndrv/stmf -INC_PATH	+= -I$(UTSBASE)/common/io/comstar/port/pppt -  C99MODE=	-xc99=%all  C99LMODE=	-Xc99=%all diff --git a/usr/src/uts/intel/qlt/Makefile b/usr/src/uts/intel/qlt/Makefile index ac84802a9b..2b7ad9b3f1 100644 --- a/usr/src/uts/intel/qlt/Makefile +++ b/usr/src/uts/intel/qlt/Makefile @@ -19,8 +19,7 @@  # CDDL HEADER END  #  # -# Copyright 2009 Sun Microsystems, Inc.  All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.  #  #	This makefile drives the production of the qlt driver for   #	COMSTAR. @@ -61,9 +60,6 @@ LDFLAGS		+= -dy -Ndrv/fct -Ndrv/stmf  CFLAGS		+= -DUNIQUE_FW_NAME  LINTTAGS	+= -DUNIQUE_FW_NAME -INC_PATH	+= -I$(UTSBASE)/common/io/comstar/port/qlt -INC_PATH	+= -I$(UTSBASE)/common/sys -  C99MODE=	-xc99=%all  C99LMODE=	-Xc99=%all diff --git a/usr/src/uts/intel/srpt/Makefile b/usr/src/uts/intel/srpt/Makefile index b68438ceb3..57123dfc00 100644 --- a/usr/src/uts/intel/srpt/Makefile +++ b/usr/src/uts/intel/srpt/Makefile @@ -19,8 +19,7 @@  # CDDL HEADER END  #  # -# Copyright 2009 Sun Microsystems, Inc.  All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.  #  #	This makefile drives the production of the srpt pseudo-driver for   #	COMSTAR. @@ -61,9 +60,6 @@ INSTALL_TARGET	= $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)  MODSTUBS_DIR	 = $(OBJS_DIR)  LDFLAGS		+= -dy -Ndrv/stmf -Nmisc/ibtl -Nmisc/ibcm -INC_PATH	+= -I$(UTSBASE)/common/io/comstar/port/srpt -INC_PATH	+= -I$(UTSBASE)/common/sys -  C99MODE=	-xc99=%all  C99LMODE=	-Xc99=%all diff --git a/usr/src/uts/intel/stmf/Makefile b/usr/src/uts/intel/stmf/Makefile index 044f3eeb8a..8dfdd42bc3 100644 --- a/usr/src/uts/intel/stmf/Makefile +++ b/usr/src/uts/intel/stmf/Makefile @@ -19,8 +19,7 @@  # CDDL HEADER END  #  # -# Copyright 2008 Sun Microsystems, Inc.  All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.  #  #	This makefile drives the production of the stmf driver for   #	COMSTAR. @@ -59,9 +58,6 @@ INSTALL_TARGET	= $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)  MODSTUBS_DIR	 = $(OBJS_DIR)  CERRWARN	+= -erroff=E_STATEMENT_NOT_REACHED -INC_PATH	+= -I$(UTSBASE)/common/io/comstar/stmf -INC_PATH	+= -I$(UTSBASE)/common/sys -  C99MODE=	-xc99=%all  C99LMODE=	-Xc99=%all diff --git a/usr/src/uts/intel/stmf_sbd/Makefile b/usr/src/uts/intel/stmf_sbd/Makefile index 740ec48801..6958d90376 100644 --- a/usr/src/uts/intel/stmf_sbd/Makefile +++ b/usr/src/uts/intel/stmf_sbd/Makefile @@ -59,8 +59,6 @@ MODSTUBS_DIR	 = $(OBJS_DIR)  LDFLAGS		+= -dy -Ndrv/stmf -Nfs/zfs  INC_PATH	+= -I$(UTSBASE)/common/fs/zfs -INC_PATH	+= -I$(UTSBASE)/common/io/comstar/lu/stmf_sbd -INC_PATH	+= -I$(UTSBASE)/common/sys  C99MODE=	-xc99=%all  C99LMODE=	-Xc99=%all diff --git a/usr/src/uts/sparc/fcoet/Makefile b/usr/src/uts/sparc/fcoet/Makefile index 049893b085..ee28b5510f 100644 --- a/usr/src/uts/sparc/fcoet/Makefile +++ b/usr/src/uts/sparc/fcoet/Makefile @@ -20,8 +20,7 @@  #  # uts/sparc/fcoet/Makefile  # -# Copyright 2009 Sun Microsystems, Inc.  All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.  #  # This makefile drives the production of the fcoet driver for COMSTAR.  # @@ -57,7 +56,6 @@ INSTALL_TARGET	= $(BINARY) $(ROOTMODULE)  #  MODSTUBS_DIR	 = $(OBJS_DIR)  LDFLAGS		+= -dy -Ndrv/stmf -Ndrv/fct -Ndrv/fcoe -INC_PATH	+= -I$(UTSBASE)/common/io/comstar/port/fcoet  #	Default build targets.  # diff --git a/usr/src/uts/sparc/fct/Makefile b/usr/src/uts/sparc/fct/Makefile index 24e0d9113a..d2c3f861dc 100644 --- a/usr/src/uts/sparc/fct/Makefile +++ b/usr/src/uts/sparc/fct/Makefile @@ -19,8 +19,7 @@  # CDDL HEADER END  #  # -# Copyright 2008 Sun Microsystems, Inc.  All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.  #  #	This makefile drives the production of the fct driver for   #	COMSTAR. @@ -61,9 +60,6 @@ INSTALL_TARGET	= $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)  MODSTUBS_DIR	 = $(OBJS_DIR)  LDFLAGS		+= -dy -Ndrv/stmf -INC_PATH	+= -I$(UTSBASE)/common/io/comstar/port/fct -INC_PATH	+= -I$(UTSBASE)/common/sys -  C99MODE=	-xc99=%all  C99LMODE=	-Xc99=%all diff --git a/usr/src/uts/sparc/iscsit/Makefile b/usr/src/uts/sparc/iscsit/Makefile index 7ecd8be223..d7cfc24314 100644 --- a/usr/src/uts/sparc/iscsit/Makefile +++ b/usr/src/uts/sparc/iscsit/Makefile @@ -19,8 +19,7 @@  # CDDL HEADER END  #  # -# Copyright 2008 Sun Microsystems, Inc.  All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.  #  #	This makefile drives the production of the iscsit pseudo-driver for   #	COMSTAR. @@ -61,8 +60,6 @@ INSTALL_TARGET	= $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)  MODSTUBS_DIR	 = $(OBJS_DIR)  LDFLAGS		+= -dy -Ndrv/stmf -Nmisc/idm -Nfs/sockfs -Nmisc/md5 -Nmisc/ksocket -INC_PATH	+= -I$(UTSBASE)/common/io/comstar/port/iscsit -  C99MODE=	-xc99=%all  C99LMODE=	-Xc99=%all diff --git a/usr/src/uts/sparc/pppt/Makefile b/usr/src/uts/sparc/pppt/Makefile index 316d936009..3731c52d24 100644 --- a/usr/src/uts/sparc/pppt/Makefile +++ b/usr/src/uts/sparc/pppt/Makefile @@ -19,8 +19,7 @@  # CDDL HEADER END  #  # -# Copyright 2009 Sun Microsystems, Inc.  All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.  #  #	This makefile drives the production of the pppt pseudo-driver for   #	COMSTAR. @@ -61,8 +60,6 @@ INSTALL_TARGET	= $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)  MODSTUBS_DIR	 = $(OBJS_DIR)  LDFLAGS		+= -dy -Ndrv/stmf -INC_PATH	+= -I$(UTSBASE)/common/io/comstar/port/pppt -  C99MODE=	-xc99=%all  C99LMODE=	-Xc99=%all diff --git a/usr/src/uts/sparc/qlt/Makefile b/usr/src/uts/sparc/qlt/Makefile index 27ae967bde..e1aedb7b01 100644 --- a/usr/src/uts/sparc/qlt/Makefile +++ b/usr/src/uts/sparc/qlt/Makefile @@ -19,8 +19,7 @@  # CDDL HEADER END  #  # -# Copyright 2008 Sun Microsystems, Inc.  All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.  #  #	This makefile drives the production of the qlt driver for   #	COMSTAR. @@ -60,9 +59,6 @@ MODSTUBS_DIR	 = $(OBJS_DIR)  LDFLAGS		+= -dy -Ndrv/fct -Ndrv/stmf  CFLAGS		+= -DUNIQUE_FW_NAME -INC_PATH	+= -I$(UTSBASE)/common/io/comstar/port/qlt -INC_PATH	+= -I$(UTSBASE)/common/sys -  C99MODE=	-xc99=%all  C99LMODE=	-Xc99=%all diff --git a/usr/src/uts/sparc/srpt/Makefile b/usr/src/uts/sparc/srpt/Makefile index b68438ceb3..57123dfc00 100644 --- a/usr/src/uts/sparc/srpt/Makefile +++ b/usr/src/uts/sparc/srpt/Makefile @@ -19,8 +19,7 @@  # CDDL HEADER END  #  # -# Copyright 2009 Sun Microsystems, Inc.  All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.  #  #	This makefile drives the production of the srpt pseudo-driver for   #	COMSTAR. @@ -61,9 +60,6 @@ INSTALL_TARGET	= $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)  MODSTUBS_DIR	 = $(OBJS_DIR)  LDFLAGS		+= -dy -Ndrv/stmf -Nmisc/ibtl -Nmisc/ibcm -INC_PATH	+= -I$(UTSBASE)/common/io/comstar/port/srpt -INC_PATH	+= -I$(UTSBASE)/common/sys -  C99MODE=	-xc99=%all  C99LMODE=	-Xc99=%all diff --git a/usr/src/uts/sparc/stmf/Makefile b/usr/src/uts/sparc/stmf/Makefile index 044f3eeb8a..8dfdd42bc3 100644 --- a/usr/src/uts/sparc/stmf/Makefile +++ b/usr/src/uts/sparc/stmf/Makefile @@ -19,8 +19,7 @@  # CDDL HEADER END  #  # -# Copyright 2008 Sun Microsystems, Inc.  All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.  #  #	This makefile drives the production of the stmf driver for   #	COMSTAR. @@ -59,9 +58,6 @@ INSTALL_TARGET	= $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)  MODSTUBS_DIR	 = $(OBJS_DIR)  CERRWARN	+= -erroff=E_STATEMENT_NOT_REACHED -INC_PATH	+= -I$(UTSBASE)/common/io/comstar/stmf -INC_PATH	+= -I$(UTSBASE)/common/sys -  C99MODE=	-xc99=%all  C99LMODE=	-Xc99=%all diff --git a/usr/src/uts/sparc/stmf_sbd/Makefile b/usr/src/uts/sparc/stmf_sbd/Makefile index 740ec48801..6958d90376 100644 --- a/usr/src/uts/sparc/stmf_sbd/Makefile +++ b/usr/src/uts/sparc/stmf_sbd/Makefile @@ -59,8 +59,6 @@ MODSTUBS_DIR	 = $(OBJS_DIR)  LDFLAGS		+= -dy -Ndrv/stmf -Nfs/zfs  INC_PATH	+= -I$(UTSBASE)/common/fs/zfs -INC_PATH	+= -I$(UTSBASE)/common/io/comstar/lu/stmf_sbd -INC_PATH	+= -I$(UTSBASE)/common/sys  C99MODE=	-xc99=%all  C99LMODE=	-Xc99=%all | 
