X-Git-Url: https://git.wh0rd.org/?p=dump.git;a=blobdiff_plain;f=restore%2Futilities.c;h=16d16746fc6b8fdda7b374358adfe1a6b8c89f41;hp=95cb2160acb619896fd2b36ef81e76eb93c29487;hb=e531c44203905d5554118c09c8d0267f17879ee6;hpb=717bdcef94c7487831a43048751ca868f7d8bae4 diff --git a/restore/utilities.c b/restore/utilities.c index 95cb216..16d1674 100644 --- a/restore/utilities.c +++ b/restore/utilities.c @@ -2,8 +2,8 @@ * Ported to Linux's Second Extended File System as part of the * dump and restore backup suit * Remy Card , 1994-1997 - * Stelian Pop , 1999-2000 - * Stelian Pop - Alcôve , 2000 + * Stelian Pop , 1999-2000 + * Stelian Pop - Alcôve , 2000-2002 */ /* @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: utilities.c,v 1.15 2001/04/24 10:59:13 stelian Exp $"; + "$Id: utilities.c,v 1.21 2002/11/15 09:25:42 stelian Exp $"; #endif /* not lint */ #include @@ -57,7 +57,11 @@ static const char rcsid[] = #ifdef __linux__ #include #include +#ifdef HAVE_EXT2FS_EXT2_FS_H +#include +#else #include +#endif #include #include #else /* __linux__ */ @@ -74,7 +78,7 @@ static const char rcsid[] = void pathcheck(char *name) { - register char *cp; + char *cp; struct entry *ep; char *start; @@ -232,7 +236,7 @@ linkit(char *existing, char *new, int type) if (!Nflag && (ret = link(existing, new)) < 0) { -#ifndef __linux__ +#if !defined(__linux__) && !defined(sunos) struct stat s; /* @@ -272,7 +276,7 @@ linkit(char *existing, char *new, int type) return (GOOD); } -#ifndef __linux__ +#if !defined(__linux__) && !defined(sunos) /* * Create a whiteout. */ @@ -315,7 +319,7 @@ delwhiteout(struct entry *ep) dump_ino_t lowerbnd(dump_ino_t start) { - register struct entry *ep; + struct entry *ep; for ( ; start < maxino; start++) { ep = lookupino(start); @@ -333,7 +337,7 @@ lowerbnd(dump_ino_t start) dump_ino_t upperbnd(dump_ino_t start) { - register struct entry *ep; + struct entry *ep; for ( ; start > ROOTINO; start--) { ep = lookupino(start); @@ -481,13 +485,13 @@ panic(fmt, va_alist) * if no smaller inode found return tnum=0 and tpos=0 */ int -Inode2Tapepos(dump_ino_t ino, long *tnum, long *tpos, int exactmatch) +Inode2Tapepos(dump_ino_t ino, long *tnum, long long *tpos, int exactmatch) { char *p, *pp; char numbuff[32]; unsigned long tmpino; long tmptnum; - long tmptpos; + long long tmptpos; *tpos = 0; *tnum = 0; @@ -519,7 +523,7 @@ Inode2Tapepos(dump_ino_t ino, long *tnum, long *tpos, int exactmatch) /* read tapepos */ while ((*p != 0) && (*p != '\t')) *pp++ = *p++; - tmptpos = atol(numbuff); + tmptpos = atoll(numbuff); if (exactmatch) { if (tmpino == ino) { @@ -539,3 +543,25 @@ Inode2Tapepos(dump_ino_t ino, long *tnum, long *tpos, int exactmatch) return 0; } #endif /* USE_QFA */ + +void resizemaps(dump_ino_t oldmax, dump_ino_t newmax) +{ + char *map; + + if (usedinomap) { + map = calloc((unsigned)1, (unsigned)howmany(newmax, NBBY)); + if (map == NULL) + errx(1, "no memory for active inode map"); + memcpy(map, usedinomap, howmany(oldmax, NBBY)); + free(usedinomap); + usedinomap = map; + } + if (dumpmap) { + map = calloc((unsigned)1, (unsigned)howmany(newmax, NBBY)); + if (map == NULL) + errx(1, "no memory for file dump list"); + memcpy(map, dumpmap, howmany(oldmax, NBBY)); + free(dumpmap); + dumpmap = map; + } +}