X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=dump%2Ftape.c;h=1464812010f5f3f74ebe043796651115d05ed69c;hb=95c74f382492999827000f544fcb6844150cda81;hp=74bbcbd8d20b63185d25f813befc19b57036a648;hpb=2c99ad2dc97978b437794b14d58d9ae698ecabb9;p=dump.git diff --git a/dump/tape.c b/dump/tape.c index 74bbcbd..1464812 100644 --- a/dump/tape.c +++ b/dump/tape.c @@ -41,10 +41,11 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.43 2001/04/12 16:03:29 stelian Exp $"; + "$Id: tape.c,v 1.45 2001/04/27 15:22:47 stelian Exp $"; #endif /* not lint */ #include +#include #include #include #include @@ -547,7 +548,7 @@ trewind(void) #endif { (void) close(tapefd); - while ((f = open(tape, 0)) < 0) + while ((f = OPEN(tape, 0)) < 0) sleep (10); (void) close(f); } @@ -861,10 +862,10 @@ restore_check_point: #ifdef RDUMP while ((tapefd = (host ? rmtopen(tape, 2) : pipeout ? fileno(stdout) : - open(tape, O_WRONLY|O_CREAT, 0666))) < 0) + OPEN(tape, O_WRONLY|O_CREAT, 0666))) < 0) #else while ((tapefd = (pipeout ? fileno(stdout) : - open(tape, O_RDWR|O_CREAT, 0666))) < 0) + OPEN(tape, O_RDWR|O_CREAT, 0666))) < 0) #endif { msg("Cannot open output \"%s\".\n", tape); @@ -1056,13 +1057,13 @@ doslave(int cmd, int slave_number) long curtapepos; union u_spcl *uspclptr; struct s_spcl *spclptr; -#endif /* USA_QFA */ +#endif /* USE_QFA */ /* * Need our own seek pointer. */ (void) close(diskfd); - if ((diskfd = open(disk, O_RDONLY)) < 0) + if ((diskfd = OPEN(disk, O_RDONLY)) < 0) quit("slave couldn't reopen disk: %s\n", strerror(errno)); #ifdef __linux__ ext2fs_close(fs); @@ -1108,29 +1109,6 @@ doslave(int cmd, int slave_number) } } -#ifdef USE_QFA - if (gTapeposfd >= 0) { - uspclptr = (union u_spcl *)&slp->tblock[0]; - spclptr = &uspclptr->s_spcl; - if ((spclptr->c_magic == NFS_MAGIC) && - (spclptr->c_type == TS_INODE)) { - /* if an error occured previously don't - * try again */ - if (gtperr == 0) { - if ((gtperr = GetTapePos(&curtapepos)) == 0) { -#ifdef DEBUG_QFA - msg("inode %ld at tapepos %ld\n", spclptr->c_inumber, curtapepos); -#endif - sprintf(gTps, "%ld\t%d\t%ld\n", (unsigned long)spclptr->c_inumber, tapeno, curtapepos); - if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps)) { - quit("error writing tapepos file.\n"); - } - } - } - } - } -#endif /* USE_QFA */ - /* Try to write the data... */ wrote = 0; eot_count = 0; @@ -1187,6 +1165,29 @@ doslave(int cmd, int slave_number) ready = 0; caught = 0; +#ifdef USE_QFA + if (gTapeposfd >= 0) { + uspclptr = (union u_spcl *)&slp->tblock[0]; + spclptr = &uspclptr->s_spcl; + if ((spclptr->c_magic == NFS_MAGIC) && + (spclptr->c_type == TS_INODE)) { + /* if an error occured previously don't + * try again */ + if (gtperr == 0) { + if ((gtperr = GetTapePos(&curtapepos)) == 0) { +#ifdef DEBUG_QFA + msg("inode %ld at tapepos %ld\n", spclptr->c_inumber, curtapepos); +#endif + sprintf(gTps, "%ld\t%d\t%ld\n", (unsigned long)spclptr->c_inumber, tapeno, curtapepos); + if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps)) { + warn("error writing tapepos file.\n"); + } + } + } + } + } +#endif /* USE_QFA */ + while (eot_count < 10 && size < bufsize) { #ifdef RDUMP if (host)