/*
* 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) 1980 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 "dump.h"
#ifndef LOCK_EX
#endif
/*
* Print a date. A date of 0 is the beginning of time (the "epoch").
* If the 2nd argument is non-zero, it is ok to format the date in
* locale-specific form, otherwise we use ctime. We must use ctime
* for dates such as those in the dumpdates file, which must be
* locale-independent.
*/
char *
prdate(d)
time_t d;
{
char *p;
if (d == 0)
return (gettext("the epoch"));
p = buf;
} else {
/* Wouldn't fit in buf, fall back */
p = ctime(&d);
p[24] = '\0'; /* lose trailing newline */
}
return (p);
}
static int recno;
#ifdef __STDC__
static void readitimes(FILE *);
#else
static void readitimes();
static void recout();
static int getrecord();
static int makeidate();
#endif
void
#ifdef __STDC__
inititimes(void)
#else
#endif
{
int saverr;
if (idates_in)
return;
dumpabort();
/*NOTREACHED*/
}
/*
* No need to secure this, as increm is hard-coded to NINCREM,
* and that file is in /etc. If random people have write-permission
* there, then there are more problems than any degree of paranoia
* on our part can fix.
*/
"Warning - dump record file `%s' does not exist\n"),
increm);
else {
dumpabort();
/*NOTREACHED*/
}
return;
}
increm);
dumpabort();
/*NOTREACHED*/
}
readitimes(df);
}
static void
{
recno = 0;
for (;;) {
break;
}
nidates++;
}
/* LINTED: assigned value is used in inititimes */
idates_in = 1;
}
void
#ifdef __STDC__
getitime(void)
#else
getitime()
#endif
{
int i;
char *fname;
/*
* if an alternate name was specified via the N flag, use it instead
* of the disk name.
*/
else
#ifdef FDEBUG
/* XGETTEXT: #ifdef FDEBUG only */
#endif
lastincno = '0';
inititimes();
if (idatev == 0)
return;
/*
* Go find the entry with the same name for a lower increment
* and older date
*/
continue;
continue;
continue;
}
}
void
#ifdef __STDC__
putitime(void)
#else
putitime()
#endif
{
int i;
char *fname;
if (uflag == 0)
return;
dumpabort();
/*NOTREACHED*/
}
/*
* if an alternate name was specified via the N flag, use it instead
* of the disk name.
*/
else
if (idatev != 0) {
}
idatev = 0;
nidates = 0;
readitimes(df);
dumpabort();
/*NOTREACHED*/
}
/* LINTED: won't dereference idatev if it is NULL (see readitimes) */
continue;
continue;
goto found;
}
/*
* Add one more entry to idatev
*/
nidates++;
}
dumpabort();
/*NOTREACHED*/
}
}
static void
{
/* must use ctime, so we can later use unctime() */
}
static int
{
return (-1);
recno++;
"Malformed entry in dump record file `%s', line %d\n"),
dumpabort();
/*NOTREACHED*/
}
return (-1);
}
#ifdef FDEBUG
msg("getrecord: %s %c %s\n",
#endif
return (0);
}
static int
char *buf;
{
/*
* MAXNAMLEN has different values in dirent.h and ufs_fsdir.h,
* and we need to ensure that the length in DUMPINFMT matches
* what we allow for. Can't just use MAXNAMLEN in the test,
* because there's no convenient way to substitute it into
* DUMPINFMT.
* XXX There's got to be a better way.
*/
/*LINTED [assertion always true]*/
return (-1);
/* LINTED casting from 64-bit to 32-bit time */
return (-1);
return (0);
}
/*
* This is an estimation of the number of tp_bsize blocks in the file.
* It estimates the number of blocks in files with holes by assuming
* that all of the blocks accounted for by di_blocks are data blocks
* (when some of the blocks are usually used for indirect pointers);
* hence the estimate may be high.
*/
void
{
u_offset_t s, t;
/*
* ip->di_size is the size of the file in bytes.
* ip->di_blocks stores the number of sectors actually in the file.
* If there are more sectors than the size would indicate, this just
* means that there are indirect blocks in the file or unused
* sectors in the last file block; we can safely ignore these
* (s = t below).
* If the file is bigger than the number of sectors would indicate,
* then the file has holes in it. In this case we must use the
* block count to estimate the number of data blocks used, but
* we use the actual size for estimating the number of indirect
* dump blocks (t vs. s in the indirect block calculation).
*/
o_esize++;
/* LINTED: spurious complaint about sign-extending 32 to 64 bits */
if (s > t)
s = t;
/* calculate the number of indirect blocks on the dump tape */
/* LINTED: spurious complaint sign-extending 32 to 64 bits */
s += d_howmany(t -
(unsigned)TP_NINDIR);
}
f_esize += s;
}
/*ARGSUSED*/
void
{
o_esize++;
/* LINTED: spurious complaint sign-extending 32 to 64 bits */
}
/*
* Check to see if what we are trying to dump is a fs snapshot
* If so, we can use the snapshot's create time to populate
* the dumpdates file, instead of the time of the dump.
*/
{
char *last;
int snapnum;
return (0);
return (0);
(void) kstat_close(kslib);
return (0);
}
(void) kstat_close(kslib);
return (0);
}
(void) kstat_close(kslib);
return (0);
}
(void) kstat_close(kslib);
/* LINTED casting from long to 32-bit time */
}