/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* BSD 3 Clause License
*
* Copyright (c) 2007, The Storage Networking Industry Association.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* distribution.
*
* - Neither the name of The Storage Networking Industry Association (SNIA)
* nor the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/* Copyright (c) 2007, The Storage Networking Industry Association. */
/* Copyright (c) 1996, 1997 PDC, Network Appliance. All Rights Reserved */
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include "ndmpd_common.h"
#include "ndmpd.h"
#include <string.h>
/*
* ************************************************************************
* NDMP V2 HANDLERS
* ************************************************************************
*/
/*
* ndmpd_scsi_open_v2
*
* This handler opens the specified SCSI device.
*
* Parameters:
* connection (input) - connection handle.
* body (input) - request message body.
*
* Returns:
* void
*/
void
{
}
/*
* ndmpd_scsi_close_v2
*
* This handler closes the currently open SCSI device.
*
* Parameters:
* connection (input) - connection handle.
* body (input) - request message body.
*
* Returns:
* void
*/
/*ARGSUSED*/
void
{
"sending scsi_close reply");
return;
}
"sending scsi_close reply");
}
/*
* ndmpd_scsi_get_state_v2
*
* This handler returns state information for the currently open SCSI device.
* Since the implementation only supports the opening of a specific SCSI
* device, as opposed to a device that can talk to multiple SCSI targets,
* this request is not supported. This request is only appropriate for
* implementations that support device files that can target multiple
* SCSI devices.
*
* Parameters:
* connection (input) - connection handle.
* body (input) - request message body.
*
* Returns:
* void
*/
/*ARGSUSED*/
void
{
} else {
reply.target_controller = 0;
}
"sending scsi_get_state reply");
}
/*
* ndmpd_scsi_set_target_v2
*
* This handler sets the SCSI target of the SCSI device.
* It is only valid to use this request if the opened SCSI device
* is capable of talking to multiple SCSI targets.
* Since the implementation only supports the opening of a specific SCSI
* device, as opposed to a device that can talk to multiple SCSI targets,
* this request is not supported. This request is only appropriate for
* implementations that support device files that can target multiple
* SCSI devices.
*
* Parameters:
* connection (input) - connection handle.
* body (input) - request message body.
*
* Returns:
* void
*/
void
{
}
/*
* ndmpd_scsi_reset_device_v2
*
* This handler resets the currently targeted SCSI device.
*
* Parameters:
* connection (input) - connection handle.
* body (input) - request message body.
*
* Returns:
* void
*/
/*ARGSUSED*/
void
{
} else {
"ioctl(USCSICMD) USCSI_RESET failed: %m.");
}
}
"sending scsi_reset_device reply");
}
/*
* ndmpd_scsi_reset_bus_v2
*
* This handler resets the currently targeted SCSI bus.
*
* Request not yet supported.
*
* Parameters:
* connection (input) - connection handle.
* body (input) - request message body.
*
* Returns:
* void
*/
/*ARGSUSED*/
void
{
"sending scsi_reset_bus reply");
}
/*
* ndmpd_scsi_execute_cdb_v2
*
* This handler sends the CDB to the currently targeted SCSI device.
*
* Parameters:
* connection (input) - connection handle.
* body (input) - request message body.
*
* Returns:
* void
*/
void
{
"sending scsi_execute_cdb reply");
} else {
}
}
/*
* ************************************************************************
* NDMP V3 HANDLERS
* ************************************************************************
*/
/*
* ndmpd_scsi_open_v3
*
* This handler opens the specified SCSI device.
*
* Parameters:
* connection (input) - connection handle.
* body (input) - request message body.
*
* Returns:
* void
*/
void
{
}
/*
* ndmpd_scsi_set_target_v3
*
* This handler sets the SCSI target of the SCSI device.
* It is only valid to use this request if the opened SCSI device
* is capable of talking to multiple SCSI targets.
*
* Parameters:
* connection (input) - connection handle.
* body (input) - request message body.
*
* Returns:
* void
*/
void
{
}
/*
* ************************************************************************
* NDMP V4 HANDLERS
* ************************************************************************
*/
/*
* ************************************************************************
* LOCALS
* ************************************************************************
*/
/*
* scsi_open_send_reply
*
* Send a reply for SCSI open command
*
* Parameters:
* connection (input) - connection handle.
* err (input) - ndmp error code
*
* Returns:
* void
*/
static void
{
}
/*
* common_open
*
* Common SCSI open function for all NDMP versions
*
* Parameters:
* connection (input) - connection handle.
* devname (input) - device name to open.
*
* Returns:
* void
*/
static void
{
int err;
int devid;
err = NDMP_NO_ERR;
"Session already has a tape or scsi device open.");
devname);
}
} else {
}
if (err != NDMP_NO_ERR) {
return;
}
case 0:
/* OK */
break;
case EBUSY:
break;
case ENOMEM:
break;
default:
err = NDMP_IO_ERR;
}
if (err != NDMP_NO_ERR) {
return;
}
if (sid != -1) {
} else {
}
}
/*
* common_set_target
*
* Set the SCSI target (SCSI number, LUN number, controller number)
*
* Parameters:
* connection (input) - connection handle.
* device (input) - device name.
* controller (input) - controller number.
* sid (input) - SCSI target ID.
* lun (input) - LUN number.
*
* Returns:
* 0: on success
* -1: otherwise
*/
/*ARGSUSED*/
static void
{
int type;
lun)) {
} else {
lun);
"Not a tape or robot device: target %d lun %d.",
}
}
"sending scsi_set_target reply");
return;
}
/*
* The open_list must be updated if the SID or LUN are going to be
* changed. Close uses the same SID & LUN for removing the entry
* from the open_list.
*/
switch (ndmp_open_list_add(connection,
case 0:
(void) ndmp_open_list_del(session->
break;
case EBUSY:
break;
case ENOMEM:
break;
default:
}
}
}
"sending scsi_set_target reply");
}
/*
* scsi_find_sid_lun
*
* gets the adapter, and returns the sid and lun number
*/
void
{
char *name;
return;
}
}
*sid = -1;
*lun = -1;
}