dsimage.c revision fcf3ce441efd61da9bb2884968af01cb7c1452cc
/*
* 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 <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <libintl.h>
#define SCSI_CDB(c, s, p, l) \
{ \
*c = (char)s; \
*(c + 2) = (p >> 24) & 0xff; \
*(c + 3) = (p >> 16) & 0xff; \
*(c + 4) = (p >> 8) & 0xff; \
*(c + 5) = p & 0xff; \
*(c + 7) = (l >> 8) & 0xff; \
*(c + 8) = l & 0xff; \
}
#define CDBSIZE 10
#define RQBSIZE 26
#define SCSITIME 5
#define POLLTIME 3
#define MAXIWWNS 3
#define IIVOLCNT 4
#define IN_BUFSIZE 2
/* Globals */
static int aflag = 0;
static int cflag = 0;
static int iflag = 0;
static int uflag = 0;
static int wflag = 0;
static int qflag = 1;
static int scsi_timeout = SCSITIME;
static int wait_poll_time = POLLTIME;
static char direction = '\0';
/* Prototypes */
void help();
void fail(int, char *);
void parse(int, char **);
int pit_abort();
int pit_copy_update(int);
int pit_list();
int pit_wait();
int pit_group_operation(int);
void version();
int
{
int rc = 0;
/* abort */
/* copy */
/* update */
/* list */
/* wait */
return (0);
}
void
help()
{
"<volume>\n"));
"operations.\n"));
"entire volume.\n"));
"data.\n"));
"set.\n"));
"complete.\n"));
"operation. (default=%d)\n"), POLLTIME);
}
void
{
help();
}
void
{
int c;
extern char *optarg;
extern int optind;
switch (c) {
case 'a' : /* ABORT */
aflag++;
break;
case 'c' : /* COPY */
cflag++;
break;
case 'h': /* HELP */
help();
exit(0);
break;
case 'i': /* LIST */
iflag++;
break;
case 'n' : /* NO CONFIRM */
qflag = 0;
break;
case 'p' : /* POLLING TIME */
break;
case 't' : /* TIMEOUT */
break;
case 'u': /* UPDATE */
uflag++;
break;
case 'w': /* WAIT */
wflag++;
break;
case 'v': /* VERSION */
version();
break;
}
if (scsi_timeout < 1)
if (wait_poll_time < 1)
}
int
{
int fd;
int rc;
char *rqb;
char *cdb;
return (rc);
}
int
{
int fd;
int rc;
char *rqb;
char *cdb;
scsi_cmd.uscsi_status = 0;
scsi_cmd.uscsi_resid = 0;
scsi_cmd.uscsi_rqstatus = 0;
scsi_cmd.uscsi_rqresid = 0;
return (rc);
}
/*
* 'iiadm -i' output
*/
void
{
/* vdisk IDs */
else {
}
else {
}
else {
}
if (props.has_overflow) {
else {
}
}
}
}
else
} else
}
else
}
int
{
char c[IN_BUFSIZE];
if (!qflag)
return (0);
if (c[0] == 'y' || c[0] == 'Y')
return (0);
return (1);
}
int
{
int rc;
int iirc;
return (0);
return (rc);
}
int
pit_copy_update(int cmd)
{
int rc;
char msg[80];
char *op;
char *v1;
char *v2;
/* Opeartion text for configmr message */
if (cmd == II_PIT_COPY)
if (cmd == II_PIT_UPDATE)
/* Direction text for confirm messasge */
if (direction == 'm') {
}
if (direction == 's') {
}
/* Assemble message */
/* Confirm */
return (0);
/* Set up buffers */
/* Begin copy */
if (rc)
return (rc);
return (rc);
}
return (0);
}
int
pit_list()
{
int rc;
int bufl;
char *bufp;
/* Allocate memory to hold set data */
/* WWN_STRLEN = # of characters in a WWN */
/* IIVOLCNT = # of volumes per II set (mst, shd, bit, ovr) */
/* Data for all of the II sets */
goto end;
end:
return (rc);
}
int
pit_wait()
{
int rc;
int iirc;
for (;;) {
(char *)&iirc);
break;
}
return (rc);
}
void
version()
{
printf("dsimage V%d.%d.%d.%d\n",
exit(0);
}