SCCS-vsn: sbin/dump/tape.c 5.14
-static char sccsid[] = "@(#)tape.c 5.13 (Berkeley) %G%";
+static char sccsid[] = "@(#)tape.c 5.14 (Berkeley) %G%";
#endif /* not lint */
#include "dump.h"
#endif /* not lint */
#include "dump.h"
#endif RDUMP
int atomic();
#endif RDUMP
int atomic();
-void doslave(), enslave(), flusht(), killall();
+void doslave(), enslave(), flushtape(), killall();
/*
* Concurrent dump mods (Caltech) - disk block reading and tape writing
* are exported to several slave processes. While one slave writes the
* tape, the others read disk blocks; they pass control of the tape in
* a ring via flock(). The parent process traverses the filesystem and
/*
* Concurrent dump mods (Caltech) - disk block reading and tape writing
* are exported to several slave processes. While one slave writes the
* tape, the others read disk blocks; they pass control of the tape in
* a ring via flock(). The parent process traverses the filesystem and
- * sends spclrec()'s and lists of daddr's to the slaves via pipes.
+ * sends writeheader()'s and lists of daddr's to the slaves via pipes.
*/
struct req { /* instruction packets sent to slaves */
daddr_t dblk;
*/
struct req { /* instruction packets sent to slaves */
daddr_t dblk;
tenths = writesize/density + (cartridge ? 16 : density == 625 ? 5 : 8);
/*
* Allocate tape buffer contiguous with the array of instruction
tenths = writesize/density + (cartridge ? 16 : density == 625 ? 5 : 8);
/*
* Allocate tape buffer contiguous with the array of instruction
- * packets, so flusht() can write them together with one write().
+ * packets, so flushtape() can write them together with one write().
* Align tape buffer on page boundary to speed up tape write().
*/
req = (struct req *)malloc(reqsiz + writesize + pgoff);
* Align tape buffer on page boundary to speed up tape write().
*/
req = (struct req *)malloc(reqsiz + writesize + pgoff);
char *dp;
{
req[trecno].dblk = (daddr_t)0;
char *dp;
{
req[trecno].dblk = (daddr_t)0;
trecno++;
spcl.c_tapea++;
if (trecno >= ntrec)
trecno++;
spcl.c_tapea++;
if (trecno >= ntrec)
daddr_t blkno;
int size;
{
daddr_t blkno;
int size;
{
trecno += avail;
spcl.c_tapea += avail;
if (trecno >= ntrec)
trecno += avail;
spcl.c_tapea += avail;
if (trecno >= ntrec)
dblkno += avail << (tp_bshift - dev_bshift);
tpblks -= avail;
}
dblkno += avail << (tp_bshift - dev_bshift);
tpblks -= avail;
}
-#ifdef RDUMP
-/*
- * compatibility routine
- */
-tflush(i)
- int i;
-{
-
- for (i = 0; i < ntrec; i++)
- spclrec();
-}
-#endif RDUMP
-
-void
-flusht()
{
int siz = (char *)tblock - (char *)req;
{
int siz = (char *)tblock - (char *)req;
if (!pipeout && (blocksperfile ?
(blockswritten >= blocksperfile) : (asize > tsize))) {
close_rewind();
if (!pipeout && (blocksperfile ?
(blockswritten >= blocksperfile) : (asize > tsize))) {
close_rewind();
while ((f = open(tape, 0)) < 0)
sleep (10);
close(f);
while ((f = open(tape, 0)) < 0)
sleep (10);
close(f);
{
int parentpid;
int childpid;
{
int parentpid;
int childpid;
tapeno+1, parentpid, getpid());
#endif TDEBUG
#ifdef RDUMP
tapeno+1, parentpid, getpid());
#endif TDEBUG
#ifdef RDUMP
- while ((to = (host ? rmtopen(tape, 2) :
- pipeout ? 1 : creat(tape, 0666))) < 0)
+ while ((tapefd = (host ? rmtopen(tape, 2) :
+ pipeout ? 1 : open(tape, O_WRONLY|O_CREAT, 0666))) < 0)
- while ((to = pipeout ? 1 : creat(tape, 0666)) < 0)
+ while ((tapefd =
+ pipeout ? 1 : open(tape, O_WRONLY|O_CREAT, 0666)) < 0)
#endif RDUMP
{
msg("Cannot open output \"%s\".\n", tape);
#endif RDUMP
{
msg("Cannot open output \"%s\".\n", tape);
spcl.c_volume++;
spcl.c_type = TS_TAPE;
spcl.c_flags |= DR_NEWHEADER;
spcl.c_volume++;
spcl.c_type = TS_TAPE;
spcl.c_flags |= DR_NEWHEADER;
spcl.c_flags &=~ DR_NEWHEADER;
if (tapeno > 1)
spcl.c_flags &=~ DR_NEWHEADER;
if (tapeno > 1)
- msg("Tape %d begins with blocks from ino %d\n",
- tapeno, ino);
+ msg("Tape %d begins with blocks from inode %d\n",
+ tapeno, curino);
{
register int nread, toggle = 0;
{
register int nread, toggle = 0;
- close(fi);
- if ((fi = open(disk, 0)) < 0) /* Need our own seek pointer */
+ /*
+ * Need our own seek pointer.
+ */
+ close(diskfd);
+ if ((diskfd = open(disk, O_RDONLY)) < 0)
quit("slave couldn't reopen disk: %s\n", strerror(errno));
/*
* Get list of blocks to dump, read the blocks into tape buffer
quit("slave couldn't reopen disk: %s\n", strerror(errno));
/*
* Get list of blocks to dump, read the blocks into tape buffer
#ifdef RDUMP
if ((host ? rmtwrite(tblock[0], writesize)
#ifdef RDUMP
if ((host ? rmtwrite(tblock[0], writesize)
- : write(to, tblock[0], writesize)) != writesize) {
+ : write(tapefd, tblock[0], writesize)) != writesize) {
- if (write(to, tblock[0], writesize) != writesize) {
+ if (write(tapefd, tblock[0], writesize) != writesize) {
#endif RDUMP
kill(master, SIGUSR1);
for (;;)
#endif RDUMP
kill(master, SIGUSR1);
for (;;)