summaryrefslogtreecommitdiff
path: root/usr/src/cmd/avs
diff options
context:
space:
mode:
authorJohn Forte <John.Forte@Sun.COM>2008-10-21 08:43:26 -0700
committerJohn Forte <John.Forte@Sun.COM>2008-10-21 08:43:26 -0700
commit73a9f52fa0e4b5d00dc5f3a6314e6837e47f88cf (patch)
tree0cccf9b8644b231bd83042026936bdf4d963efd9 /usr/src/cmd/avs
parent915ebf8da9f4ef3e7b2e34dd367f64d358a628d9 (diff)
downloadillumos-joyent-73a9f52fa0e4b5d00dc5f3a6314e6837e47f88cf.tar.gz
6745433 Merge NWS consolidation into OS/Net consolidation (fix unref)
--HG-- rename : usr/src/cmd/avs/errgen/errgen.help => usr/src/cmd/avs/errgen/errgen.help.txt rename : usr/src/uts/common/avs/ns/sdbc/CACHE_SPEC => usr/src/uts/common/avs/ns/sdbc/CACHE_SPEC.txt
Diffstat (limited to 'usr/src/cmd/avs')
-rw-r--r--usr/src/cmd/avs/dscvt/Makefile68
-rw-r--r--usr/src/cmd/avs/dscvt/dscvt.c433
-rw-r--r--usr/src/cmd/avs/dsw/dsimage.c556
-rw-r--r--usr/src/cmd/avs/errgen/errgen.help.txt (renamed from usr/src/cmd/avs/errgen/errgen.help)0
-rw-r--r--usr/src/cmd/avs/sdbc/sd_dcmp.c172
5 files changed, 0 insertions, 1229 deletions
diff --git a/usr/src/cmd/avs/dscvt/Makefile b/usr/src/cmd/avs/dscvt/Makefile
deleted file mode 100644
index 0341d0cece..0000000000
--- a/usr/src/cmd/avs/dscvt/Makefile
+++ /dev/null
@@ -1,68 +0,0 @@
-# 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
-# or http://www.opensolaris.org/os/licensing.
-# 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.
-#
-
-DYNPROG= dscvt
-
-include ../../Makefile.cmd
-include ../Makefile.com
-
-PROG = $(DYNPROG)
-
-dscvt := POBJS = dscvt.o
-
-OBJS= dscvt.o
-SRCS= $(OBJS:%.o=%.c)
-POFILE= $(OBJS:%.o=%.po)
-
-CFLAGS += -v
-LDLIBS += -lnsctl -ldscfg
-LINTFLAGS += -Xa -n -s -x -m -u -Dlint -errhdr=%user
-LINTFLAGS += -erroff=E_SEC_PRINTF_VAR_FMT
-
-all := TARGET= all
-install := TARGET= install
-clean := TARGET= clean
-clobber := TARGET= clobber
-lint := TARGET= lint
-
-.KEEP_STATE:
-
-.PARALLEL: $(OBJS)
-
-all: $(PROG) $(POFILES)
-
-install: all $(ROOTPROG)
-
-lint: lint_SRCS
-
-clean:
- $(RM) *.o $(POFILE)
-
-$(PROG): $$(POBJS)
- $(LINK.c) $(POBJS) -o $@ $(LDLIBS)
- $(POST_PROCESS)
-
-FRC:
-
-include ../../Makefile.targ
diff --git a/usr/src/cmd/avs/dscvt/dscvt.c b/usr/src/cmd/avs/dscvt/dscvt.c
deleted file mode 100644
index 9afd1842ca..0000000000
--- a/usr/src/cmd/avs/dscvt/dscvt.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/*
- * 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
- * or http://www.opensolaris.org/os/licensing.
- * 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 <sys/types.h>
-#include <sys/utsname.h>
-#include <sys/stat.h>
-#include <sys/mkdev.h>
-#include <sys/param.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <locale.h>
-#include <unistd.h>
-#include <search.h>
-#include <libgen.h>
-#include <nsctl.h>
-#include <dlfcn.h>
-#include <langinfo.h>
-#include <libintl.h>
-#include <netdb.h>
-#include <ctype.h>
-
-#include <sys/nsctl/rdc_io.h>
-#include <sys/nsctl/rdc_ioctl.h>
-#include <sys/nsctl/rdc_prot.h>
-
-#include <sys/unistat/spcs_s.h>
-#include <sys/unistat/spcs_s_u.h>
-#include <sys/unistat/spcs_errors.h>
-
-#include <sys/nsctl/sv.h>
-#include <sys/nsctl/sv_impl.h>
-
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netinet/tcp.h>
-#include <rpc/rpc_com.h>
-#include <rpc/rpc.h>
-
-#include <sys/nsctl/cfg.h>
-#include <sys/nsctl/nsc_hash.h>
-
-#define RDC_LIB "/usr/lib/librdc.so.1"
-
-/*
- * Structure to keep track of how many times a volume is used.
- */
-typedef struct vol_s {
- int count;
-} vol_t;
-int rflg;
-
-static void error(char *, char *, ...);
-static void process_dsw(CFGFILE *, hash_node_t **);
-static void process_rdc(CFGFILE *, hash_node_t **);
-static void process_sv(CFGFILE *, hash_node_t **);
-static void register_vol(CFGFILE *, hash_node_t **, char *, char *, char *,
- hash_node_t **);
-
-static int do_cluster;
-static int (*self_check)(char *);
-
-int
-main(int argc, char *argv[])
-{
- CFGFILE *cfg;
- hash_node_t **svhash;
- extern char *optarg;
- int rc;
- void *librdc;
- char altroot[NSC_MAXPATH]; /* jumpstart */
- char altlib[NSC_MAXPATH]; /* jumpstart */
- char *cfgloc;
- char c;
-
- while ((c = getopt(argc, argv, "r:")) != EOF) {
- switch (c) {
- case 'r':
- rflg++;
- strcpy(altroot, optarg);
- break;
- default:
- error(NULL, "Usage: dscvt [-r root_dir]\n");
- /*NOTREACHED*/
- };
- }
- cfgloc = cfg_location(NULL, CFG_LOC_GET_CLUSTER, rflg ? altroot : NULL);
-
- cfg = cfg_open(cfgloc);
- if (!cfg) {
- error("cfg_open", gettext("unable to open dscfg"));
- /*NOTREACHED*/
- }
- if (!cfg_lock(cfg, CFG_WRLOCK)) {
- error("cfg_lock",
- gettext("unable to obtain write lock for dscfg"));
- /*NOTREACHED*/
- }
- if (cfg_update_parser_config(cfg, "dsvol.path.cnode.users\n",
- CFG_PARSE_CONF) < 0) {
- if (errno != EEXIST) {
- error("cfg_update_parser_config",
- gettext("unable to update parser config"));
- /*NOTREACHED*/
- }
- }
- if (cfg_commit(cfg) < 0) {
- error("cfg_commit",
- gettext("unable to commit, parser info may be wrong"));
- }
- cfg_close(cfg);
- /*
- * re-open with new parser entry
- */
-
- cfg = NULL;
- cfg = cfg_open(cfgloc);
- if (!cfg) {
- error("cfg_open", gettext("unable to open dscfg"));
- /*NOTREACHED*/
- }
- if (!cfg_lock(cfg, CFG_WRLOCK)) {
- error("cfg_lock",
- gettext("unable to obtain write lock for dscfg"));
- /*NOTREACHED*/
- }
-
- cfg_resource(cfg, NULL);
-
- svhash = nsc_create_hash();
- if (!svhash) {
- error("nsc_create_hash",
- gettext("unable to create hash for sv"));
- /*NOTREACHED*/
- }
-
- /* preload volumes from 'dsvol' section, if any */
- rc = cfg_load_dsvols(cfg);
- if (rc < 0) {
- error("cfg_load_dsvols", gettext("cannot read config file"));
- /*NOTREACHED*/
- }
-
- /* handle cluster tags */
- do_cluster = cfg_issuncluster();
- if (do_cluster < 0) {
- error("cfg_issuncluster",
- gettext("unable to ascertain environment"));
- /*NOTREACHED*/
- }
-
- /* find out if RDC is installed */
- if (!rflg)
- librdc = dlopen(RDC_LIB, RTLD_LAZY | RTLD_GLOBAL);
- else {
- if ((strlen(altroot) + strlen(RDC_LIB)) >= NSC_MAXPATH) {
- (void) fprintf(stderr,
- "sndr library name too long, skipping\n");
- librdc = NULL;
- } else {
- strcpy(altlib, altroot);
- strcat(altlib, RDC_LIB);
- librdc = dlopen(altlib, RTLD_LAZY | RTLD_GLOBAL);
- }
- }
-
-
- /* now handle all the sections of the config file */
- process_dsw(cfg, svhash);
- if (librdc) {
- self_check = (int (*)(char *)) dlsym(librdc, "self_check");
- process_rdc(cfg, svhash);
- (void) dlclose(librdc);
- }
- process_sv(cfg, svhash);
-
- /* write changes and exit */
- (void) cfg_commit(cfg);
- cfg_close(cfg);
-
- nsc_remove_all(svhash, free);
-
- return (0);
-}
-
-static void
-error(char *func, char *str, ...)
-{
- va_list ap;
-
- va_start(ap, str);
-
- (void) fprintf(stderr, "dscvt: ");
- (void) vfprintf(stderr, str, ap);
-
- va_end(ap);
-
- if (errno && func) {
- perror(func);
- }
-
- exit(1);
-}
-
-/*
- * Determines which volumes are being used by II and adds them to
- * the 'dsvol' section of the config file.
- */
-static void
-process_dsw(CFGFILE *cfg, hash_node_t **svhash)
-{
- hash_node_t **iihash;
- int set;
- char key[ CFG_MAX_KEY ];
- char buf[ CFG_MAX_BUF ];
- char *master, *shadow, *p;
- char *ctag = "-";
-
- iihash = nsc_create_hash();
- if (!iihash) {
- error("nsc_create_hash",
- gettext("unable to create hashtable for Point-in-Time "
- "Copy"));
- /*NOTREACHED*/
- }
- cfg_rewind(cfg, CFG_SEC_CONF);
- for (set = 1; /*CSTYLED*/; set++) {
- (void) snprintf(key, CFG_MAX_KEY, "ii.set%d", set);
- if (cfg_get_cstring(cfg, key, buf, CFG_MAX_BUF)) {
- break;
- }
- p = buf;
- while (*p && isspace(*p)) {
- ++p;
- }
- master = strtok(p, " ");
- shadow = strtok(NULL, " ");
- if (do_cluster) {
- /* skip some fields */
- (void) strtok(NULL, " "); /* bitmap */
- (void) strtok(NULL, " "); /* mode */
- (void) strtok(NULL, " "); /* overflow */
- ctag = strtok(NULL, " ");
- }
-
- if (!master) {
- break;
- }
- register_vol(cfg, iihash, master, "ii", ctag, svhash);
-
- if (!shadow) {
- break;
- }
- register_vol(cfg, iihash, shadow, "ii", ctag, svhash);
-
- }
- nsc_remove_all(iihash, free);
-}
-
-/*
- * Determines which volumes are being used by SNDR and adds them to
- * the 'dsvol' section of the config file.
- */
-static void
-process_rdc(CFGFILE *cfg, hash_node_t **svhash)
-{
- hash_node_t **rdchash;
- int set;
- char key[ CFG_MAX_KEY ];
- char buf[ CFG_MAX_BUF ];
- char *host, *vol, *bmp, *p;
- char *ctag = "-";
-
- rdchash = nsc_create_hash();
- if (!rdchash) {
- error("nsc_create_hash",
- gettext("unable to create hashtable for Remote Mirror"));
- /*NOTREACHED*/
- }
- cfg_rewind(cfg, CFG_SEC_CONF);
- for (set = 1; /*CSTYLED*/; set++) {
- (void) snprintf(key, CFG_MAX_KEY, "sndr.set%d", set);
- if (cfg_get_cstring(cfg, key, buf, CFG_MAX_BUF)) {
- break;
- }
- p = buf;
- while (*p && isspace(*p)) {
- ++p;
- }
- host = strtok(p, " ");
- vol = strtok(NULL, " ");
- bmp = strtok(NULL, " ");
- if (!self_check(host)) {
- host = strtok(NULL, " ");
- vol = strtok(NULL, " ");
- bmp = strtok(NULL, " ");
- if (do_cluster) {
- /* skip some fields */
- (void) strtok(NULL, " "); /* type */
- (void) strtok(NULL, " "); /* mode */
- (void) strtok(NULL, " "); /* group */
- }
- } else if (do_cluster) {
- /* skip some fields */
- (void) strtok(NULL, " "); /* shost */
- (void) strtok(NULL, " "); /* secondary */
- (void) strtok(NULL, " "); /* sbitmap */
- (void) strtok(NULL, " "); /* type */
- (void) strtok(NULL, " "); /* mode */
- (void) strtok(NULL, " "); /* group */
- }
-
- if (do_cluster) {
- ctag = strtok(NULL, " ");
- }
- if (self_check(host)) {
- register_vol(cfg, rdchash, vol, "sndr", ctag, svhash);
- register_vol(cfg, rdchash, bmp, "sndr", ctag, svhash);
- }
- }
- nsc_remove_all(rdchash, free);
-}
-
-/*
- * This must be executed last. Any volumes that are configured in sv
- * which are not already claimed by II or SNDR must be put under SV
- * control.
- */
-static void
-process_sv(CFGFILE *cfg, hash_node_t **svhash)
-{
- int set;
- char key[ CFG_MAX_KEY ];
- char buf[ CFG_MAX_BUF ];
- char *path, *p;
- char *ctag = "-";
-
- cfg_rewind(cfg, CFG_SEC_CONF);
- for (set = 1; /*CSTYLED*/; set++) {
- (void) snprintf(key, CFG_MAX_KEY, "sv.set%d", set);
- if (cfg_get_cstring(cfg, key, buf, CFG_MAX_BUF)) {
- break;
- }
- p = buf;
- while (*p && isspace(*p)) {
- ++p;
- }
- path = strtok(p, " ");
- if (do_cluster) {
- (void) strtok(NULL, " "); /* skip 'mode' field */
- ctag = strtok(NULL, " ");
- }
- register_vol(cfg, svhash, path, "sv", ctag, NULL);
- }
-}
-
-static void
-register_vol(CFGFILE *cfg, hash_node_t **hash, char *path, char *user,
- char *ctag, hash_node_t **svhash)
-{
- vol_t *volp, *svolp;
- int rc;
-
- volp = (vol_t *)nsc_lookup(hash, path);
- if (!volp) {
- volp = (vol_t *)malloc(sizeof (vol_t));
- volp->count = 0;
- (void) printf("%s: adding %s as volume\n", user, path);
- if (nsc_insert_node(hash, volp, path) < 0) {
- error("nsc_insert_node", gettext(
- "Error manipulating data: vol %s, user %s\n"),
- path, user);
- /*NOTREACHED*/
- }
- rc = cfg_add_user(cfg, path, ctag, user);
- if (CFG_USER_ERR == rc) {
- error("cfg_add_user", gettext("Error adding volume %s"
- " for user %s\n"), path, user);
- perror("cfg_add_user");
- /*NOTREACHED*/
- }
- } else {
- ++volp->count;
- (void) printf("%s: incrementing usage of %s to %d\n", user,
- path, volp->count);
- }
-
- if (svhash) {
- svolp = (vol_t *)nsc_lookup(svhash, path);
- if (!svolp) {
- svolp = (vol_t *)malloc(sizeof (vol_t));
- svolp->count = volp->count;
- if (nsc_insert_node(svhash, svolp, path) < 0) {
- error("nsc_insert_node", gettext("Unable to"
- " insert node into svhash for %s (%s)"),
- path, user);
- /*NOTREACHED*/
- }
- } else {
- ++svolp->count;
- }
- /* remove it from 'sv' in case it was previously put there */
- (void) cfg_rem_user(cfg, path, ctag, "-sv");
- }
-}
diff --git a/usr/src/cmd/avs/dsw/dsimage.c b/usr/src/cmd/avs/dsw/dsimage.c
deleted file mode 100644
index 3ce442c9da..0000000000
--- a/usr/src/cmd/avs/dsw/dsimage.c
+++ /dev/null
@@ -1,556 +0,0 @@
-/*
- * 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
- * or http://www.opensolaris.org/os/licensing.
- * 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 <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include <unistd.h>
-
-#include <sys/scsi/scsi.h>
-#include <libintl.h>
-
-#include <sys/unistat/spcs_s.h>
-#include <sys/nsctl/ste_scsi.h>
-#include <sys/nsctl/dsw.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 int wwn_count = MAXIWWNS;
-static char *volume = NULL;
-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
-main(int argc, char **argv)
-{
- int rc = 0;
-
- parse(argc, argv);
-
- if (!aflag && !cflag && !iflag && !uflag && !wflag)
- fail(EINVAL, gettext("operation not specified.\n"));
-
- /* abort */
- if (aflag && (rc = pit_abort()))
- fail(rc, gettext("abort failed.\n"));
-
- /* copy */
- if (cflag && (rc = pit_copy_update(II_PIT_COPY)))
- fail(rc, gettext("copy failed.\n"));
-
- /* update */
- if (uflag && (rc = pit_copy_update(II_PIT_UPDATE)))
- fail(rc, gettext("update failed.\n"));
-
- /* list */
- if (iflag && (rc = pit_list()))
- fail(rc, gettext("list failed.\n"));
-
- /* wait */
- if (wflag && (rc = pit_wait()))
- fail(rc, gettext("wait failed.\n"));
-
- return (0);
-}
-
-void
-help()
-{
- printf(gettext("Usage:\n"));
- printf(gettext("\tdsimage [-t <timeout>] [-n] -a <volume>\n"));
- printf(gettext("\tdsimage [-t <timeout>] [-n] -c [m|s] <volume>\n"));
- printf(gettext("\tdsimage [-t <timeout>] [-n] -u [m|s] <volume>\n"));
- printf(gettext("\tdsimage [-t <timeout>] -i <volume>\n"));
- printf(gettext("\tdsimage [-t <timeout>] [-p <polltime>] -w "
- "<volume>\n"));
- printf(gettext("\tdsimage -h\n"));
- printf(gettext("\tdsimage -v\n"));
- printf(gettext("Description of options:\n"));
- printf(gettext("\t-a\tAbort any outstanding copy/update "
- "operations.\n"));
- printf(gettext("\t-c\tInitiate a copy operation, overwriting an "
- "entire volume.\n"));
- printf(gettext("\t-u\tInitiate a update operation, moving changed "
- "data.\n"));
- printf(gettext("\t-i\tRetrieve information about the point-in-time "
- "set.\n"));
- printf(gettext("\t-w\tWait for a copy/update operation to "
- "complete.\n"));
- printf(gettext("\t-t\tSet the SCSI timeout. (default=%d)\n"), SCSITIME);
- printf(gettext("\t-p\tSet the polling time used for wait "
- "operation. (default=%d)\n"), POLLTIME);
- printf(gettext("\t-n\tSupress confirmation of operation.\n"));
- printf(gettext("\t-h\tOutput help text.\n"));
- printf(gettext("\t-v\tOutput version of dsimage.\n"));
-}
-
-void
-fail(int rc, char *msg)
-{
- fprintf(stderr, "\n%s\n", msg);
- help();
- exit(rc);
-}
-
-void
-parse(int argc, char **argv)
-{
- int c;
- extern char *optarg;
- extern int optind;
-
- while ((c = getopt(argc, argv, "ac:hinp:t:u:wv")) != EOF)
- switch (c) {
- case 'a' : /* ABORT */
- aflag++;
- break;
- case 'c' : /* COPY */
- cflag++;
- direction = optarg[0];
- break;
- case 'h': /* HELP */
- help();
- exit(0);
- break;
- case 'i': /* LIST */
- iflag++;
- break;
- case 'n' : /* NO CONFIRM */
- qflag = 0;
- break;
- case 'p' : /* POLLING TIME */
- wait_poll_time = atoi(optarg);
- break;
- case 't' : /* TIMEOUT */
- scsi_timeout = atoi(optarg);
- break;
- case 'u': /* UPDATE */
- uflag++;
- direction = optarg[0];
- break;
- case 'w': /* WAIT */
- wflag++;
- break;
- case 'v': /* VERSION */
- version();
- break;
- }
-
- if (!(argc - optind))
- fail(EINVAL, gettext("No volume specified\n"));
-
- volume = (char *)calloc(DSW_NAMELEN, sizeof (char));
- strcpy(volume, argv[optind]);
-
-
- if ((cflag || uflag) && !strchr("ms", direction))
- fail(EINVAL, gettext("Invalid direciton specified.\n"));
-
- if (scsi_timeout < 1)
- fail(EINVAL, gettext("Invalid SCSI timeout specified.\n"));
-
- if (wait_poll_time < 1)
- fail(EINVAL, gettext("Invalid poll time specified.\n"));
-}
-
-int
-scsiwrite(int cmd, char *volume, int len, char *buf)
-{
- int fd;
- int rc;
- struct uscsi_cmd scsi_cmd;
- char *rqb;
- char *cdb;
-
- cdb = (char *)calloc(CDBSIZE, sizeof (char));
- rqb = (char *)calloc(RQBSIZE, sizeof (char));
-
- SCSI_CDB(cdb, CMD_STOREDGE_WRITE, cmd, len);
-
- scsi_cmd.uscsi_flags = (USCSI_WRITE | USCSI_RQENABLE);
- scsi_cmd.uscsi_timeout = scsi_timeout;
- scsi_cmd.uscsi_cdb = cdb;
- scsi_cmd.uscsi_cdblen = CDBSIZE;
- scsi_cmd.uscsi_rqbuf = rqb;
- scsi_cmd.uscsi_rqlen = RQBSIZE;
- scsi_cmd.uscsi_bufaddr = buf;
- scsi_cmd.uscsi_buflen = len;
-
- if ((fd = open(volume, O_RDWR)) == -1)
- fail(EINVAL, "Unable to open specified volume.\n");
-
- if ((rc = ioctl(fd, USCSICMD, &scsi_cmd)))
- fail(EINVAL, "Image operation timed out.");
-
- close(fd);
-
- return (rc);
-}
-
-int
-scsiread(int cmd, char *volume, int len, char *buf)
-{
- int fd;
- int rc;
- struct uscsi_cmd scsi_cmd;
- char *rqb;
- char *cdb;
-
- cdb = (char *)calloc(CDBSIZE, sizeof (char));
- rqb = (char *)calloc(RQBSIZE, sizeof (char));
-
- SCSI_CDB(cdb, CMD_STOREDGE_READ, cmd, len);
-
- scsi_cmd.uscsi_flags = (USCSI_READ | USCSI_RQENABLE);
- scsi_cmd.uscsi_status = 0;
- scsi_cmd.uscsi_timeout = scsi_timeout;
- scsi_cmd.uscsi_cdb = cdb;
- scsi_cmd.uscsi_cdblen = CDBSIZE;
- scsi_cmd.uscsi_rqbuf = rqb;
- scsi_cmd.uscsi_rqlen = RQBSIZE;
- scsi_cmd.uscsi_bufaddr = buf;
- scsi_cmd.uscsi_buflen = len;
- scsi_cmd.uscsi_resid = 0;
- scsi_cmd.uscsi_rqstatus = 0;
- scsi_cmd.uscsi_rqresid = 0;
-
- if ((fd = open(volume, O_RDWR)) == -1)
- fail(EINVAL, "Unable to open specified volume.\n");
-
- if ((rc = ioctl(fd, USCSICMD, &scsi_cmd)))
- fail(EINVAL, "Image operation timed out.");
-
- close(fd);
-
- return (rc);
-}
-
-/*
- * 'iiadm -i' output
- */
-void
-print_set(char *buf)
-{
- pit_props_t props;
- char *wwnp = (char *)buf + sizeof (pit_props_t);
-
- bcopy(buf, &props, sizeof (pit_props_t));
-
- /* vdisk IDs */
- if (props.mstid == -1)
- printf(gettext("<not mapped>"));
- else {
- printf("%s,%d", wwnp, props.mstid);
- wwnp += WWN_STRLEN * wwn_count;
- }
- printf(gettext(" (master volume)\n"));
-
- if (props.shdid == -1)
- printf(gettext("<not mapped>"));
- else {
- printf("%s,%d", wwnp, props.shdid);
- wwnp += WWN_STRLEN * wwn_count;
- }
- printf(gettext(" (shadow volume)\n"));
-
- if (props.bmpid == -1)
- printf(gettext("<not mapped>"));
- else {
- printf("%s,%d", wwnp, props.bmpid);
- wwnp += WWN_STRLEN * wwn_count;
- }
- printf(gettext(" (bitmap volume)\n"));
-
- if (props.has_overflow) {
- if (props.ovrid == -1)
- printf(gettext("<not mapped>"));
- else {
- printf("%s,%d", wwnp, props.ovrid);
- wwnp += WWN_STRLEN * wwn_count;
- }
- printf(gettext(" (ovrflow volume)\n"));
- }
-
- if (strlen(props.group)) {
- printf(gettext("Group: "));
- printf("%s\n", props.group);
- }
- if (strlen(props.cluster)) {
- printf(gettext("Cluster tag: "));
- printf("%s\n", props.cluster);
- }
-
- if (props.flags & DSW_GOLDEN)
- (void) printf(gettext("Independent copy"));
- else
- (void) printf(gettext("Dependent copy"));
-
- if (props.flags & DSW_TREEMAP)
- (void) printf(gettext(", compacted shadow space"));
-
- if (props.flags & DSW_COPYINGP)
- (void) printf(gettext(", copy in progress"));
- else if (props.flags & DSW_COPYING)
- (void) printf(gettext(", copy not active"));
-
- if (props.flags & DSW_COPYINGM)
- (void) printf(gettext(", copying master to shadow"));
-
- if (props.flags & DSW_COPYINGS)
- (void) printf(gettext(", copying shadow to master"));
-
- if (props.flags & DSW_COPYINGX)
- (void) printf(gettext(", abort of copy requested"));
-
- if (props.flags & DSW_MSTOFFLINE)
- (void) printf(gettext(", master volume offline"));
-
- if (props.flags & DSW_SHDOFFLINE)
- (void) printf(gettext(", shadow volume offline"));
-
- if (props.flags & DSW_BMPOFFLINE)
- (void) printf(gettext(", bitmap volume offline"));
-
- if (props.flags & DSW_OVROFFLINE)
- (void) printf(gettext(", overflow volume offline"));
-
- if (props.flags & DSW_SHDEXPORT)
- (void) printf(gettext(", shadow volume exported"));
-
- if (props.flags & DSW_SHDIMPORT)
- (void) printf(gettext(", shadow volume imported"));
-
- if (props.flags & DSW_OVERFLOW)
- (void) printf(gettext(", out of space"));
-
- if (props.flags & DSW_VOVERFLOW)
- (void) printf(gettext(", spilled into overflow volume"));
-
- printf(gettext("\nVolume size: %d\n"), props.size);
-
- if (props.copybits > 0) {
- int pctcopy = (props.copybits * 100) / props.shdchks;
- printf(gettext("Copy bitmap is %d%% set.\n"), pctcopy);
- printf(gettext("\t(bitmap dirty)\n"));
- } else
- printf(gettext("Copy bitmap is clean.\n"));
-
- if (props.shdbits > 0) {
- int pctdiff = (props.shdbits * 100) / props.shdchks;
- printf(gettext("Shadow bitmap is %d%% set.\n"), pctdiff);
- printf(gettext("\t(bitmap dirty)\n"));
- }
- else
- printf(gettext("Differences bitmap is clean.\n"));
-}
-
-int
-confirm(char *msg)
-{
- char c[IN_BUFSIZE];
-
- if (!qflag)
- return (0);
-
- fprintf(stdout, msg);
- fgets(c, IN_BUFSIZE, stdin);
-
- if (c[0] == 'y' || c[0] == 'Y')
- return (0);
-
- fprintf(stderr, gettext("Operation cancelled.\n"));
- return (1);
-}
-
-int
-pit_abort()
-{
- int rc;
- int iirc;
-
- if (confirm(gettext("Abort copy/update operations? (y/n): ")))
- return (0);
-
- rc = scsiwrite(II_PIT_ABORT, volume, sizeof (int), (char *)&iirc);
-
- if (!rc && iirc == DSW_COPYINGP)
- fprintf(stderr, gettext("Not copying.\n"));
-
- return (rc);
-}
-
-int
-pit_copy_update(int cmd)
-{
- int rc;
-
- char msg[80];
- char *op;
- char *v1;
- char *v2;
-
- pit_update_t update;
-
- /* Opeartion text for configmr message */
- if (cmd == II_PIT_COPY)
- op = gettext("Copy");
-
- if (cmd == II_PIT_UPDATE)
- op = gettext("Update");
-
- /* Direction text for confirm messasge */
- if (direction == 'm') {
- v1 = gettext("shadow");
- v2 = gettext("master");
- }
-
- if (direction == 's') {
- v1 = gettext("master");
- v2 = gettext("shadow");
- }
-
- /* Assemble message */
- sprintf(msg, gettext("%s from %s to %s? (y/n): "), op, v1, v2);
-
- /* Confirm */
- if (confirm(msg))
- return (0);
-
- /* Set up buffers */
- update.direction = direction;
-
- /* Begin copy */
- rc = scsiwrite(cmd, volume, sizeof (pit_update_t), (char *)&update);
-
- if (rc)
- return (rc);
-
-
- if (update.iirc == DSW_COPYINGP) {
- fprintf(stderr, gettext("Already copying.\n"));
- 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) */
- bufl = sizeof (pit_props_t) + (WWN_STRLEN * wwn_count * IIVOLCNT);
- bufp = (char *)calloc(1, bufl);
-
- /* Data for all of the II sets */
- if ((rc = scsiread(II_PIT_PROPS, volume, bufl, bufp)))
- goto end;
-
- print_set(bufp);
-end:
- free(bufp);
- return (rc);
-}
-
-int
-pit_wait()
-{
- int rc;
- int iirc;
-
- for (;;) {
- rc = scsiread(II_PIT_WAIT, volume, sizeof (int),
- (char *)&iirc);
-
- if (rc || (iirc != DSW_COPYINGP))
- break;
-
- sleep(POLLTIME);
- }
-
- return (rc);
-}
-
-void
-version()
-{
- printf("dsimage V%d.%d.%d.%d\n",
- ISS_VERSION_MAJ,
- ISS_VERSION_MIN,
- ISS_VERSION_MIC,
- ISS_VERSION_NUM);
-
- exit(0);
-}
diff --git a/usr/src/cmd/avs/errgen/errgen.help b/usr/src/cmd/avs/errgen/errgen.help.txt
index 33600d3bd1..33600d3bd1 100644
--- a/usr/src/cmd/avs/errgen/errgen.help
+++ b/usr/src/cmd/avs/errgen/errgen.help.txt
diff --git a/usr/src/cmd/avs/sdbc/sd_dcmp.c b/usr/src/cmd/avs/sdbc/sd_dcmp.c
deleted file mode 100644
index 8bd85693b0..0000000000
--- a/usr/src/cmd/avs/sdbc/sd_dcmp.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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
- * or http://www.opensolaris.org/os/licensing.
- * 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 <errno.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/param.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/shm.h>
-#include <nsctl.h>
-
-#include <sys/nsctl/sd_cache.h>
-#include <sys/nsctl/sd_conf.h>
-
-
-#define BLK_CMP 16
-#define BYTES_CMP (BLK_CMP*512)
-
-#define min(a, b) ((a) > (b) ? (b) : (a))
-
-int bflag = 0;
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- int fd1, fd2, curpos, r;
- nsc_size_t blocks, blocks2;
- nsc_fd_t *sdfd1, *sdfd2;
- char buf1[BYTES_CMP], buf2[BYTES_CMP];
- int count;
- int c;
-
- if (argc < 3) {
- (void) printf("Usage: spd_dcmp {-b} <path1> <path2> \n");
- (void) printf("Example: spd_dcmp /dev/rdsk/7d4 "
- "/dev/rdsk/13d9\n");
- (void) printf("Example: spd_dcmp -b /dev/rdsk/7d4 "
- "/dev/rdsk/13d9\n");
- (void) printf(" -b : Break on Finding the first Mismatch\n");
- exit(1);
- }
-
- while ((c = getopt(argc, argv, "b")) != -1) {
- switch (c) {
- case 'b':
- bflag = 1;
- break;
- }
- }
- if (bflag) {
- sdfd1 = nsc_open(argv[2], NSC_DEVICE, O_RDONLY);
- } else {
- sdfd1 = nsc_open(argv[1], NSC_DEVICE, O_RDONLY);
- }
- if (!sdfd1) {
- perror("nsc_open");
- exit(errno);
- }
-
- fd1 = nsc_fileno(sdfd1);
- if (fd1 < 0) {
- perror("open");
- exit(errno);
- }
- if (bflag) {
- sdfd2 = nsc_open(argv[3], NSC_DEVICE, O_RDONLY);
- } else {
- sdfd2 = nsc_open(argv[2], NSC_DEVICE, O_RDONLY);
- }
- if (!sdfd2) {
- perror("nsc_open");
- exit(errno);
- }
- fd2 = nsc_fileno(sdfd2);
- if (fd2 < 0) {
- perror("open");
- exit(errno);
- }
-
- r = nsc_partsize(sdfd1, &blocks);
- if (r < 0 || blocks == 0) {
- perror("can't get filesize1");
- return (1);
- }
- r = nsc_partsize(sdfd2, &blocks2);
- if (r < 0 || blocks2 == 0) {
- perror("can't get filesize2");
- return (1);
- }
-
- (void) printf("Size1: %d (%d MB), Size2: %d (%d MB)\n", blocks,
- blocks >> 11, blocks2, blocks2 >> 11);
-
- curpos = 0;
- while (curpos < blocks) {
- r = pread(fd1, buf1, min((blocks-curpos), BLK_CMP) * 512,
- (curpos << SCTRSHFT));
- if (r < 0) {
- perror("read");
- exit(errno);
- } else if (r == 0)
- break;
-
- r = pread(fd2, buf2, min((blocks-curpos), BLK_CMP) * 512,
- (curpos << SCTRSHFT));
- if (r < 0) {
- perror("read");
- exit(errno);
- } else if (r == 0)
- break;
-
- if (bcmp(buf1, buf2, min((blocks-curpos), BLK_CMP) * 512)) {
- (void) printf("\nERROR: data mismatch filepos:%d bl\n",
- curpos);
- if (bflag) {
- close(fd1);
- close(fd2);
- exit(1);
- }
- }
- curpos += min((blocks-curpos), BLK_CMP);
-
- if (!bflag) {
- count ++;
- if ((count % 64) == 0) {
- if (count < 3200) {
- (void) printf(".");
- fflush(stdout);
- } else {
- (void) printf(". %10d bl %7d MB\n",
- curpos, curpos >> 11);
- fflush(stdout);
- count = 0;
- }
- }
- }
- }
- if (!bflag) {
- (void) printf(". %10d bl %7d MB\n", curpos, curpos >> 11);
- }
- close(fd1);
- close(fd2);
- exit(0);
-}