/*
* 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
*/
/*
*/
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <strings.h>
#include <stdio.h>
#include <limits.h>
#include "libscsi_impl.h"
struct uscsi_dev {
int fd;
char *dev;
};
static void *
{
return (NULL);
return (NULL);
}
return (NULL);
}
return (dp);
}
static void
{
return;
}
static int
{
uint_t f;
int i;
f = USCSI_REASON; /* we support uscsi_reason */
for (i = 0; i < sizeof (flags) * 8; i++) {
switch (flags & (1 << i)) {
case 0:
continue;
case LIBSCSI_AF_READ:
f |= USCSI_READ;
break;
case LIBSCSI_AF_WRITE:
f |= USCSI_WRITE;
break;
case LIBSCSI_AF_SILENT:
f |= USCSI_SILENT;
break;
case LIBSCSI_AF_DIAGNOSE:
f |= USCSI_DIAGNOSE;
break;
case LIBSCSI_AF_ISOLATE:
f |= USCSI_ISOLATE;
break;
case LIBSCSI_AF_RQSENSE:
f |= USCSI_RQENABLE;
break;
default:
"flag 0x%x is unknown", 1 << i));
}
}
*uf = f;
return (0);
}
/* translate uscsi_reason value to libscsi_reason_t */
static libscsi_reason_t
{
switch (uscsi_reason) {
case USCSI_REASON_RESERVED:
return ((libscsi_reason_t)LIBSCSI_REASON_INVALID);
case USCSI_REASON_NONE:
return (REASON_NONE);
case USCSI_REASON_TIMEOUT:
return (REASON_TIMEOUT);
case USCSI_REASON_DEVGONE:
return (REASON_DEVGONE);
case USCSI_REASON_TRANSPORT:
return (REASON_TRANSPORT);
case USCSI_REASON_PROTOCOL:
return (REASON_PROTOCOL);
case USCSI_REASON_NONSPECIFIC:
default:
return (REASON_NONSPECIFIC);
}
}
static int
{
return (-1);
return (-1);
if (cmd.uscsi_cdblen == 0)
return (-1);
return (-1);
if (flags & LIBSCSI_AF_READ)
else
}
if (flags & LIBSCSI_AF_RQSENSE) {
return (-1);
}
switch (errno) {
case EINVAL:
"uscsi error"));
case EPERM:
"privileges "));
case EIO:
/* Command never executed at all */
default:
}
}
return (-1);
return (-1);
return (0);
}
/*ARGSUSED*/
static const char *
{
}
.lseo_open = uscsi_open,
.lseo_exec = uscsi_exec,
};
.lse_name = "uscsi",
};
/*ARGSUSED*/
const libscsi_engine_t *
{
return (&uscsi_engine);
}