t10_osd.c revision f3861e1a2ceec23a5b699c24d814b7775a9e0b52
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* []------------------------------------------------------------------[]
* | Implementation of OSD emulation |
* | |
* | NOTE: At this point in time this file is nothing more than a |
* | place holder for the implementation. As the project evolves we'll |
* | add more and more functionality. |
* []------------------------------------------------------------------[]
*/
#include <aio.h>
#include <stddef.h>
#include <strings.h>
#include <unistd.h>
#include <assert.h>
#include "t10.h"
#include "t10_spc.h"
#include "t10_osd.h"
#include "utility.h"
/*
* Forward declarations
*/
static scsi_cmd_table_t osd_table[];
/*
* []----
* | osd_init_common -- Initialize LU data which is common to all I_T_Ls
* []----
*/
/*ARGSUSED*/
{
osd_params_t *o;
char *str;
return (False);
} else {
free(o);
return (False);
}
lu->l_dtype_params = (void *)o;
return (True);
}
/*ARGSUSED*/
void
{
}
/*
* []----
* | osd_init_per -- Initialize per I_T_L information
* []----
*/
/*ARGSUSED*/
void
{
/*
* The first time an I_T nexus connects to a LU it is supposed
* to receive an unit attention upon the first command sent.
*/
}
/*ARGSUSED*/
void
{
}
/*ARGSUSED*/
void
{
}
/*
* []----
* | osd_cmd -- start a SCSI command
* |
* | This routine is called from within the SAM-3 Task router.
* []----
*/
static void
{
scsi_cmd_table_t *e;
#ifdef FULL_DEBUG
#endif
}
/*
* []----
* | osd_data -- Data phase for command.
* |
* | Normally this is only called for the WRITE command. Other commands
* | that have a data in phase will probably be short circuited when
* | we call trans_rqst_dataout() and the data is already available.
* | At least this is true for iSCSI. FC however will need a DataIn phase
* | for commands like MODE SELECT and PGROUT.
* []----
*/
static void
{
scsi_cmd_table_t *e;
#ifdef FULL_DEBUG
e->cmd_name);
#endif
}
/*
* []------------------------------------------------------------------[]
* | SCSI Object-Based Storage Device Commands |
* | T10/1355-D |
* | The following functions implement the emulation of OSD type |
* | commands. |
* []------------------------------------------------------------------[]
*/
static void
{
/*
* debug only -- no need to drop core if someone doesn't play right.
*/
if (cdb_len != sizeof (*o)) {
return;
}
o = (osd_generic_cdb_t *)cdb;
"OSD%x LUN%d service=0x%x, options=0x%x, specific_opts=0x%x,"
o->ocdb_specific_opts, o->ocdb_fmt);
switch (service_action) {
case OSD_APPEND:
case OSD_CREATE:
case OSD_CREATE_AND_WRITE:
case OSD_CREATE_COLLECTION:
case OSD_CREATE_PARTITION:
case OSD_FLUSH:
case OSD_FLUSH_COLLECTION:
case OSD_FLUSH_OSD:
case OSD_FLUSH_PARTITION:
case OSD_FORMAT_OSD:
case OSD_GET_ATTR:
case OSD_LIST:
break;
case OSD_LIST_COLLECTION:
case OSD_PERFORM_SCSI:
case OSD_TASK_MGMT:
default:
break;
}
}
/*
* []----
* | osd_list -- return a list of objects
* []----
*/
static void
{
if (len == 0) {
return;
}
return;
}
if (part == OSD_PARTITION_ROOT)
}
/*
* []------------------------------------------------------------------[]
* | Support related functions for OSD |
* []------------------------------------------------------------------[]
*/
/*
* []----
* | Command table for OSD emulation. This is at the end of the file because
* | it's big and ugly. ;-) To make for fast translation to the appropriate
* | emulation routine we just have a big command table with all 256 possible
* | entries. Most will report STATUS_CHECK, unsupport operation. By doing
* | this we can avoid error checking for command range or the use of a switch
* | statement.
* []----
*/
static scsi_cmd_table_t osd_table[] = {
/* 0x00 -- 0x0f */
/* 0x10 -- 0x1f */
/* 0x20 -- 0x2f */
/* 0x30 -- 0x3f */
/* 0x40 -- 0x4f */
/* 0x50 -- 0x5f */
/* 0x60 -- 0x6f */
/* 0x70 -- 0x7f */
/* 0x80 -- 0x8f */
/* 0x90 -- 0x9f */
/* 0xa0 - 0xaf */
/* 0xb0 -- 0xbf */
/* 0xc0 -- 0xcf */
/* 0xd0 -- 0xdf */
/* 0xe0 -- 0xef */
/* 0xf0 -- 0xff */
};