dscvt.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 <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>
#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 *, ...);
hash_node_t **);
static int do_cluster;
static int (*self_check)(char *);
int
{
extern char *optarg;
int rc;
void *librdc;
char *cfgloc;
char c;
switch (c) {
case 'r':
rflg++;
break;
default:
/*NOTREACHED*/
};
}
if (!cfg) {
/*NOTREACHED*/
}
error("cfg_lock",
gettext("unable to obtain write lock for dscfg"));
/*NOTREACHED*/
}
CFG_PARSE_CONF) < 0) {
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"));
}
/*
* re-open with new parser entry
*/
if (!cfg) {
/*NOTREACHED*/
}
error("cfg_lock",
gettext("unable to obtain write lock for dscfg"));
/*NOTREACHED*/
}
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 */
if (rc < 0) {
/*NOTREACHED*/
}
/* handle cluster tags */
if (do_cluster < 0) {
error("cfg_issuncluster",
gettext("unable to ascertain environment"));
/*NOTREACHED*/
}
/* find out if RDC is installed */
if (!rflg)
else {
"sndr library name too long, skipping\n");
} else {
}
}
/* now handle all the sections of the config file */
if (librdc) {
}
/* write changes and exit */
(void) cfg_commit(cfg);
return (0);
}
static void
{
}
exit(1);
}
/*
* Determines which volumes are being used by II and adds them to
* the 'dsvol' section of the config file.
*/
static void
{
int set;
char key[ CFG_MAX_KEY ];
char buf[ CFG_MAX_BUF ];
char *ctag = "-";
iihash = nsc_create_hash();
if (!iihash) {
error("nsc_create_hash",
gettext("unable to create hashtable for Point-in-Time "
"Copy"));
/*NOTREACHED*/
}
break;
}
p = buf;
while (*p && isspace(*p)) {
++p;
}
if (do_cluster) {
/* skip some fields */
}
if (!master) {
break;
}
if (!shadow) {
break;
}
}
}
/*
* Determines which volumes are being used by SNDR and adds them to
* the 'dsvol' section of the config file.
*/
static void
{
int set;
char key[ CFG_MAX_KEY ];
char buf[ CFG_MAX_BUF ];
char *ctag = "-";
rdchash = nsc_create_hash();
if (!rdchash) {
error("nsc_create_hash",
gettext("unable to create hashtable for Remote Mirror"));
/*NOTREACHED*/
}
break;
}
p = buf;
while (*p && isspace(*p)) {
++p;
}
if (!self_check(host)) {
if (do_cluster) {
/* skip some fields */
}
} else if (do_cluster) {
/* skip some fields */
}
if (do_cluster) {
}
if (self_check(host)) {
}
}
}
/*
* 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
{
int set;
char key[ CFG_MAX_KEY ];
char buf[ CFG_MAX_BUF ];
char *path, *p;
char *ctag = "-";
break;
}
p = buf;
while (*p && isspace(*p)) {
++p;
}
if (do_cluster) {
}
}
}
static void
{
int rc;
if (!volp) {
"Error manipulating data: vol %s, user %s\n"),
/*NOTREACHED*/
}
if (CFG_USER_ERR == rc) {
perror("cfg_add_user");
/*NOTREACHED*/
}
} else {
}
if (svhash) {
if (!svolp) {
" insert node into svhash for %s (%s)"),
/*NOTREACHED*/
}
} else {
}
/* remove it from 'sv' in case it was previously put there */
}
}