fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/types.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/time.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <errno.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <signal.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdio.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <string.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <fcntl.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdlib.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <unistd.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <values.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <locale.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/stat.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <strings.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdarg.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/param.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <nsctl.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/cfg.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/unistat/spcs_s.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/unistat/spcs_s_u.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/unistat/spcs_errors.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/dsw.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/dsw_dev.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_TEXT_DOMAIN "II"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid iicpbmp_usage();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid copybmp(char *, char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint find_bitmap_cfg(char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int optind;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *cmdnam;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern char *optarg;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int optind, opterr, optopt;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint update_cfg = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteCFGFILE *cfg;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar shadow[DSW_NAMELEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar buf[CFG_MAX_BUF];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar key[CFG_MAX_KEY];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint setnumber;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef lint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiicpbmp_lintmain(int argc, char *argv[])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemain(int argc, char *argv[])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdnam = argv[0];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (argc > 1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(argv[1], "-c") == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* don't update cfg information */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte update_cfg = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argc--;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (argc == 1 || (argc%2) == 0) /* must have pairs of filenames */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iicpbmp_usage();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (update_cfg) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((cfg = cfg_open(NULL)) == NULL) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr,
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki gettext("Error opening config\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!cfg_lock(cfg, CFG_WRLOCK)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_log("ii", NULL,
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki "iicpbmp CFG_WRLOCK failed, errno %d", errno);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr,
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki gettext("Error locking config\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (argv++; *argv != NULL; argv += 2)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte copybmp(argv[0], argv[1]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (update_cfg)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cfg_close(cfg);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiicpbmp_usage()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr, gettext("Usage:\n"));
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr,
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki gettext("\tiicpbmp [-c] old_bitmap new_bitmap\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecopybmp(char *old_bitmap, char *new_bitmap)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int dsw_fd;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FILE *ifp, *ofp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ii_header_t header;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char cp_buffer[256];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dsw_stat_t args;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dsw_fd = open(DSWDEV, O_RDONLY);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dsw_fd < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte perror(DSWDEV);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*old_bitmap != '/' || *new_bitmap != '/') {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr, gettext("Both old and new bitmap "
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki "file names must begin with a /.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strlen(new_bitmap) > DSW_NAMELEN) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr,
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki gettext("New bitmap name is too long.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (update_cfg && find_bitmap_cfg(old_bitmap) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte perror(old_bitmap);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr,
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki gettext("Old bitmap not in existing cfg\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncpy(args.shadow_vol, shadow, DSW_NAMELEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args.shadow_vol[DSW_NAMELEN-1] = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args.status = spcs_s_ucreate();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ioctl(dsw_fd, DSWIOC_STAT, &args) != -1) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr, gettext("Suspend the Point-in-Time Copy "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "set first\n"));
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) close(dsw_fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ifp = fopen(old_bitmap, "r")) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte perror(old_bitmap);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr, gettext("Can't open old bitmap file\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check old header looks like an Point-in-Time Copy bitmap header */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fread(&header, sizeof (header), 1, ifp) != 1) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr, gettext("Can't read old bitmap file\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (header.ii_magic != DSW_CLEAN && header.ii_magic != DSW_DIRTY) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr, gettext("%s is not a Point-in-Time Copy "
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki "bitmap.\n"), old_bitmap);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strncmp(header.bitmap_vol, old_bitmap, DSW_NAMELEN) != 0) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr, gettext(
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki "%s has Point-in-Time Copy bitmap magic number,\n"
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki "but does not contain correct data.\n"), old_bitmap);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ofp = fopen(new_bitmap, "w")) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte perror(new_bitmap);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr, gettext("Can't open new bitmap file\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set up new header */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) memset(header.bitmap_vol, 0, DSW_NAMELEN);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncpy(header.bitmap_vol, new_bitmap, DSW_NAMELEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fwrite(&header, sizeof (header), 1, ofp) != 1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte perror(new_bitmap);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fprintf(stderr,
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki gettext("Can't write new bitmap header\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exit(1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Copy the bitmap itself */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while ((i = fread(cp_buffer, sizeof (char), sizeof (cp_buffer), ifp))
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fwrite(cp_buffer, sizeof (char), i, ofp) != i) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte perror(gettext("Write new bitmap failed"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fclose(ofp);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) fclose(ifp);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) close(dsw_fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (update_cfg) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) sprintf(key, "ii.set%d.bitmap", setnumber);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_put_cstring(cfg, key, new_bitmap, strlen(new_bitmap))
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte perror("cfg_put_cstring");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) cfg_commit(cfg);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_log("ii", NULL,
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki "iicpbmp copy bit map for %s from %s to %s",
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki shadow, old_bitmap, new_bitmap);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * find_bitmap_cfg()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefind_bitmap_cfg(char *bitmap)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (setnumber = 1; ; setnumber++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(buf, CFG_MAX_BUF);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) snprintf(key, sizeof (key), "ii.set%d.bitmap",
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki setnumber);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, DSW_NAMELEN) < 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(buf, bitmap) == 0) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) snprintf(key, sizeof (key), "ii.set%d.shadow",
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki setnumber);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) cfg_get_cstring(cfg, key, shadow, DSW_NAMELEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (setnumber);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}