dm_uscsi.c revision cee0fb94c0d4227de0a00efc162fb2739844b641
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <unistd.h>
#include <stropts.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <signal.h>
#include <errno.h>
#include <mms_trace.h>
#include <dmd_impl.h>
#include <dm_impl.h>
#include <dm_drive.h>
#include <dm_msg.h>
#include <mms_sym.h>
#include <mms_list.h>
#include <mms_scsi.h>
#include <dm_proto.h>
#include <mms_strapp.h>
/*
* Process scsi error
*/
void
{
char *error;
char *scsi_err;
char *buf;
/* Save cdb */
if (senlen > 0) {
/* Save sense */
/*
* If uscsi, save sense key in erreg
*/
}
DRV_SE_SEN_VALID : 0;
DRV_SE_ILI : 0;
DRV_TM : 0;
DRV_EOM : 0;
}
/*
* Trace the error
*/
sizeof (dumpbuf));
if (buf) {
}
"acsq %2.2x, resid %lld: %s",
}
} else {
}
"%s, status %s, %s",
}
int
{
int rc;
/* Reduce io size to size of io buf */
}
/* must set USCSI_RQENABLE to get sense */
return (rc);
}
void
dm_err_trace(void)
{
"fileno %lld, blkno %lld, flags %16.16x",
}
void
dm_get_mtstat(int save)
{
return;
}
"fileno=%lld, blkno=%lld, flags=0x%llx, bf=%lld",
}
}
int
{
int err = 0;
int cmd;
void *arg;
int rc;
/*
* If this is an MTIOCLTOP request, then arg points to a
* struct mtlop.
* We'll only use MTIOCLTOP if it is request by the application.
* Otherwise we use MTIOCTOP.
*/
} else {
}
} else {
}
if (rc != 0) {
}
return (rc);
}
void
dm_disallowed(void)
{
int *ac;
int num_ac;
int i;
char dumpbuf[1024];
/*
* Set up disallowed USCSI cmds
*/
for (i = 0; i < num_ac; i++) {
}
}
sizeof (dumpbuf));
/*
* Set up disallowed ioctls
*/
for (i = 0; i < num_ac; i++) {
}
}
sizeof (dumpbuf));
}
int
{
int senlen;
/* No error */
return (0);
}
if (ret < 0) {
/* An error occured */
}
/* Not an I/O error */
return (-1);
}
/*
* An I/O error
*/
return (-1);
}
int
{
int rc;
int err;
if (rc == -1) {
}
} else if (rc != 0) {
}
if (rc != 0) {
DRV_CALL(drv_proc_error, ());
/*
* Record error if drive is loaded.
* Hitting a tapemark is not an error
*/
(void) dm_send_error();
}
}
}
/* set DriveBroken to "yes" */
(void) dm_send_drive_broken();
/* Set CartridgeMediaError to "yes" */
(void) dm_send_cartridge_media_error();
}
}
/* If error and no saved stat, save it */
}
return (rc);
}
void
dm_get_mt_error(int err)
{
int have_sense = 0;
have_sense = 1;
}
if (have_sense == 0) {
}
/* No valid sense bytes, then use what we already know */
}
}
}
int
{
pp += 3;
pp++;
return (0);
}
}
return (-1); /* no matching code */
}
{
ele++) {
return (ele);
}
}
return (ele);
}