/*
* 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) 1991,1996,1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "dump.h"
#include <math.h>
#include <limits.h>
/*
* Uncomment if using mmap'ing of files for pre-fetch.
* #define ENABLE_MMAP 1
*/
struct inodesc {
};
#ifdef ENABLE_MMAP /* XXX part of mmap support */
/*
* If an mmap'ed file is truncated as it is being dumped or
* faulted in, we are delivered a SIGBUS.
*/
static void (*savebus)();
static int incopy;
#ifdef __STDC__
static void onsigbus(int);
#else
static void onsigbus();
#endif
#endif /* ENABLE_MMAP */
#ifdef DEBUG
extern int xflag;
#endif
#ifdef ENABLE_MMAP /* XXX part of mmap support */
static void
int sig;
{
if (!incopy) {
dumpabort();
/*NOTREACHED*/
}
incopy = 0;
/*NOTREACHED*/
}
#endif /* ENABLE_MMAP */
void
#ifdef __STDC__
allocino(void)
#else
allocino()
#endif
{
dumpabort();
/*NOTREACHED*/
}
/* LINTED maxino guaranteed to fit into a size_t by above test */
if (freeinodesc == (struct inodesc *)0) {
dumpabort();
/*NOTREACHED*/
}
ialloc =
ialloc[0] = freeinodesc;
nchunks = 1;
}
void
#ifdef __STDC__
freeino(void)
#else
freeino()
#endif
{
int i;
return;
for (i = 0; i < nchunks; i++)
if (ialloc[i] != 0)
}
void
{
}
char *
char *cp;
{
char *dp;
extern char *getfullblkname();
if (dp == 0)
return (0);
if (*dp == '\0') {
return (0);
}
return (dp);
}
/*
* Determine if specified device is mounted at
* specified mount point. Returns 1 if mounted,
* 0 if not mounted, -1 on error.
*/
int
char *devname; /* name of device (raw or block) */
char *dirname; /* name of f/s mount point */
{
int saverr;
return (-1);
}
return (-1);
}
return (-1);
}
return (1);
return (0);
}
#ifdef ENABLE_MMAP /* XXX mapped-file support */
/*
* Map a file prior to dumping and start faulting in its
* pages. Stop if we catch a signal indicating our turn
* to dump has arrived. If the file is truncated out from
* under us, immediately return.
* NB: the base of the mapped data may not coincide
* exactly to the requested offset, due to alignment
* constraints.
*/
int fd;
int fetch; /* start faulting in pages */
{
/*LINTED [c used during pre-fetch faulting]*/
volatile char c, *p;
extern int caught; /* pre-fetch until set */
int saverr;
if (bytes == 0)
return ((caddr_t)0);
/*
* mmap the file for reading
*/
/* LINTED: "bytes" will always fit into a size_t */
if (mapsize > MAXMAPSIZE)
/*
* Due to address space limitations, we
* may not be able to map as much as we want.
*/
}
/* XXX why not call dumpailing() here? */
"Do you want to attempt to continue? (\"yes\" or \"no\") "))) {
dumpabort();
/*NOTREACHED*/
}
return ((caddr_t)0);
}
if (!fetch)
return (mapstart);
if (setjmp(truncate_buf) == 0) {
/*
* Touch each page to pre-fetch by faulting. At least
* one of c or *p must be declared volatile, lest the
* optimizer eliminate the assignment in the loop.
*/
incopy = 1;
/* LINTED: c is used for its side-effects */
c = *p;
}
incopy = 0;
}
#ifdef DEBUG
else
/* XGETTEXT: #ifdef DEBUG only */
"FILE TRUNCATED (fault): Interrupting pre-fetch\n"));
#endif
return (mapstart);
}
void
#ifdef __STDC__
unmapfile(void)
#else
#endif
{
if (mapbase) {
/* XXX we're unmapping it, so what does this gain us? */
}
}
#endif /* ENABLE_MMAP */
void
#ifdef __STDC__
activepass(void)
#else
#endif
{
if (pipeout) {
dumpabort();
/*NOTREACHED*/
}
if (active > 1)
"%d files were active and will be re-dumped\n"), active);
else
"1 file was active and will be re-dumped\n"));
doingactive++;
active = 0;
reset(); /* reset tape params */
/*
* If archiving, create a new
* archive file.
*/
if (archivefile) {
old = archivefile;
/* The two is for the trailing \0 and rounding up log10() */
/* Always fits */
}
if (tapeout) {
/*
* A "rewind" tape device. When we do
* the close, we will lose our position.
* Be nice and switch volumes.
*/
"Warning - cannot dump active files to rewind device `%s'\n"),
tape);
close_rewind();
changevol();
} else {
trewind();
doposition = 0;
filenum++;
}
} else {
/*
* Not a tape. Do a volume switch.
* This will advance to the next file
* if using a sequence of files, next
* diskette if using diskettes, or
* let the user move the old file out
* of the way.
*/
close_rewind();
changevol(); /* switch files */
}
passno++;
}