-$Id: CHANGES,v 1.185 2002/07/17 10:18:52 stelian Exp $
+$Id: CHANGES,v 1.186 2002/07/19 14:57:38 stelian Exp $
Changes between versions 0.4b29 and 0.4b30 (released ????????????????)
======================================================================
transparently support both inode formats, the change should
have no side effects. Thanks to John Yu <jky@cs.bu.edu> for
reporting the bug.
-
+
+6. Fixed a lot of warnings in the code shown when compiling
+ with 'gcc -W'. Thanks to Matthias Andree
+ <matthias.andree@stud.uni-dortmund.de> for reporting this.
+
Changes between versions 0.4b28 and 0.4b29 (released June 8, 2002)
==================================================================
-$Id: THANKS,v 1.62 2002/07/01 11:54:39 stelian Exp $
+$Id: THANKS,v 1.63 2002/07/19 14:57:39 stelian Exp $
Dump and restore were written by the people of the CSRG at the University
of California, Berkeley.
Thanks to people who reported problems with the port, sent patches, and
suggested various improvements.
Here is a partial list of them (if I have forgotten someone, please complain):
-Eros Albertazzi eros@lamel.bo.cnr.it
John Adams johna@onevista.com
+Eros Albertazzi eros@lamel.bo.cnr.it
+Matthias Andree matthias.andree@stud.uni-dortmund.de
Andrea Arcangeli andrea@suse.de
Stephen Atwell satwell@urbana.css.mot.com
Gerd Bavendiek bav@epost.de
#ifndef lint
static const char rcsid[] =
- "$Id: dumprmt.c,v 1.21 2002/05/21 15:48:46 stelian Exp $";
+ "$Id: dumprmt.c,v 1.22 2002/07/19 14:57:39 stelian Exp $";
#endif /* not lint */
#include <config.h>
}
static void
-rmtconnaborted(int signo)
+rmtconnaborted(UNUSED(int signo))
{
msg("Lost connection to remote host.\n");
if (errfd != -1) {
if (rmtstate != TS_OPEN)
return (NULL);
rmtcall("status", "S\n");
- for (i = 0, cp = (char *)&mts; i < sizeof(mts); i++)
+ for (i = 0, cp = (char *)&mts; i < (int)sizeof(mts); i++)
*cp++ = rmtgetb();
return (&mts);
}
rmtcall(const char *cmd, const char *buf)
{
- if (write(tormtape, buf, strlen(buf)) != strlen(buf))
+ if (write(tormtape, buf, strlen(buf)) != (ssize_t)strlen(buf))
rmtconnaborted(0);
return (rmtreply(cmd));
}
* Stelian Pop <stelian@popies.net>, 1999-2000
* Stelian Pop <stelian@popies.net> - AlcĂ´ve <www.alcove.com>, 2000-2002
*
- * $Id: bsdcompat.h,v 1.18 2002/07/17 10:18:52 stelian Exp $
+ * $Id: bsdcompat.h,v 1.19 2002/07/19 14:57:39 stelian Exp $
*/
#include <config.h>
#include <dirent.h>
#define __dead volatile
+#define UNUSED(x) x __attribute__ ((unused))
#ifndef NBBY
#define NBBY 8
#ifndef lint
static const char rcsid[] =
- "$Id: main.c,v 1.73 2002/07/17 10:18:52 stelian Exp $";
+ "$Id: main.c,v 1.74 2002/07/19 14:57:39 stelian Exp $";
#endif /* not lint */
#include <config.h>
/* print QFA-file header */
snprintf(gTps, sizeof(gTps), "%s\n%s\n%ld\n\n", QFA_MAGIC, QFA_VERSION, (unsigned long)spcl.c_date);
gTps[sizeof(gTps) - 1] = '\0';
- if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps))
+ if (write(gTapeposfd, gTps, strlen(gTps)) != (ssize_t)strlen(gTps))
quit("can't write tapeposfile\n");
sprintf(gTps, "ino\ttapeno\ttapepos\n");
- if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps))
+ if (write(gTapeposfd, gTps, strlen(gTps)) != (ssize_t)strlen(gTps))
quit("can't write tapeposfile\n");
}
#endif /* USE_QFA */
#ifndef lint
static const char rcsid[] =
- "$Id: optr.c,v 1.31 2002/02/04 11:18:45 stelian Exp $";
+ "$Id: optr.c,v 1.32 2002/07/19 14:57:39 stelian Exp $";
#endif /* not lint */
#include <config.h>
* sleep for 2 minutes in case nobody comes to satisfy dump
*/
static void
-alarmcatch(int signo)
+alarmcatch(UNUSED(int signo))
{
int save_errno = errno;
if (notify == 0) {
* Here if an inquisitive operator interrupts the dump program
*/
void
-interrupt(int signo)
+interrupt(UNUSED(int signo))
{
msg("Interrupt received.\n");
if (query("Do you want to abort dump?"))
#ifndef lint
static const char rcsid[] =
- "$Id: tape.c,v 1.69 2002/07/01 11:54:40 stelian Exp $";
+ "$Id: tape.c,v 1.70 2002/07/19 14:57:39 stelian Exp $";
#endif /* not lint */
#include <config.h>
static ssize_t dump_atomic_read __P((int, void *, size_t));
static ssize_t dump_atomic_write __P((int, const void *, size_t));
+#ifdef WRITEDEBUG
static void doslave __P((int, int, int));
+#else
+static void doslave __P((int, int));
+#endif
static void enslave __P((void));
static void flushtape __P((void));
static void killall __P((void));
}
static void
-sigpipe(int signo)
+sigpipe(UNUSED(int signo))
{
quit("Broken pipe\n");
if (tapeno > 1)
msg("Volume %d begins with blocks from inode %d\n",
tapeno, slp->inode);
- if (tapeno < TP_NINOS)
+ if (tapeno < (int)TP_NINOS)
volinfo[tapeno] = slp->inode;
}
}
void
-dumpabort(int signo)
+dumpabort(UNUSED(int signo))
{
if (master != 0 && master != getpid())
* proceed - handler for SIGUSR2, used to synchronize IO between the slaves.
*/
static void
-proceed(int signo)
+proceed(UNUSED(int signo))
{
if (ready)
siglongjmp(jmpbuf, 1);
!= sizeof i)
quit("master/slave protocol botched 3\n");
#endif
- doslave(cmd[0], i, (slaves[i].pid == slp->pid));
+ doslave(cmd[0],
+#ifdef WRITEDEBUG
+ i,
+#endif
+ (slaves[i].pid == slp->pid));
Exit(X_FINOK);
}
else
* slaves.
*/
static void
-doslave(int cmd, int slave_number, int first)
+doslave(int cmd,
+#ifdef WRITEDEBUG
+ int slave_number,
+#endif
+ int first)
{
int nread;
- int nextslave, size, eot_count, bufsize;
- volatile int wrote = 0;
- char *buffer;
+ int nextslave;
+ volatile int wrote = 0, size, eot_count, bufsize;
+ char * volatile buffer;
#if defined(HAVE_ZLIB) || defined(HAVE_BZLIB)
- struct tapebuf *comp_buf = NULL;
- int compresult, do_compress = !first;
+ struct tapebuf * volatile comp_buf = NULL;
+ int compresult;
+ volatile int do_compress = !first;
unsigned long worklen;
#ifdef HAVE_BZLIB
unsigned int worklen2;
}
#endif /* HAVE_BZLIB */
- if (compresult && worklen <= (writesize - 16)) {
+ if (compresult && worklen <= ((unsigned long)writesize - 16)) {
/* write the compressed buffer */
comp_buf->length = worklen;
comp_buf->compressed = 1;
while ((got = read(fd, buf, need)) > 0 && (need -= got) > 0)
(char *)buf += got;
} while (got == -1 && errno == EINTR);
- return (got < 0 ? got : count - need);
+ return (got < 0 ? got : (ssize_t)count - need);
}
/*
while ((got = write(fd, buf, need)) > 0 && (need -= got) > 0)
(char *)buf += got;
} while (got == -1 && errno == EINTR);
- return (got < 0 ? got : count - need);
+ return (got < 0 ? got : (ssize_t)count - need);
}
tapeno,
curtapepos);
gTps[sizeof(gTps) - 1] = '\0';
- if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps)) {
+ if (write(gTapeposfd, gTps, strlen(gTps)) != (ssize_t)strlen(gTps)) {
warn("error writing tapepos file.\n");
}
}
#ifndef lint
static const char rcsid[] =
- "$Id: traverse.c,v 1.48 2002/07/17 10:18:52 stelian Exp $";
+ "$Id: traverse.c,v 1.49 2002/07/19 14:57:39 stelian Exp $";
#endif /* not lint */
#include <config.h>
#include <ctype.h>
#include <stdio.h>
+#include <sys/types.h>
#ifdef __STDC__
#include <string.h>
#include <unistd.h>
#ifdef HAVE_EXT2_JOURNAL_INUM
#define ext2_journal_ino(sb) (sb->s_journal_inum)
#else
-#define ext2_journal_ino(sb) (*((__u32 *)sb + 0x38))
+#define ext2_journal_ino(sb) (*((u_int32_t *)sb + 0x38))
#endif
#ifndef HAVE_EXT2_INO_T
typedef ino_t ext2_ino_t;
if (blkest > sizeest)
blkest = sizeest;
#ifdef __linux__
- if (i_size > fs->blocksize * NDADDR) {
+ if (i_size > (u_quad_t)fs->blocksize * NDADDR) {
/* calculate the number of indirect blocks on the dump tape */
blkest +=
howmany(sizeest - NDADDR * fs->blocksize / TP_BSIZE,
/* The WANTTODUMP macro decides whether a file should be dumped. */
#define WANTTODUMP(dp, ino) \
- (CHANGEDSINCE(dp, spcl.c_ddate) && \
+ (CHANGEDSINCE(dp, ((u_int32_t)spcl.c_ddate)) && \
(!NODUMP_FLAG(dp)) && \
(!exclude_ino(ino)))
SETINO(ino, dumpdirmap);
if (WANTTODUMP(dp, ino)) {
SETINO(ino, dumpinomap);
- if (!MSINCE(dp, spcl.c_ddate))
+ if (!MSINCE(dp, (u_int32_t)spcl.c_ddate))
SETINO(ino, metainomap);
if (mode != IFREG && mode != IFDIR && mode != IFLNK)
*tapesize += 1;
*/
#ifdef __linux__
int
-mapfiles(dump_ino_t maxino, long *tapesize)
+mapfiles(UNUSED(dump_ino_t maxino), long *tapesize)
{
ext2_ino_t ino;
int anydirskipped = 0;
#ifdef __linux__
int
-maponefile(dump_ino_t maxino, long *tapesize, char *directory)
+maponefile(UNUSED(dump_ino_t maxino), long *tapesize, char *directory)
{
errcode_t retval;
ext2_ino_t dir_ino;
/*
* Mark every directory in the path as being dumped
*/
- for (i = 0; i < strlen (directory); i++) {
+ for (i = 0; i < (int)strlen (directory); i++) {
if (directory[i] == '/') {
strncpy (dir_name, directory, i);
dir_name[i] = '\0';
};
static int
-mapfilesindir(struct ext2_dir_entry *dirent, int offset, int blocksize, char *buf, void *private)
+mapfilesindir(struct ext2_dir_entry *dirent, UNUSED(int offset),
+ UNUSED(int blocksize), UNUSED(char *buf), void *private)
{
struct dinode const *dp;
int mode;
* the directories in the filesystem.
*/
int
-mapfilesfromdir(dump_ino_t maxino, long *tapesize, char *directory)
+mapfilesfromdir(UNUSED(dump_ino_t maxino), long *tapesize, char *directory)
{
errcode_t retval;
struct mapfile_context mfc;
/*
* Mark every directory in the path as being dumped
*/
- for (i = 0; i < strlen (directory); i++) {
+ for (i = 0; i < (int)strlen (directory); i++) {
if (directory[i] == '/') {
strncpy (dir_name, directory, i);
dir_name[i] = '\0';
*/
#ifdef __linux__
static int
-searchdir(struct ext2_dir_entry *dp, int offset, int blocksize, char *buf, void *private)
+searchdir(struct ext2_dir_entry *dp, UNUSED(int offset),
+ UNUSED(int blocksize), UNUSED(char *buf), void *private)
{
struct mapdirs_context *mdc;
int *ret;
* Dump a block to the tape
*/
static int
-dumponeblock(ext2_filsys fs, blk_t *blocknr, e2_blkcnt_t blockcnt,
- blk_t ref_block, int ref_offset, void * private)
+dumponeblock(UNUSED(ext2_filsys fs), blk_t *blocknr, e2_blkcnt_t blockcnt,
+ UNUSED(blk_t ref_block), UNUSED(int ref_offset), void * private)
{
struct block_context *p;
int i;
msg("Warning: undefined file type 0%o\n", dp->di_mode & IFMT);
return;
}
- if (i_size > NDADDR * sblock->fs_bsize)
+ if (i_size > (u_quad_t)NDADDR * sblock->fs_bsize)
#ifdef __linux__
cnt = NDADDR * EXT2_FRAGS_PER_BLOCK(fs->super);
#else
/* deal with holes at the end of the inode */
if (i_size > ((u_quad_t)bc.next_block) * sblock->fs_fsize) {
remaining = i_size - ((u_quad_t)bc.next_block) * sblock->fs_fsize;
- for (i = 0; i < howmany(remaining, sblock->fs_fsize); i++) {
+ for (i = 0; i < (int)howmany(remaining, sblock->fs_fsize); i++) {
bc.buf[bc.cnt++] = 0;
if (bc.cnt == bc.max) {
blksout (bc.buf, bc.cnt, bc.ino);
* size of the entry, and creates it in a temporary buffer
*/
static int
-convert_dir(struct ext2_dir_entry *dirent, int offset, int blocksize, char *buf, void *private)
+convert_dir(struct ext2_dir_entry *dirent, UNUSED(int offset),
+ UNUSED(int blocksize), UNUSED(char *buf), void *private)
{
struct convert_dir_context *p;
struct direct *dp;
#ifndef lint
static const char rcsid[] =
- "$Id: dirs.c,v 1.20 2002/06/25 19:00:38 stelian Exp $";
+ "$Id: dirs.c,v 1.21 2002/07/19 14:57:39 stelian Exp $";
#endif /* not lint */
#include <config.h>
* skipping over "." and ".."
*/
namelen = snprintf(locname, sizeof(locname), "%s/", pname);
- if (namelen >= sizeof(locname))
+ if (namelen >= (int)sizeof(locname))
namelen = sizeof(locname) - 1;
rst_seekdir(dirp, itp->t_seekpt, itp->t_seekpt);
dp = rst_readdir(dirp); /* "." */
*/
while (dp != NULL) {
locname[namelen] = '\0';
- if (namelen + dp->d_namlen >= sizeof(locname)) {
+ if (namelen + dp->d_namlen >= (int)sizeof(locname)) {
fprintf(stderr, "%s%s: name exceeds %ld char\n",
locname, dp->d_name, (long)sizeof(locname) - 1);
} else {
putent(&cvtbuf);
}
} else {
- for (loc = 0; loc < size; ) {
+ for (loc = 0; loc < (long)size; ) {
dp = (struct direct *)(buf + loc);
#ifdef DIRDEBUG
printf ("reclen = %d, namlen = %d, type = %d\n",
#ifndef lint
static const char rcsid[] =
- "$Id: interactive.c,v 1.24 2002/06/08 07:10:37 stelian Exp $";
+ "$Id: interactive.c,v 1.25 2002/07/19 14:57:39 stelian Exp $";
#endif /* not lint */
#include <config.h>
(void) strcpy(canonname, ".");
else
(void) strcpy(canonname, "./");
- if (strlen(canonname) + strlen(rawname) >= len)
+ if (strlen(canonname) + strlen(rawname) >= (unsigned)len)
errx(1, "canonname: not enough buffer space");
(void) strcat(canonname, rawname);
list = &single;
mkentry(name, dp, list);
len = strlen(basename) + 1;
- if (strlen(name) - len > single.len) {
+ if (strlen(name) - len > (unsigned)single.len) {
freename(single.fname);
single.fname = savename(&name[len]);
single.len = strlen(single.fname);
entries = 0;
listp = list;
namelen = snprintf(locname, sizeof(locname), "%s/", name);
- if (namelen >= sizeof(locname))
+ if (namelen >= (int)sizeof(locname))
namelen = sizeof(locname) - 1;
while ((dp = rst_readdir(dirp))) {
if (dp == NULL)
bigino = ROOTINO;
endlist = &list[nentry];
for (fp = &list[0]; fp < endlist; fp++) {
- if (bigino < fp->fnum)
+ if (bigino < (int)fp->fnum)
bigino = fp->fnum;
if (width < fp->len)
width = fp->len;
* respond to interrupts
*/
void
-onintr(int signo)
+onintr(UNUSED(int signo))
{
int save_errno = errno;
}
static char **
-restore_completion (const char *text, int start, int end)
+restore_completion (const char *text, int start, UNUSED(int end))
{
char **matches;
#ifndef lint
static const char rcsid[] =
- "$Id: main.c,v 1.40 2002/06/08 07:10:37 stelian Exp $";
+ "$Id: main.c,v 1.41 2002/07/19 14:57:39 stelian Exp $";
#endif /* not lint */
#include <config.h>
errx(1, "can't create tapeposfile\n");
/* print QFA-file header */
sprintf(gTps, "%s\n%s\n%ld\n\n", QFA_MAGIC, QFA_VERSION,(unsigned long)spcl.c_date);
- if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps))
+ if (write(gTapeposfd, gTps, strlen(gTps)) != (ssize_t)strlen(gTps))
errx(1, "can't write tapeposfile\n");
sprintf(gTps, "ino\ttapeno\ttapepos\n");
- if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps))
+ if (write(gTapeposfd, gTps, strlen(gTps)) != (ssize_t)strlen(gTps))
errx(1, "can't write tapeposfile\n");
extractdirs(1);
#ifndef lint
static const char rcsid[] =
- "$Id: restore.c,v 1.29 2002/04/04 08:20:23 stelian Exp $";
+ "$Id: restore.c,v 1.30 2002/07/19 14:57:40 stelian Exp $";
#endif /* not lint */
#include <config.h>
*/
/* ARGSUSED */
long
-deletefile(char *name, dump_ino_t ino, int type)
+deletefile(char *name, dump_ino_t ino, UNUSED(int type))
{
long descend = hflag ? GOOD : FAIL;
struct entry *ep;
if (volinfo[1] == ROOTINO) {
int i, goodvol = 1;
- for (i = 1; i < TP_NINOS && volinfo[i] != 0; ++i)
+ for (i = 1; i < (int)TP_NINOS && volinfo[i] != 0; ++i)
if (volinfo[i] < next)
goodvol = i;
msg("inode %ld at tapepos %ld\n", curfile.ino, curtapepos);
#endif
sprintf(gTps, "%ld\t%ld\t%lld\n", (unsigned long)curfile.ino, volno, curtapepos);
- if (write(gTapeposfd, gTps, strlen(gTps)) != strlen(gTps))
+ if (write(gTapeposfd, gTps, strlen(gTps)) != (ssize_t)strlen(gTps))
warn("error writing tapepos file.\n");
skipfile();
}
#ifndef lint
static const char rcsid[] =
- "$Id: symtab.c,v 1.18 2002/01/25 15:09:00 stelian Exp $";
+ "$Id: symtab.c,v 1.19 2002/07/19 14:57:40 stelian Exp $";
#endif /* not lint */
/*
/*
* Convert entry pointers to indexes, and output
*/
- for (i = 0; i < entrytblsize; i++) {
+ for (i = 0; (long)i < entrytblsize; i++) {
if (entry[i] == NULL)
tentry = NULL;
else
#ifndef lint
static const char rcsid[] =
- "$Id: tape.c,v 1.62 2002/05/21 15:48:46 stelian Exp $";
+ "$Id: tape.c,v 1.63 2002/07/19 14:57:40 stelian Exp $";
#endif /* not lint */
#include <config.h>
if (vflag || command == 't' || command == 'C')
printdumpinfo();
#ifdef USE_QFA
- if (tapeposflag && spcl.c_date != qfadumpdate)
+ if (tapeposflag && (unsigned long)spcl.c_date != qfadumpdate)
errx(1, "different QFA/dumpdates detected\n");
#endif
if (filesys[0] == '\0') {
if (volinfo[1] == ROOTINO) {
printf("Starting inode numbers by volume:\n");
- for (i = 1; i < TP_NINOS && volinfo[i] != 0; ++i)
+ for (i = 1; i < (int)TP_NINOS && volinfo[i] != 0; ++i)
printf("\tVolume %d: %lu\n", i, (unsigned long)volinfo[i]);
}
}
*/
/* ARGSUSED */
static void
-xtrskip(char *buf, size_t size)
+xtrskip(UNUSED(char *buf), size_t size)
{
if (LSEEK(ofile, (off_t)size, SEEK_CUR) == -1)
*/
/* ARGSUSED */
static void
-xtrlnkskip(char *buf, size_t size)
+xtrlnkskip(UNUSED(char *buf), UNUSED(size_t size))
{
errx(1, "unallocated block in symbolic link %s", curfile.name);
*/
/* ARGSUSED */
static void
-xtrmapskip(char *buf, size_t size)
+xtrmapskip(UNUSED(char *buf), size_t size)
{
panic("hole in map\n");
*/
/* ARGSUSED */
void
-xtrnull(char *buf, size_t size)
+xtrnull(UNUSED(char *buf), UNUSED(size_t size))
{
return;
if (cmperror)
return;
- if (read(ifile, cmpbuf, size) != size) {
+ if (read(ifile, cmpbuf, size) != (ssize_t)size) {
fprintf(stderr, "%s: size has changed.\n",
curfile.name);
cmperror = 1;
* Skip over a hole in a file.
*/
static void
-xtrcmpskip(char *buf, size_t size)
+xtrcmpskip(UNUSED(char *buf), size_t size)
{
static char cmpbuf[MAXBSIZE];
int i;
if (cmperror)
return;
- if (read(ifile, cmpbuf, size) != size) {
+ if (read(ifile, cmpbuf, size) != (ssize_t)size) {
fprintf(stderr, "%s: size has changed.\n",
curfile.name);
cmperror = 1;
return;
}
- for (i = 0; i < size; ++i)
+ for (i = 0; i < (int)size; ++i)
if (cmpbuf[i] != '\0') {
fprintf(stderr, "%s: tape and disk copies are different\n",
curfile.name);
void
comparefile(char *name)
{
- int mode;
+ unsigned int mode;
struct STAT sb;
int r;
#if !COMPARE_ONTHEFLY
return;
}
- if (sb.st_rdev != (int)curfile.dip->di_rdev) {
+ if (sb.st_rdev != (dev_t)curfile.dip->di_rdev) {
fprintf(stderr,
"%s: device changed from %d,%d to %d,%d.\n",
name,
/* read the block prefix */
ret = read_a_block(mt, tapebuf, PREFIXSIZE, &rl);
- if (Vflag && (ret == 0 || rl < PREFIXSIZE || tpb->length == 0))
+ if (Vflag && (ret == 0 || rl < (int)PREFIXSIZE || tpb->length == 0))
ret = 0;
if (ret <= 0)
goto readerr;
/* build a length error message */
blocklen = tpbin->length;
- if (readsize < blocklen + PREFIXSIZE)
+ if (readsize < blocklen + (int)PREFIXSIZE)
lengtherr = "short";
else
- if (readsize > blocklen + PREFIXSIZE)
+ if (readsize > blocklen + (int)PREFIXSIZE)
lengtherr = "long";
worklen = comprlen;
len = bufsize - TP_BSIZE;
}
if (read_a_block(mt, tapebuf+TP_BSIZE, len, &i) < 0
- || (i != len && i % TP_BSIZE != 0))
+ || (i != (long)len && i % TP_BSIZE != 0))
errx(1,"Error reading dump file header");
tbufptr = tapebuf;
numtrec = ntrec;