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 <stdio.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdlib.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <string.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <unistd.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <errno.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/mutex.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <kstat.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/unistat/spcs_s.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/dsw.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "../../../uts/common/avs/ns/dsw/dsw_dev.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/dsw_dev.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "sdbc_stats.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "ii_stats.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "dsstat.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "common.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "report.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic iistat_t *ii_top = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid ii_add_stat(iistat_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiistat_t *ii_del_stat(iistat_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint ii_value_check(iistat_t *iistat);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint ii_validate(kstat_t *ksp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint ii_vol_selected(kstat_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ii_discover() - looks for new statistics to be monitored.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Verifies that any statistics found are now already being
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * monitored.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteii_discover(kstat_ctl_t *kc)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte static int validated = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_t *ksp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Loop on all kstats */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *kname;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat_t *cur;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat_t *iistat = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_t *mst_ksp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_t *shd_ksp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_t *bmp_ksp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_t *ovr_ksp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Search for II set */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(ksp->ks_class, II_KSTAT_CLASS) != 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (kstat_read(kc, ksp, NULL) == -1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Validate kstat structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (! validated) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ii_validate(ksp))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EINVAL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte validated++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Duplicate check
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (cur = ii_top; cur != NULL; cur = cur->next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *cur_vname, *tst_vname;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t cur_inst, tst_inst;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur_vname = cur->pre_set->ks_name;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur_inst = cur->pre_set->ks_instance;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tst_vname = ksp->ks_name;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tst_inst = ksp->ks_instance;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(cur_vname, tst_vname) == 0 &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur_inst == tst_inst)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Initialize new record
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat = (iistat_t *)calloc(1, sizeof (iistat_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Set kstat
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->pre_set = kstat_retrieve(kc, ksp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (iistat->pre_set == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->collected |= GOT_SETSTAT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Master kstat
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kname = kstat_value(iistat->pre_set, DSW_SKSTAT_MSTIO);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mst_ksp = kstat_lookup(kc, II_KSTAT_MODULE, -1, kname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->pre_mst = kstat_retrieve(kc, mst_ksp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (iistat->pre_mst == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->collected |= GOT_MSTSTAT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Shadow kstat
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kname = kstat_value(iistat->pre_set, DSW_SKSTAT_SHDIO);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte shd_ksp = kstat_lookup(kc, II_KSTAT_MODULE, -1, kname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->pre_shd = kstat_retrieve(kc, shd_ksp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (iistat->pre_shd == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->collected |= GOT_SHDSTAT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Bitmap kstat
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kname = kstat_value(iistat->pre_set, DSW_SKSTAT_BMPIO);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bmp_ksp = kstat_lookup(kc, II_KSTAT_MODULE, -1, kname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->pre_bmp = kstat_retrieve(kc, bmp_ksp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (iistat->pre_bmp == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->collected |= GOT_BMPSTAT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Overflow kstat
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kname = kstat_value(iistat->pre_set, DSW_SKSTAT_OVRIO);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ovr_ksp = kstat_lookup(kc, II_KSTAT_MODULE, -1, kname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->pre_ovr = kstat_retrieve(kc, ovr_ksp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (iistat->pre_ovr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->collected |= GOT_OVRSTAT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortenext:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Check if we got a complete set of stats
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (iistat == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (IIMG_COMPLETE(iistat->collected)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) ii_del_stat(iistat);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Add to linked list
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ii_add_stat(iistat);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ii_top == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (EAGAIN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ii_update() - updates all of the statistics currently being monitored.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteii_update(kstat_ctl_t *kc)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat_t *cur;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (cur = ii_top; cur != NULL; cur = cur->next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char volname[KSTAT_STRLEN + 1];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *kname;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_t *ksp = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur->collected = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Age off old stats
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cur->cur_set != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_free(cur->pre_set);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_free(cur->pre_mst);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_free(cur->pre_shd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_free(cur->pre_bmp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur->pre_set = cur->cur_set;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur->pre_mst = cur->cur_mst;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur->pre_shd = cur->cur_shd;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur->pre_bmp = cur->cur_bmp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cur->cur_ovr != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_free(cur->pre_ovr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur->pre_ovr = cur->cur_ovr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Set kstat
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncpy(volname, cur->pre_set->ks_name, KSTAT_STRLEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte volname[KSTAT_STRLEN] = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ksp = kstat_lookup(kc, II_KSTAT_MODULE, -1, volname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((cur->cur_set = kstat_retrieve(kc, ksp)) == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur->collected |= GOT_SETSTAT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Validate set
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(cur->pre_set->ks_name, cur->cur_set->ks_name) != 0 ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur->pre_set->ks_instance != cur->cur_set->ks_instance)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Master kstat
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kname = kstat_value(cur->cur_set, DSW_SKSTAT_MSTIO);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ksp = kstat_lookup(kc, II_KSTAT_MODULE, -1, kname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((cur->cur_mst = kstat_retrieve(kc, ksp)) == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur->collected |= GOT_MSTSTAT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Shadow kstat
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kname = kstat_value(cur->cur_set, DSW_SKSTAT_SHDIO);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ksp = kstat_lookup(kc, II_KSTAT_MODULE, -1, kname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((cur->cur_shd = kstat_retrieve(kc, ksp)) == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur->collected |= GOT_SHDSTAT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Bitmap kstat
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kname = kstat_value(cur->pre_set, DSW_SKSTAT_BMPIO);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ksp = kstat_lookup(kc, II_KSTAT_MODULE, -1, kname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((cur->cur_bmp = kstat_retrieve(kc, ksp)) == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur->collected |= GOT_BMPSTAT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Overflow kstat
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kname = kstat_value(cur->cur_set, DSW_SKSTAT_OVRIO);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ksp = kstat_lookup(kc, II_KSTAT_MODULE, -1, kname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ksp == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cur->pre_ovr != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_free(cur->pre_ovr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur->pre_ovr = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cur->cur_ovr != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_free(cur->cur_ovr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur->cur_ovr = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cur->pre_ovr == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((cur->pre_ovr = kstat_retrieve(kc, ksp)) == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((cur->cur_ovr = kstat_retrieve(kc, ksp)) == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur->collected |= GOT_OVRSTAT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ii_report() - outputs statistics for the statistics currently being
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * monitored. Deletes statistics for volumes that have been disabled.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteii_report()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t *flags;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int padsz = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char pad[20] = {0};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat_t *cur, *pre = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ii_top == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Create padding string for secondary report lines */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dflags & FLAGS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte padsz += STAT_HDR_SIZE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte padsz += STAT_HDR_SIZE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dflags & PCTS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte padsz += PCT_HDR_SIZE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (padsz) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char fmt[20];
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) sprintf(fmt, "%%%ds", padsz);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) sprintf(pad, fmt, "");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (cur = ii_top; cur; /* CSTYLED */) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int first = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char data[20] = {0};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check to see if this is this a complete */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (IIMG_COMPLETE(cur->collected)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *c;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char vol[(NAMED_LEN * 4) + 1] = {0};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int offset;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat_t *next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* notify user of set being disabled */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->pre_set, DSW_SKSTAT_SETA);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncpy(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->pre_set, DSW_SKSTAT_SETB);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->pre_set, DSW_SKSTAT_SETC);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->pre_set, DSW_SKSTAT_SETD);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = strlen(vol) - NAMED_LEN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (offset < 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(DATA_C16, vol + offset);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(" %s\n", II_DISABLED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* free memory and remove stat from list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte next = ii_del_stat(cur);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (! pre)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur = ii_top = next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur = pre->next = next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check to see if the user specified this volume */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (! ii_vol_selected(cur->pre_set))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check to see if zflag applies */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (zflag && ii_value_check(cur) == 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Calculate flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte flags = kstat_value(cur->cur_set, DSW_SKSTAT_FLAGS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dflags & FLAGS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char c[STAT_HDR_SIZE];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char vtype[STAT_HDR_SIZE];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char vstat[STAT_HDR_SIZE];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*flags & DSW_GOLDEN)
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(c, II_INDEPENDENT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(c, II_DEPENDENT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) sprintf(vtype, DATA_C2, c);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcat(data, vtype);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*flags & DSW_COPYINGP)
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(c, II_COPYING);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(c, NO_INFO);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) sprintf(vstat, DATA_C2, c);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcat(data, vstat);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Calculate sync needed precentage */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dflags & PCTS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char snpct[10];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t *chkbits;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t *cpybits;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t *shdbits;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t *volsize;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte float pct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cpybits =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_value(cur->cur_set, DSW_SKSTAT_COPYBITS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte shdbits =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_value(cur->cur_set, DSW_SKSTAT_SHDBITS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte volsize =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_value(cur->cur_set, DSW_SKSTAT_SIZE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *volsize /= DSW_SIZE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte chkbits = *cpybits >= *shdbits ? cpybits : shdbits;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pct = ((float)*chkbits / *volsize) * 100.0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) sprintf(snpct, DATA_F62, pct);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcat(data, snpct);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Master statistics */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rflags & IIMG_MST) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *c;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char vol[(NAMED_LEN * 4) + 1] = {0};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int offset;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->cur_set, DSW_SKSTAT_MSTA);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->cur_set, DSW_SKSTAT_MSTB);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->cur_set, DSW_SKSTAT_MSTC);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->cur_set, DSW_SKSTAT_MSTD);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = strlen(vol) - NAMED_LEN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (offset < 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte header();
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(DATA_C16, vol + offset);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf("%s", data);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(ROLE_INF_FMT, II_MASTER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*flags & DSW_MSTOFFLINE) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(" <<offline>>");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte linesout++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
e31df31051ab05e561eab5b23bb1c00627a10d64Thomas Atkins io_report(cur->cur_mst, cur->pre_mst,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_getstat(vol + offset));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (first) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(data, strlen(pad) > 0 ? pad : "");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Shadow statistics */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rflags & IIMG_SHD) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *c;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char vol[(NAMED_LEN * 4) + 1] = {0};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int offset;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->cur_set, DSW_SKSTAT_SETA);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->cur_set, DSW_SKSTAT_SETB);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->cur_set, DSW_SKSTAT_SETC);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->cur_set, DSW_SKSTAT_SETD);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = strlen(vol) - NAMED_LEN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (offset < 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte header();
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(DATA_C16, vol + offset);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf("%s", data);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(ROLE_INF_FMT, II_SHADOW);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*flags & DSW_SHDOFFLINE) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(" <<offline>>");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte linesout++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
e31df31051ab05e561eab5b23bb1c00627a10d64Thomas Atkins io_report(cur->cur_shd, cur->pre_shd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_getstat(vol + offset));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (first) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(data, strlen(pad) > 0 ? pad : "");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Bitmap statistics */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rflags & IIMG_BMP) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *c;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char vol[(NAMED_LEN * 4) + 1] = {0};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int offset;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->cur_set, DSW_SKSTAT_BMPA);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->cur_set, DSW_SKSTAT_BMPB);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->cur_set, DSW_SKSTAT_BMPC);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->cur_set, DSW_SKSTAT_BMPD);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = strlen(vol) - NAMED_LEN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (offset < 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte header();
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(DATA_C16, vol + offset);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf("%s", data);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(ROLE_INF_FMT, II_BITMAP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*flags & DSW_BMPOFFLINE) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(" <<offline>>");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte linesout++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
e31df31051ab05e561eab5b23bb1c00627a10d64Thomas Atkins io_report(cur->cur_bmp, cur->pre_bmp,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_getstat(vol + offset));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (first) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(data, strlen(pad) > 0 ? pad : "");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Overflow statistics */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rflags & IIMG_OVR) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *c;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char msg[20] = {0};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char vol[(NAMED_LEN * 4) + 1] = {0};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int offset;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cur->cur_ovr == NULL && cur->pre_ovr != NULL)
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(msg, " <<attached>>");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (! (cur->collected & GOT_OVRSTAT))
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(msg, " <<not attached>>");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->cur_set, DSW_SKSTAT_OVRA);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncpy(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->cur_set, DSW_SKSTAT_OVRB);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->cur_set, DSW_SKSTAT_OVRC);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = kstat_value(cur->cur_set, DSW_SKSTAT_OVRD);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(vol, c, NAMED_LEN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = strlen(vol) - NAMED_LEN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (offset < 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte header();
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(DATA_C16, vol + offset);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf("%s", data);
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(ROLE_INF_FMT, II_OVERFLOW);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strlen(msg)) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf("%s\n", msg);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte linesout++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*flags & DSW_OVROFFLINE) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf(" <<offline>>");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte linesout++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
e31df31051ab05e561eab5b23bb1c00627a10d64Thomas Atkins io_report(cur->cur_ovr, cur->pre_ovr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_getstat(vol + offset));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (first) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(data, strlen(pad) > 0 ? pad : "");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortenext:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pre = cur;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur = cur->next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ii_add_stat() - adds a fully populated iistat_t structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to the linked list of currently monitored kstats. The structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * will be added in alphabetical order, using the volume name of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the shadow volume as the key.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteii_add_stat(iistat_t *iistat)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat_t *cur;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ii_top == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ii_top = iistat;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (cur = ii_top; cur != NULL; cur = cur->next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(cur->pre_set->ks_name,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->pre_set->ks_name) <= 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If we get to the last item in the list, then just
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * add this one to the end
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cur->next == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur->next = iistat;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(cur->next->pre_set->ks_name,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->pre_set->ks_name) > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->next = cur->next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur->next = iistat;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cur == ii_top)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ii_top = iistat;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->next = cur;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ii_del_stat() - deallocate memory for the structure being
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * passed in.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * parameters
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iistat_t *iistat - structure to be deallocated
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * returns
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * iistat_t * - pointer to the "next" structures in the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * linked list. May be NULL if we are removing the last
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * structure in the linked list.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiistat_t *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteii_del_stat(iistat_t *iistat)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat_t *next = iistat->next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_free(iistat->pre_set);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_free(iistat->pre_mst);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_free(iistat->pre_shd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_free(iistat->pre_bmp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_free(iistat->pre_ovr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_free(iistat->cur_set);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_free(iistat->cur_mst);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_free(iistat->cur_shd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_free(iistat->cur_bmp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_free(iistat->cur_ovr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(iistat);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (next);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteii_value_check(iistat_t *iistat)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (IIMG_COMPLETE(iistat->collected))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (io_value_check(iistat->pre_mst->ks_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->cur_mst->ks_data)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (io_value_check(iistat->pre_shd->ks_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->cur_shd->ks_data)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (io_value_check(iistat->pre_bmp->ks_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->cur_bmp->ks_data)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (iistat->pre_ovr && iistat->cur_ovr) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (io_value_check(iistat->pre_ovr->ks_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iistat->cur_ovr->ks_data)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteii_validate(kstat_t *ksp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (! kstat_value(ksp, DSW_SKSTAT_MSTIO) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ! kstat_value(ksp, DSW_SKSTAT_SHDIO) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ! kstat_value(ksp, DSW_SKSTAT_BMPIO) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ! kstat_value(ksp, DSW_SKSTAT_OVRIO) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ! kstat_value(ksp, DSW_SKSTAT_FLAGS) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ! kstat_value(ksp, DSW_SKSTAT_MSTA) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ! kstat_value(ksp, DSW_SKSTAT_SETA) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ! kstat_value(ksp, DSW_SKSTAT_BMPA) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ! kstat_value(ksp, DSW_SKSTAT_OVRA) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ! kstat_value(ksp, DSW_SKSTAT_SHDBITS) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ! kstat_value(ksp, DSW_SKSTAT_COPYBITS) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ! kstat_value(ksp, DSW_SKSTAT_SIZE))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteii_vol_selected(kstat_t *ksp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vslist_t *vslist = vs_top;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (vslist = vs_top; vslist != NULL; vslist = vslist->next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *vn;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int off = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte vn = ksp->ks_name;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((off = strlen(vn) - NAMED_LEN) <= 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte off = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(vslist->volname, &vn[off]) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (vs_top != NULL && vslist == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}