/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 (c) 1994, by Sun Microsytems, Inc.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "libtnf.h"
/*
* Unoptimized versions, always dereference a cell through _GET_INT32()
*
*/
/*
* Return target cell referred to via src_val from src_cell, after
* checking that target is valid (block was not reused). Return NULL
* otherwise.
*
* NOTE: We must check if the destination is within the valid_bytes
* range of its block, so as to correctly handle tnfxtract'ed files:
* the block containing the target cell may have been copied out
* before the block containing the source cell.
*/
static tnf_ref32_t *
{
char *base;
/* Generation of source cell */
/* LINTED pointer cast */
/* Physical file offset of source cell */
/* Expected (unadjusted) file offset of destination cell */
/* Generation delta */
/* sign bit was a 1 - so restore sign */
}
/* Expected destination generation */
/* Physical file offset of destination cell */
/* Destination cell */
/* LINTED pointer cast */
/* Destination block */
/* LINTED pointer cast */
/* Generation of destination cell */
/* LINTED pointer cast */
/* Bytes valid in destination block */
/* LINTED pointer cast */
return (dst_cell);
return ((tnf_ref32_t *)NULL);
}
/*
* Return the target referent of a cell, chasing forwarding references.
* Return TNF_NULL if cell is a TNF_NULL forwarding reference.
*/
{
if (TNF_REF32_IS_NULL(ref32))
return (TNF_NULL);
if (TNF_REF32_IS_RSVD(ref32)) {
return (TNF_NULL);
}
if (TNF_REF32_IS_PAIR(ref32)) {
/* We chase the high (tag) half */
if (TNF_TAG16_IS_ABS(tag16)) {
cell = (tnf_ref32_t *)
((char *)tnf->file_start
/* LINTED pointer cast may result in improper alignment */
+ TNF_TAG16_ABS16(tag16));
} else if (TNF_TAG16_IS_REL(tag16)) {
return (TNF_NULL);
} else {
return (TNF_NULL);
}
} else if (TNF_REF32_IS_PERMANENT(ref32)) {
/* permanent space pointer */
/* LINTED pointer cast may result in improper alignment */
return (TNF_NULL);
}
/* chase intermediate forwarding references */
if (TNF_REF32_IS_PERMANENT(ref32)) {
/* LINTED pointer cast may result in improper alignment */
reftemp);
} else {
return (TNF_NULL);
}
}
return (cell);
}
/*
* Return the target referent of ref16 contained in cell.
* Return TNF_NULL if cell doesn't have a ref16.
*/
{
if (TNF_REF32_IS_PAIR(ref32)) {
/* No ref16 was stored */
return (TNF_NULL);
else {
return (TNF_NULL);
}
} else /* not a pair pointer */
return (TNF_NULL);
/* chase intermediate forwarding references */
if (TNF_REF32_IS_PERMANENT(ref32)) {
/* LINTED pointer cast may result in improper alignment */
reftemp);
} else {
return (TNF_NULL);
}
}
return (cell);
}