uscsi.c revision 275c9da86e89f8abf71135cf63d9fc23671b2e60
/*
* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#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 *
{
const char *target_name = (const char *)target;
return (NULL);
return (NULL);
}
return (NULL);
}
return (dp);
}
static void
{
return;
}
static int
{
uint_t f;
int i;
f = 0;
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);
}
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 */
break;
default:
}
}
return (-1);
return (-1);
return (0);
}
/*ARGSUSED*/
static void
{
}
static const libscsi_engine_ops_t uscsi_ops = {
.lseo_open = uscsi_open,
.lseo_exec = uscsi_exec,
};
static const libscsi_engine_t uscsi_engine = {
.lse_name = "uscsi",
};
/*ARGSUSED*/
const libscsi_engine_t *
{
return (&uscsi_engine);
}