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/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _DSW_DEV_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _DSW_DEV_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern "C" {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Definitions for kstats
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_SIZE "size"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_MTIME "latest modified time"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_FLAGS "flags"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_THROTTLE_UNIT "ii_throttle_unit"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_THROTTLE_DELAY "ii_throttle_delay"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_SHDCHKS "shdchks"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_SHDCHKUSED "shdchkused"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_SHDBITS "shdbits"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_COPYBITS "copybits"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_MSTA "mst-a"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_MSTB "mst-b"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_MSTC "mst-c"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_MSTD "mst-d"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_SETA "set-a"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_SETB "set-b"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_SETC "set-c"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_SETD "set-d"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_BMPA "bmp-a"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_BMPB "bmp-b"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_BMPC "bmp-c"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_BMPD "bmp-d"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_OVRA "ovr-a"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_OVRB "ovr-b"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_OVRC "ovr-c"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_OVRD "ovr-d"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_MSTIO "mst-io"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_SHDIO "shd-io"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_BMPIO "bmp-io"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SKSTAT_OVRIO "ovr-io"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Bitmap macros
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_BIT_CLR(bmap, bit) (bmap &= (char)~(1 << bit))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_BIT_SET(bmap, bit) (bmap |= (char)(1 << bit))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_BIT_ISSET(bmap, bit) ((bmap & (1 << bit)) != 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_CBLK_FBA 16 /* cache blocks in fba's */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_SHD_BM_OFFSET DSW_CBLK_FBA /* offset to allow for header */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_COPY_BM_OFFSET (DSW_SHD_BM_OFFSET + \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DSW_BM_FBA_LEN(ip->bi_size))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_BM_FBA_LEN(mst_size) ((mst_size) / FBA_SIZE(DSW_SIZE*DSW_BITS) + \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DSW_CBLK_FBA)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_BM_SIZE_CHUNKS(ip) ((ip->bi_size + DSW_SIZE - 1) / DSW_SIZE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_BM_SIZE_BYTES(ip) ((DSW_BM_SIZE_CHUNKS(ip) + DSW_BITS - 1) / \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DSW_BITS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_CHK2FBA(chunk) (((nsc_off_t)(chunk)) * DSW_SIZE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(_KERNEL) || defined(_KMEMUSER)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Shadow types.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_GOLDEN_TYPE 0x1000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_QUICK_TYPE 0x2000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Miscellaneous defines
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_INTERNAL 0x1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_EXTERNAL 0x2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_EXISTING 0x01 /* Internal dsw_ioctl()/dsw_config() flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_IMPORT 0x02
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * defines for _ii_nsc_io and _ii_write, used by kstats
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define KS_NA 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define KS_MST 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define KS_SHD 2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define KS_BMP 3
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define KS_OVR 4
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * global kstats
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct _iigkstat_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* static */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t ii_debug;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t ii_bitmap;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t ii_throttle_unit;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t ii_throttle_delay;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t ii_copy_direct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* dynamic */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t num_sets;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t assoc_over;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t spilled_over;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} iigkstat_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern iigkstat_t iigkstat;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * set-specific kstats
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct _ii_kstat_set_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t size; /* from _ii_stat() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t mtime; /* from _ii_stat() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t flags; /* from _ii_stat() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t unit; /* ii_throttle_unit */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t delay; /* ii_throttle_delay */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t shdchks; /* from _ii_stat() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t shdchkused; /* from _ii_stat() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t shdbits; /* # bits set shadow bitmap */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t copybits; /* # bits set copy bitmap */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t mst_a; /* name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t mst_b; /* .. of */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t mst_c; /* .. master */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t mst_d; /* .. volume */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t set_a; /* name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t set_b; /* .. of */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t set_c; /* .. the */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t set_d; /* .. set */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t bmp_a; /* name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t bmp_b; /* .. of */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t bmp_c; /* .. bitmap */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t bmp_d; /* .. volume */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t ovr_a; /* name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t ovr_b; /* .. of */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t ovr_c; /* .. overflow */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t ovr_d; /* .. volume */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t mst_io; /* kstat_io of master */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t shd_io; /* kstat_io of shadow */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t bmp_io; /* kstat_io of bitmap */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_named_t ovr_io; /* kstat_io of overflow */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} ii_kstat_set_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern ii_kstat_set_t ii_kstat_set;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IOSTAT_NAME_LEN 10
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Basic types */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef II_MULTIMULTI_TERABYTE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef int64_t chunkid_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef int32_t chunkid32_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef int32_t chunkid_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * OV_HEADER_VERSION
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 = original OV header version
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 1 = flags support
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define OV_HEADER_VERSION 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Overflow disk volume header */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct _ii_doverflow_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char ii_dvolname[DSW_NAMELEN]; /* this volumes name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t ii_dhmagic; /* sanity check */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t ii_dhversion; /* volume format */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t ii_ddrefcnt; /* total number of users */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t ii_dflags; /* status flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int64_t ii_dfreehead; /* chain of freed chunks */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int64_t ii_dnchunks; /* total number of chunks */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int64_t ii_dunused; /* number of chunks available */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int64_t ii_dused; /* number of chunks allocated */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t ii_urefcnt; /* # shadows needing update */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t ii_dcrefcnt; /* current number of users */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} _ii_doverflow_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Overflow volume in core structure */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct _ii_overflow_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _ii_doverflow_t ii_do;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t ii_mutex; /* Mutex */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t ii_kstat_mutex; /* Mutex for overflow kstat */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ii_detachcnt; /* users detaching on disable */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct _ii_overflow_s *ii_next; /* chain of incore structs */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct _ii_info_dev_s *ii_dev; /* pointer to device details */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_t *ii_overflow; /* kstats data for this vol */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char ii_ioname[KSTAT_DATA_CHAR_LEN]; /* name for iostat -x */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} _ii_overflow_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ii_volname ii_do.ii_dvolname
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ii_hmagic ii_do.ii_dhmagic
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ii_drefcnt ii_do.ii_ddrefcnt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ii_freehead ii_do.ii_dfreehead
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ii_nchunks ii_do.ii_dnchunks
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ii_unused ii_do.ii_dunused
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ii_used ii_do.ii_dused
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ii_hversion ii_do.ii_dhversion
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ii_flags ii_do.ii_dflags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ii_urefcnt ii_do.ii_urefcnt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ii_crefcnt ii_do.ii_dcrefcnt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_OHEADER_FBA 0 /* overflow header location */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * logging of kstat_io
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DISABLE_KSTATS
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_READ_START(ip, type)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_READ_END(ip, type, rc, blocks)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_WRITE_START(ip, type)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_WRITE_END(ip, type, rc, blocks)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_KS(ip, x) KSTAT_IO_PTR(ip->bi_kstat_io.x)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_MUTEX(ip, x) ip->bi_kstat_io.x->ks_lock
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_BLKSIZE 512
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_READ_START(ip, type) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ip->bi_kstat_io.type) { \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_enter(II_MUTEX(ip, type)); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_runq_enter(II_KS(ip, type)); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_exit(II_MUTEX(ip, type)); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_READ_END(ip, type, rc, blocks) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ip->bi_kstat_io.type) { \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_enter(II_MUTEX(ip, type)); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (II_SUCCESS(rc)) { \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte II_KS(ip, type)->reads++; \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte II_KS(ip, type)->nread += II_BLKSIZE * (blocks);\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_runq_exit(II_KS(ip, type)); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_exit(II_MUTEX(ip, type)); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_WRITE_START(ip, type) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ip->bi_kstat_io.type) { \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_enter(II_MUTEX(ip, type)); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_runq_enter(II_KS(ip, type)); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_exit(II_MUTEX(ip, type)); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_WRITE_END(ip, type, rc, blocks) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ip->bi_kstat_io.type) { \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_enter(II_MUTEX(ip, type)); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (II_SUCCESS(rc)) { \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte II_KS(ip, type)->writes++; \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte II_KS(ip, type)->nwritten += II_BLKSIZE * (blocks);\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_runq_exit(II_KS(ip, type)); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mutex_exit(II_MUTEX(ip, type)); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_NSC_READ(ip, type, rc, buf, pos, len, flag) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte II_READ_START(ip, type); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = nsc_read(buf, pos, len, flag); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte II_READ_END(ip, type, rc, len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_NSC_WRITE(ip, type, rc, buf, pos, len, flag) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte II_WRITE_START(ip, type); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = nsc_write(buf, pos, len, flag); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte II_WRITE_END(ip, type, rc, len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_NSC_COPY_DIRECT(ip, t1, t2, rc, buf1, buf2, pos1, pos2, len) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte II_WRITE_START(ip, t2); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = nsc_copy_direct(buf1, buf2, pos1, pos2, len); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte II_WRITE_END(ip, t2, rc, len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_ALLOC_BUF(ip, type, rc, fd, pos, len, flag, tmp) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (flag & NSC_READ) { \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte II_READ_START(ip, type); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = nsc_alloc_buf(fd, pos, len, flag, tmp); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (flag & NSC_READ) { \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte II_READ_END(ip, type, rc, len); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * All kstat_io associated with a set. NOTE: only one mutex for all
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of the kstats for a given set; all master/shadow/bmp/overflow mutexes
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * point back to the statmutex
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct _ii_kstat_info_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_t *master;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_t *shadow;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_t *bitmap;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_t *overflow;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t statmutex;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char mstio[KSTAT_DATA_CHAR_LEN]; /* name of mst in iostat -x */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char shdio[KSTAT_DATA_CHAR_LEN]; /* name of shd in iostat -x */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char bmpio[KSTAT_DATA_CHAR_LEN]; /* name of bmp in iostat -x */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char ovrio[KSTAT_DATA_CHAR_LEN]; /* name of ovr in iostat -x */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} ii_kstat_info_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * II device info structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct _ii_info_dev_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_fd_t *bi_fd; /* Bitmap file descriptor */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_iodev_t *bi_iodev; /* I/O device structure */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_path_t *bi_tok; /* Register path token */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int bi_ref; /* Count of fd's referencing */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int bi_rsrv; /* Count of reserves held */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int bi_orsrv; /* Reserves for other io prov */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int bi_flag; /* Internal/External reserve */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} _ii_info_dev_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct _ii_info_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct _ii_info_s *bi_next; /* Chain of all groups */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct _ii_info_s *bi_head; /* head of sibling chain */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct _ii_info_s *bi_sibling; /* Chain of groups with same */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* master */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct _ii_info_s *bi_master; /* location of master */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct _ii_info_s *bi_nextmst; /* next multimaster */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t bi_mutex; /* Mutex */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _ii_info_dev_t *bi_mstdev;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _ii_info_dev_t *bi_mstrdev;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _ii_info_dev_t bi_shddev;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _ii_info_dev_t bi_shdrdev;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _ii_info_dev_t bi_bmpdev;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char bi_keyname[DSW_NAMELEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char *bi_bitmap; /* Master device bitmap */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *bi_cluster; /* cluster name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *bi_group; /* group name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *bi_busy; /* Busy bitmap */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_off_t bi_shdfba; /* location of shadow bitmap */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_size_t bi_shdbits; /* shadow bitmap counter */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_off_t bi_copyfba; /* location of copy bitmap */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_size_t bi_copybits; /* copy bitmap counter */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_size_t bi_size; /* Size of mst device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t bi_flags; /* Flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t bi_state; /* State flags */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int bi_disabled; /* Disable has started */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int bi_ioctl; /* Number of active ioctls */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int bi_release; /* Do a release in copyvol */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int bi_rsrvcnt; /* reserve count */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kcondvar_t bi_copydonecv; /* Copy operation condvar */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kcondvar_t bi_reservecv; /* Reserve condvar */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kcondvar_t bi_releasecv; /* Release condvar */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kcondvar_t bi_closingcv; /* Shadow closing condvar */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kcondvar_t bi_ioctlcv; /* Ioctls complete condvar */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kcondvar_t bi_busycv; /* Busy bitmap condvar */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krwlock_t bi_busyrw; /* Busy bitmap rwlock */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct _ii_bmp_ops_s *bi_bitmap_ops; /* Functions for bitmap ops */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t bi_rsrvmutex; /* Reserve operation mutex */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t bi_rlsemutex; /* Release operation mutex */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t bi_bmpmutex; /* mutex for bi_bitmap_ops */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte chunkid_t bi_mstchks;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte chunkid_t bi_shdchks; /* # of chunks on shadow vol */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte chunkid_t bi_shdchkused; /* # of allocated */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte chunkid_t bi_shdfchk; /* start of shd chunk flst */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _ii_overflow_t *bi_overflow;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct ii_fd_s *bi_iifd; /* fd holding master's ip */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t bi_throttle_unit;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t bi_throttle_delay;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte krwlock_t bi_linkrw; /* altering linkage rwlock */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t bi_chksmutex; /* Mutex for bi_???chks */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pid_t bi_locked_pid; /* lock pid for update/copy */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_t *bi_kstat; /* kstat data for set */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ii_kstat_info_t bi_kstat_io; /* kstat I/O data for set */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte time_t bi_mtime;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} _ii_info_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_bmpfd bi_bmpdev.bi_fd
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_mstfd bi_mstdev->bi_fd
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_mstrfd bi_mstrdev->bi_fd
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_shdfd bi_shddev.bi_fd
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_shdrfd bi_shdrdev.bi_fd
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_mst_iodev bi_mstdev->bi_iodev
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_mstr_iodev bi_mstrdev->bi_iodev
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_shd_iodev bi_shddev.bi_iodev
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_shdr_iodev bi_shdrdev.bi_iodev
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_bmp_iodev bi_bmpdev.bi_iodev
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_mst_tok bi_mstdev->bi_tok
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_mstr_tok bi_mstrdev->bi_tok
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_shd_tok bi_shddev.bi_tok
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_shdr_tok bi_shdrdev.bi_tok
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_bmp_tok bi_bmpdev.bi_tok
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_mstref bi_mstdev->bi_ref
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_mstrref bi_mstrdev->bi_ref
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_shdref bi_shddev.bi_ref
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_shdrref bi_shdrdev.bi_ref
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_bmpref bi_bmpdev.bi_ref
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_mstrsrv bi_mstdev->bi_rsrv
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_mstrrsrv bi_mstrdev->bi_rsrv
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_shdrsrv bi_shddev.bi_rsrv
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_shdrrsrv bi_shdrdev.bi_rsrv
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_bmprsrv bi_bmpdev.bi_rsrv
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_mstrflag bi_mstrdev->bi_flag
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define bi_shdrflag bi_shdrdev.bi_flag
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Cluster and group linked lists
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct _ii_lstinfo_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _ii_info_t *lst_ip; /* ptr to info_t */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct _ii_lstinfo_s *lst_next; /* ptr to next in chain */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} _ii_lstinfo_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct _ii_lsthead_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint64_t lst_hash; /* from nsc_strhash */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char lst_name[DSW_NAMELEN]; /* resource group */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _ii_lstinfo_t *lst_start; /* start of set list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct _ii_lsthead_s *lst_next; /* next list head */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} _ii_lsthead_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Flag set and clear macros and function.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid _ii_flag_op(int and, int or, _ii_info_t *ip, int update);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_FLAG_SET(f, ip) _ii_flag_op(~0, (f), ip, TRUE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_FLAG_CLR(f, ip) _ii_flag_op(~(f), 0, ip, TRUE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_FLAG_SETX(f, ip) _ii_flag_op(~0, (f), ip, FALSE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_FLAG_CLRX(f, ip) _ii_flag_op(~(f), 0, ip, FALSE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_FLAG_ASSIGN(f, ip) _ii_flag_op(0, (f), ip, FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define LOG_EVENT(msg, level) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_do_sysevent("ii", msg, level, level, component, ii_dip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Reserve and release macros */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* also used by ii_volume() volume identification, hence NONE & OVR */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NONE 0x0000 /* no volume type */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MST 0x0001 /* master reserve/release flag */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MSTR 0x0010 /* raw master reserve/release flag */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SHD 0x0002 /* shadow reserve/release flag */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SHDR 0x0020 /* raw shadow reserve/release flag */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define BMP 0x0100 /* bitmap reserve/release flag */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define OVR 0x0400 /* overflow volume */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define RSRV(ip) ((ip)->bi_rsrv > 0 || (ip)->bi_orsrv > 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MSTRSRV(ip) (RSRV(((ip)->bi_mstdev)))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SHDRSRV(ip) (RSRV(&((ip)->bi_shddev)))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MSTFD(ip) (MSTRSRV(ip) ? (ip)->bi_mstfd : (ip)->bi_mstrfd)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SHDFD(ip) (SHDRSRV(ip) ? (ip)->bi_shdfd : (ip)->bi_shdrfd)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define OVRFD(ip) (ip->bi_overflow->ii_dev->bi_fd)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_RAW(ii) (((ii)->ii_oflags&NSC_DEVICE) != 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_FD(ii) ((ii)->ii_shd ? SHDFD((ii)->ii_info) : \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MSTFD((ii)->ii_info))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* are there multiple shadows of ip's master volume? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NSHADOWS(ip) ((ip)->bi_head != (ip) || (ip)->bi_sibling)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct _ii_bmp_ops_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*co_bmp)(_ii_info_t *, nsc_off_t, unsigned char *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*ci_bmp)(_ii_info_t *, nsc_off_t, unsigned char *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*zerobm)(_ii_info_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*copybm)(_ii_info_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*orbm)(_ii_info_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*tst_shd_bit)(_ii_info_t *, chunkid_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*set_shd_bit)(_ii_info_t *, chunkid_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*tst_copy_bit)(_ii_info_t *, chunkid_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*set_copy_bit)(_ii_info_t *, chunkid_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*clr_copy_bits)(_ii_info_t *, chunkid_t, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte chunkid_t (*next_copy_bit)(_ii_info_t *, chunkid_t, chunkid_t,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*fill_copy_bmp)(_ii_info_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*load_bmp)(_ii_info_t *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*save_bmp)(_ii_info_t *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*change_bmp)(_ii_info_t *, unsigned char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*cnt_bits)(_ii_info_t *, nsc_off_t, nsc_size_t *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (*join_bmp)(_ii_info_t *, _ii_info_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} _ii_bmp_ops_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_CO_BMP(ip, a, b, c) (*(ip)->bi_bitmap_ops->co_bmp)(ip, a, b, c)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_CI_BMP(ip, a, b, c) (*(ip)->bi_bitmap_ops->ci_bmp)(ip, a, b, c)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_ZEROBM(ip) (*(ip)->bi_bitmap_ops->zerobm)(ip)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_COPYBM(ip) (*(ip)->bi_bitmap_ops->copybm)(ip)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_ORBM(ip) (*(ip)->bi_bitmap_ops->orbm)(ip)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_TST_SHD_BIT(ip, c) (*(ip)->bi_bitmap_ops->tst_shd_bit)(ip, c)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_SET_SHD_BIT(ip, c) (*(ip)->bi_bitmap_ops->set_shd_bit)(ip, c)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_TST_COPY_BIT(ip, c) (*(ip)->bi_bitmap_ops->tst_copy_bit)(ip, c)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_SET_COPY_BIT(ip, c) (*(ip)->bi_bitmap_ops->set_copy_bit)(ip, c)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_CLR_COPY_BITS(ip, c, n) (*(ip)->bi_bitmap_ops->clr_copy_bits) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ip, c, n)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_CLR_COPY_BIT(ip, c) (*(ip)->bi_bitmap_ops->clr_copy_bits)(ip, c, 1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_NEXT_COPY_BIT(ip, c, m, w, g) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*(ip)->bi_bitmap_ops->next_copy_bit)(ip, c, m, w, g)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_FILL_COPY_BMP(ip) (*(ip)->bi_bitmap_ops->fill_copy_bmp)(ip)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_LOAD_BMP(ip, f) (*(ip)->bi_bitmap_ops->load_bmp)(ip, f)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_SAVE_BMP(ip, f) (*(ip)->bi_bitmap_ops->save_bmp)(ip, f)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_CHANGE_BMP(ip, p) (*(ip)->bi_bitmap_ops->change_bmp)(ip, p)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_CNT_BITS(ip, a, b, c) (*(ip)->bi_bitmap_ops->cnt_bits)(ip, a, b, c)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_JOIN_BMP(dip, sip) (*(ip)->bi_bitmap_ops->join_bmp)(dip, sip)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * State flags
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_IOCTL 0x0001 /* Waiting for ioctl to complete */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_CLOSING 0x0002 /* Waiting for shadow to close */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_MSTTARGET 0x0004 /* Master is target of update */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_MULTIMST 0x0008 /* disabled set is multi master */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_CNTSHDBITS 0x0010 /* need to count # of shd bits set */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_CNTCPYBITS 0x0020 /* need to count # of copy bits set */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DSW file descriptor structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct ii_fd_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _ii_info_t *ii_info; /* Info structure */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ii_bmp; /* This fd is for the bmp device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ii_shd; /* This fd is for the shadow device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ii_ovr; /* This fd is for the overflow device */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte _ii_overflow_t *ii_optr; /* pointer to overflow structure */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ii_oflags; /* raw or cached open type */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} ii_fd_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * II buffer header
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct ii_buf_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_buf_t ii_bufh; /* exported buffer header */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_buf_t *ii_bufp; /* main underlying buffer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_buf_t *ii_bufp2; /* second underlying buffer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_buf_t *ii_abufp; /* anonymous underlying buffer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ii_fd_t *ii_fd; /* back link */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ii_rsrv; /* fd to release in free_buf */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} ii_buf_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL || _KMEMUSER */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Valid magic numbers in the bitmap volume header
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_DIRTY 0x44495254
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_CLEAN 0x434C4541
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DSW_INVALID 0x00000000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * II_HEADER_VERSION
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 1 = original II header version
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 2 = Compact Dependent Shadows (DSW_TREEMAP)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 3 = Persistance of throttle parameters
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 4 = add cluster & group information
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 5 = add time string to hold last modify time
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_HEADER_VERSION 5
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * DSW bitmap volume header structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct ii_header_s {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t ii_magic; /* magic number */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t ii_type; /* bitmap or independent copy */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t ii_state; /* State of the master/shadow/bitmap tuple */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t ii_version; /* version or format of bitmap volume */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t ii_shdfba; /* location of shadow bitmap */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t ii_copyfba; /* location of copy bitmap */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char master_vol[DSW_NAMELEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char shadow_vol[DSW_NAMELEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char bitmap_vol[DSW_NAMELEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* II_HEADER_VERSION 2 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char overflow_vol[DSW_NAMELEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int64_t ii_mstchks; /* # of chunks in master volume */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int64_t ii_shdchks; /* # of chunks in shadow volume */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int64_t ii_shdchkused; /* # of shd chunks allocated or on free list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int64_t ii_shdfchk; /* list of free shadow chunks */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* II_HEADER_VERSION 3 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t ii_throttle_unit; /* Last setting of throttle unit */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t ii_throttle_delay; /* Last setting of throttle delay */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* II_HEADER_VERSION 4 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char clstr_name[DSW_NAMELEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char group_name[DSW_NAMELEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* II_HEADER_VERSION 5 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte time_t ii_mtime;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} ii_header_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_SUCCESS(rc) (((rc) == NSC_DONE) || ((rc) == NSC_HIT))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Overflow volume defines.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_OMAGIC 0x476F6C64 /* "Gold" */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_ISOVERFLOW(n) ((n) < 0 && (n) != II_NULLCHUNK)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_2OVERFLOW(n) (-(n))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* -tive node id's are in overflow volume */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef _SunOS_5_6
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_NULLNODE (INT_MIN)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_NULLCHUNK (INT_MIN)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef II_MULTIMULTI_TERABYTE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_NULLNODE (INT64_MIN)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_NULLCHUNK (INT64_MIN)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_NULL32NODE (INT32_MIN)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_NULL32CHUNK (INT32_MIN)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_NULLNODE (INT32_MIN)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define II_NULLCHUNK (INT32_MIN)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* II_MULTIMULTI_TERABYTE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _DSW_DEV_H */