New diff. * Move all off_t variables that don't look like file sizes to int64_t. * Switch blockswritten to int64_t, so it won't wrap at 2TB. * Same for blocksthisvol (deraadt@). * Switch xferrate (tedu@) and blocksperfile from long to uint64_t. * Since blocksperfile can be set with -B, move numarg() from long to long long and don't mark small integer constant arguments with 'L'.
Index: dump.h =================================================================== RCS file: /cvs/src/sbin/dump/dump.h,v retrieving revision 1.19 diff -u -p -r1.19 dump.h --- dump.h 24 May 2014 21:49:09 -0000 1.19 +++ dump.h 12 Jun 2014 21:02:32 -0000 @@ -65,15 +65,15 @@ int pipeout; /* true => output to standa ino_t curino; /* current inumber; used globally */ int newtape; /* new tape flag */ int density; /* density in 0.1" units */ -off_t tapesize; /* estimated tape size, blocks */ -off_t tsize; /* tape size in 0.1" units */ +int64_t tapesize; /* estimated tape size, blocks */ +int64_t tsize; /* tape size in 0.1" units */ int unlimited; /* if set, write to end of medium */ -off_t asize; /* number of 0.1" units written on current tape */ +int64_t asize; /* number of 0.1" units written on current tape */ int etapes; /* estimated number of tapes */ int nonodump; /* if set, do not honor UF_NODUMP user flags */ int notify; /* notify operator flag */ -int blockswritten; /* number of blocks written on current tape */ +int64_t blockswritten; /* number of blocks written on current tape */ int tapeno; /* current tape number */ time_t tstart_writing; /* when started writing the first tape block */ long xferrate; /* averaged transfer rate of all volumes */ @@ -96,10 +96,11 @@ void timeest(void); /* mapping routines */ union dinode; -off_t blockest(union dinode *dp); -void mapfileino(ino_t, off_t *, int *); -int mapfiles(ino_t maxino, off_t *tapesize, char *disk, char * const *dirv); -int mapdirs(ino_t maxino, off_t *tapesize); +int64_t blockest(union dinode *dp); +void mapfileino(ino_t, int64_t *, int *); +int mapfiles(ino_t maxino, int64_t *tapesize, char *disk, + char * const *dirv); +int mapdirs(ino_t maxino, int64_t *tapesize); /* file dumping routines */ void ufs1_blksout(int32_t *blkp, int frags, ino_t ino); Index: main.c =================================================================== RCS file: /cvs/src/sbin/dump/main.c,v retrieving revision 1.50 diff -u -p -r1.50 main.c --- main.c 31 May 2014 08:28:13 -0000 1.50 +++ main.c 12 Jun 2014 21:19:18 -0000 @@ -59,12 +59,12 @@ #include "pathnames.h" int notify = 0; /* notify operator flag */ -int blockswritten = 0; /* number of blocks written on current tape */ +int64_t blockswritten = 0; /* number of blocks written on current tape */ int tapeno = 0; /* current tape number */ int density = 0; /* density in bytes/0.1" */ int ntrec = NTREC; /* # tape blocks in each tape record */ int cartridge = 0; /* Assume non-cartridge tape */ -long blocksperfile; /* output blocks per file */ +int64_t blocksperfile; /* output blocks per file */ char *host = NULL; /* remote host (if any) */ int maxbsize = 64*1024; /* XXX MAXBSIZE from sys/param.h */ @@ -75,7 +75,7 @@ struct disklabel lab; */ static int sblock_try[] = SBLOCKSEARCH; -static long numarg(char *, long, long); +static long long numarg(char *, long long, long long); static void obsolete(int *, char **[]); static void usage(void); @@ -121,11 +121,11 @@ main(int argc, char *argv[]) break; case 'B': /* blocks per output file */ - blocksperfile = numarg("blocks per file", 1L, 0L); + blocksperfile = numarg("blocks per file", 1, 0); break; case 'b': /* blocks per tape write */ - ntrec = numarg("blocks per write", 1L, 1000L); + ntrec = numarg("blocks per write", 1, 1000); if (ntrec > maxbsize/1024) { msg("Please choose a blocksize <= %dKB\n", maxbsize/1024); @@ -139,7 +139,7 @@ main(int argc, char *argv[]) break; case 'd': /* density, in bits per inch */ - density = numarg("density", 10L, 327670L) / 10; + density = numarg("density", 10, 327670) / 10; if (density >= 625 && !bflag) ntrec = HIGHDENSITYTREC; break; @@ -149,7 +149,7 @@ main(int argc, char *argv[]) break; case 'h': - honorlevel = numarg("honor level", 0L, 10L); + honorlevel = numarg("honor level", 0, 10); break; case 'n': /* notify operators */ @@ -157,7 +157,7 @@ main(int argc, char *argv[]) break; case 's': /* tape size, feet */ - tsize = numarg("tape size", 1L, 0L) * 12 * 10; + tsize = numarg("tape size", 1, 0) * 12 * 10; break; case 'S': /* estimate blocks and # of tapes */ @@ -573,17 +573,17 @@ usage(void) * Pick up a numeric argument. It must be nonnegative and in the given * range (except that a vmax of 0 means unlimited). */ -static long -numarg(char *meaning, long vmin, long vmax) +static long long +numarg(char *meaning, long long vmin, long long vmax) { - long val; + long long val; const char *errstr; if (vmax == 0) - vmax = LONG_MAX; + vmax = LLONG_MAX; val = strtonum(optarg, vmin, vmax, &errstr); if (errstr) - errx(X_STARTUP, "%s is %s [%ld - %ld]", + errx(X_STARTUP, "%s is %s [%lld - %lld]", meaning, errstr, vmin, vmax); return (val); Index: tape.c =================================================================== RCS file: /cvs/src/sbin/dump/tape.c,v retrieving revision 1.39 diff -u -p -r1.39 tape.c --- tape.c 24 May 2014 21:49:09 -0000 1.39 +++ tape.c 12 Jun 2014 20:47:37 -0000 @@ -56,8 +56,8 @@ int writesize; /* size of malloc()ed buffer for tape */ int64_t lastspclrec = -1; /* tape block number of last written header */ int trecno = 0; /* next record to write in current block */ -extern long blocksperfile; /* number of blocks per output file */ -long blocksthisvol; /* number of blocks on current output file */ +extern int64_t blocksperfile; /* number of blocks per output file */ +int64_t blocksthisvol; /* number of blocks on current output file */ extern int ntrec; /* blocking factor on tape */ extern int cartridge; extern char *host; @@ -200,7 +200,8 @@ tperror(int signo) quit("Cannot recover\n"); /* NOTREACHED */ } - msg("write error %ld blocks into volume %d\n", blocksthisvol, tapeno); + msg("write error %lld blocks into volume %d\n", + (long long)blocksthisvol, tapeno); broadcast("DUMP WRITE ERROR!\n"); if (!query("Do you want to restart?")) dumpabort(0); Index: traverse.c =================================================================== RCS file: /cvs/src/sbin/dump/traverse.c,v retrieving revision 1.34 diff -u -p -r1.34 traverse.c --- traverse.c 31 May 2014 14:15:22 -0000 1.34 +++ traverse.c 12 Jun 2014 21:07:13 -0000 @@ -63,9 +63,9 @@ union dinode { #define HASDUMPEDFILE 0x1 #define HASSUBDIRS 0x2 -static int dirindir(ino_t, daddr_t, int, off_t *, off_t *, int); +static int dirindir(ino_t, daddr_t, int, off_t *, int64_t *, int); static void dmpindir(ino_t, daddr_t, int, off_t *); -static int searchdir(ino_t, daddr_t, long, off_t, off_t *, int); +static int searchdir(ino_t, daddr_t, long, off_t, int64_t *, int); void fs_mapinodes(ino_t maxino, off_t *tapesize, int *anydirskipped); /* @@ -75,10 +75,10 @@ void fs_mapinodes(ino_t maxino, off_t *t * (when some of the blocks are usually used for indirect pointers); * hence the estimate may be high. */ -off_t +int64_t blockest(union dinode *dp) { - off_t blkest, sizeest; + int64_t blkest, sizeest; /* * dp->di_size is the size of the file in bytes. @@ -94,8 +94,8 @@ blockest(union dinode *dp) * dump blocks (sizeest vs. blkest in the indirect block * calculation). */ - blkest = howmany(dbtob((off_t)DIP(dp, di_blocks)), TP_BSIZE); - sizeest = howmany((off_t)DIP(dp, di_size), TP_BSIZE); + blkest = howmany(dbtob((int64_t)DIP(dp, di_blocks)), TP_BSIZE); + sizeest = howmany((int64_t)DIP(dp, di_size), TP_BSIZE); if (blkest > sizeest) blkest = sizeest; if (DIP(dp, di_size) > sblock->fs_bsize * NDADDR) { @@ -115,7 +115,7 @@ blockest(union dinode *dp) * Determine if given inode should be dumped */ void -mapfileino(ino_t ino, off_t *tapesize, int *dirskipped) +mapfileino(ino_t ino, int64_t *tapesize, int *dirskipped) { int mode; union dinode *dp; @@ -144,7 +144,7 @@ mapfileino(ino_t ino, off_t *tapesize, i } void -fs_mapinodes(ino_t maxino, off_t *tapesize, int *anydirskipped) +fs_mapinodes(ino_t maxino, int64_t *tapesize, int *anydirskipped) { int i, cg, inosused; struct cg *cgp; @@ -204,7 +204,7 @@ fs_mapinodes(ino_t maxino, off_t *tapesi * the directories in the filesystem. */ int -mapfiles(ino_t maxino, off_t *tapesize, char *disk, char * const *dirv) +mapfiles(ino_t maxino, int64_t *tapesize, char *disk, char * const *dirv) { int anydirskipped = 0; @@ -304,7 +304,7 @@ mapfiles(ino_t maxino, off_t *tapesize, * pass using this algorithm. */ int -mapdirs(ino_t maxino, off_t *tapesize) +mapdirs(ino_t maxino, int64_t *tapesize) { union dinode *dp; int i, isdir, nodump; @@ -382,7 +382,7 @@ mapdirs(ino_t maxino, off_t *tapesize) */ static int dirindir(ino_t ino, daddr_t blkno, int ind_level, off_t *filesize, - off_t *tapesize, int nodump) + int64_t *tapesize, int nodump) { int ret = 0; int i; @@ -425,7 +425,7 @@ dirindir(ino_t ino, daddr_t blkno, int i */ static int searchdir(ino_t ino, daddr_t blkno, long size, off_t filesize, - off_t *tapesize, int nodump) + int64_t *tapesize, int nodump) { struct direct *dp; union dinode *ip; -- Christian "naddy" Weisgerber na...@mips.inka.de