/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include "dsw.h"
#include "dsw_dev.h"
#ifdef DS_DDICT
#include "../contract.h"
#endif
/*
* Instant Image.
*
* This file contains the chunk map lookup functions of II.
*
*/
extern int ii_debug; /* debug level switch */
int ii_map_debug = 0;
#ifdef II_MULTIMULTI_TERABYTE
#else
#endif
typedef struct ii_node {
} NODE;
typedef struct ii_nodelink_s {
void _ii_rlse_devs(_ii_info_t *, int);
int _ii_rsrv_devs(_ii_info_t *, int, int);
void _ii_error(_ii_info_t *, int);
/*
* Private functions for use in this file.
*/
unsigned char *, nsc_size_t);
static int
{
/* bitmap is probably offline */
return (1);
}
return (0);
}
static int
{
sizeof (_ii_doverflow_t));
return (0);
}
static int
{
int rc;
int node_fba;
int offset;
/*
* Don't use _ii_nsc_io() as _ii_nsc_io() requires io to start at
* an fba boundary.
*/
/* calculate location of node on bitmap file */
/* read disk block containing node */
if (!II_SUCCESS(rc)) {
if (tmp)
(void) nsc_free_buf(tmp);
return (1);
}
/* copy node and update bitmap file if needed */
rc = 0;
else {
if (!II_SUCCESS(rc)) {
}
}
if (tmp)
(void) nsc_free_buf(tmp);
return (0);
}
static int
{
int rc;
/* Determine maximum number of FBAs to allocate */
if (!II_SUCCESS(rc))
/* Write out blocks of initialied NODEs */
while (fbas > 0) {
/* Determine number of FBA to allocate this time */
/* Allocate buffer which map to FBAs containing NODEs */
if (!II_SUCCESS(rc)) {
return (EIO);
}
/* traverse vector list, filling wth initialized NODEs */
pnode++;
}
}
/* write FBAs containing initialized NODEs */
if (!II_SUCCESS(rc)) {
(void) nsc_free_buf(bp);
return (EIO);
}
/* free the buffer */
(void) nsc_free_buf(bp);
/* Adjust nsc buffer values */
}
return (0);
}
/*
* Reads the node into core and returns a pointer to it.
*/
static NODE *
{
}
return (new);
}
static chunkid_t
{
int fba;
} else {
/* into overflow */
}
(void) update_tree_header(ip);
return (rc);
}
/*
* releases memory for node
*/
static void /*ARGSUSED*/
{
}
static void
{
}
static void
{
int fba;
return;
}
/* link chunk onto overflow free list */
} else {
/* write old free list head into chunk */
/* update free counts */
/* ip->bi_unused++; */
}
(void) update_tree_header(ip);
}
/*
* Public functions for dsw_dev to use.
*/
/*
* Overflow volume functions.
*/
/* put overflow chunk on the overflow volume free list */
void
{
int fba;
if (!II_ISOVERFLOW(chunk)) {
return;
}
#ifdef DEBUG
(void *) ip);
#endif
return;
}
/* write old free list head into chunk */
/* update free counts */
/* write chunk id into header freelist start */
}
/* reclaim any overflow storage used by the volume */
void
{
return;
}
/*
* Determine whether overflow should be reclaimed:
* 1/ If we're not doing a group volume update
* OR
* 2/ If the number of detaches != number of attached vols
*/
#ifndef II_MULTIMULTI_TERABYTE
/* assert volume size fits into node_id */
#endif
return;
}
}
} else {
/* need to reset the overflow volume header */
}
}
}
static chunkid_t
{
int fba;
return (II_NULLCHUNK); /* no overflow volume attached */
}
return (II_NULLCHUNK);
}
/* pick first from free list */
/* decrease unused count, fix bug 4419956 */
} else {
/* otherwise pick first unused */
else {
}
}
if (chunk != II_NULLCHUNK) {
}
}
return (chunk);
}
/*
* Find or insert key into search tree.
*/
/* Address of the root of the tree */
{
chunkid_t n; /* New node id if key not found */
return (II_NULLNODE);
}
if (n != II_NULLCHUNK) { /* chunk allocated, return location */
return (n);
}
n = alloc_chunk(ip);
if (n != II_NULLCHUNK) {
} else
return (n);
}
/* Delete node with key chunkid */
void
{
return;
}
}
/*
* initialise an empty map for ip
*/
int
{
int rc = 0;
/* overflow can't be attached before first call to this function */
if (ip->bi_overflow)
ip->bi_shdchkused = 0;
/* fill index (bi_mstchks size) with II_NULLCHUNK */
if (rc == 0)
return (rc);
}
/*
* Calculate the size of map space provided by a bitmap volume with
* tree_len fba's spare for the tree.
*/
{
if (ii_debug > 1)
"!ii_btsize: bitmap with %" NSC_SZFMT
return (nchunks);
}