/*
* Copyright 1996, 1998, 2002-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <locale.h>
#include <stdlib.h>
#include <byteorder.h>
struct byteorder_ctx *
byteorder_create(void)
{
/* LINTED: assignment value is used */
return (NULL);
return (rc);
}
void
{
}
void
{
return;
}
/*
* Control string (cp) is a sequence of optional numeric repeat counts
* and format specifiers. s/w/h indicate a 16-bit quantity is to be
* byte-swapped, l indicates a 32-bit quantity. A repeat count is
* identical in effect to having the following format character appear
* N times (e.g., "3h" is equivalent to "hhh").
*
* The byte-swapping is performed in-place, in the buffer sp.
*/
void
{
int n = 0;
uchar_t c;
while (*cp) {
switch (*cp) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
continue;
case 's': case 'w': case 'h':
/* LINTED: type punning ok here */
sp++;
break;
case 'l':
sp += 3;
}
/* Any other character, like 'b' counts as byte. */
sp++;
if (n <= 1) {
n = 0; cp++;
} else
n--;
}
}
{
uint32_t l = x;
/* LINTED: type punning ok here */
return (l);
}
static int
{
uint_t i, j;
if (! ctx->initialized)
return (-1);
/*
* We should only be called on to checksum u_spcl's, so make
* sure that's what we got.
*/
return (-1);
j = tp_bsize / sizeof (int);
i = 0;
do
i += (uint_t)*b++;
while (--j);
} else {
/*
* What happens if we want to read restore tapes
* for a 16bit int machine???
*/
do
i += swabl(*b++);
while (--j);
}
return (i != CHECKSUM);
}
/*
* swapping if necessary, and checks the checksum. it does NOT convert
* from the old filesystem format; gethead() in tape.c does that.
*
* ctx is the context for this package
* sp is a pointer to a current-format spclrec, that may need to be
* byteswapped.
* cs is a pointer to the thing we want to checksum. if we're
* converting from the old filesystem format, it might be different
* from sp.
* css is the size of the thing we want to checksum.
* magic is the magic number we compare against.
*/
int
{
return (-1);
}
return (-1);
/*
* Unless our caller is actively trying to break us, a
* successful checksum() means that *sp is at least as
* big as what we think it should be as far as byte
* swapping goes. Therefore, we don't need to do any
* more size checks here.
*/
/* handle byte swapping */
/*
* byteswap
* c_type, c_date, c_ddate, c_volume, c_tapea, c_inumber,
* c_magic, c_checksum,
* all of c_dinode, and c_count.
*/
/*
* byteswap
* c_flags, c_firstrec, and c_spare.
*/
/* byteswap the inodes if necessary. */
#ifndef lint /* lint won't shut up about sprintf below */
/* Can't overflow, max len is %d format (20)+`l'+\0 */
/* LINTED lint can't tell diff between %ld and %dl */
}
#endif /* lint */
/* if no metadata, byteswap the level */
}
/* handle quad swapping (note -- we no longer perform this check */
/* we now do quad swapping iff we're doing byte swapping.) */
/*
* the following code is being changed during the large file
* project. This code needed to be changed because ic_size
* is no longer a quad, it has been changed to ic_lsize, which is
* an offset_t, and the field "val" doesn't exist anymore.
*/
/*
* This is the old code. (before large file project.)
*
* sv = sp->c_dinode.di_ic.ic_size.val;
*
* if (ctx->Bcvt) {
* long foo;
*
* foo = sv[1];
* sv[1] = sv[0];
* sv[0] = foo;
* }
*/
/* swap the upper 32 bits of ic_lsize with the lower 32 bits */
}
return (-1);
return (0);
}
void
struct byteorder_ctx *ctx;
struct direct *d;
{
}
void
{
static int complained = 0;
int i;
return;
for (i = 0; i < n; i++) {
/* LINTED explicitly checking for truncation below */
/*
* The problem is that acl_who is a uid_t,
* and we know that the on-tape version is
* definitely 32 bits. To avoid getting
* than that, we need to do the explicit
* conversion and check.
*/
"Some ACL uids have been truncated\n");
complained = 1;
}
}
}