#ifndef lint
static const char rcsid[] =
- "$Id: tape.c,v 1.61 2002/01/25 14:59:53 stelian Exp $";
+ "$Id: tape.c,v 1.66 2002/03/27 16:48:38 stelian Exp $";
#endif /* not lint */
#include <config.h>
#include <sys/wait.h>
#include <sys/mtio.h>
#ifdef __linux__
-#include <linux/fs.h>
-#undef atomic_read /* this get wrongly defined in kernel */
- /* headers and we don't want it */
#ifdef HAVE_EXT2FS_EXT2_FS_H
#include <ext2fs/ext2_fs.h>
#else
void
rollforward(void)
{
- register struct req *p, *q = NULL, *prev;
- register struct slave *tslp;
+ struct req *p, *q = NULL, *prev;
+ struct slave *tslp;
int i, size, savedtapea, got;
union u_spcl *ntb, *otb;
struct slave_results returned;
OPEN(tape, O_RDWR|O_CREAT, 0666))) < 0)
#endif
{
- msg("Cannot open output \"%s\".\n", tape);
+ msg("Cannot open output \"%s\": %s\n", tape,
+ strerror(errno));
if (!query("Do you want to retry the open?"))
dumpabort(0);
}
#ifdef LINUX_FORK_BUG
int i, j;
#else
- register int i, j;
+ int i, j;
#endif
master = getpid();
void
killall(void)
{
- register int i;
+ int i;
for (i = 0; i < SLAVES; i++)
if (slaves[i].pid > 0) {
static void
doslave(int cmd, int slave_number, int first)
{
- register int nread;
+ int nread;
int nextslave, size, eot_count, bufsize;
volatile int wrote = 0;
char *buffer;
* Get list of blocks to dump, read the blocks into tape buffer
*/
while ((nread = atomic_read( cmd, (char *)slp->req, reqsiz)) == reqsiz) {
- register struct req *p = slp->req;
+ struct req *p = slp->req;
for (trecno = 0; trecno < ntrec;
trecno += p->count, p += p->count) {
#ifdef USE_QFA
if (gTapeposfd >= 0) {
int i;
+ int firstpass = 1;
for (i = 0; i < ntrec; ++i) {
uspclptr = (union u_spcl *)&slp->tblock[i];
spclptr = &uspclptr->s_spcl;
if ((spclptr->c_magic == NFS_MAGIC) &&
(spclptr->c_type == TS_INODE) &&
+ ((spclptr->c_dinode.di_mode & S_IFMT) != IFDIR) &&
(spclptr->c_date == gThisDumpDate)) {
/* if an error occured previously don't
* try again */
- if (gtperr == 0) {
- if ((gtperr = GetTapePos(&curtapepos)) == 0)
- MkTapeString(spclptr, curtapepos);
+ if (firstpass) {
+ firstpass = 0;
+ if (gtperr == 0)
+ gtperr = GetTapePos(&curtapepos);
}
+ if (gtperr == 0)
+ MkTapeString(spclptr, curtapepos);
}
}
}