* Ported to Linux's Second Extended File System as part of the
* dump and restore backup suit
* Remy Card <card@Linux.EU.Org>, 1994-1997
- * Stelian Pop <pop@noos.fr>, 1999-2000
- * Stelian Pop <pop@noos.fr> - Alcôve <www.alcove.fr>, 2000
+ * Stelian Pop <stelian@popies.net>, 1999-2000
+ * Stelian Pop <stelian@popies.net> - Alcôve <www.alcove.com>, 2000-2002
*/
/*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
#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.22 2003/03/30 15:40:40 stelian Exp $";
#endif /* not lint */
#include <config.h>
#ifdef __linux__
#include <sys/time.h>
#include <time.h>
+#ifdef HAVE_EXT2FS_EXT2_FS_H
+#include <ext2fs/ext2_fs.h>
+#else
#include <linux/ext2_fs.h>
+#endif
#include <ext2fs/ext2fs.h>
#include <bsdcompat.h>
#else /* __linux__ */
void
pathcheck(char *name)
{
- register char *cp;
+ char *cp;
struct entry *ep;
char *start;
if (!Nflag && (ret = link(existing, new)) < 0) {
-#ifndef __linux__
+#if !defined(__linux__) && !defined(sunos)
struct stat s;
/*
return (GOOD);
}
-#ifndef __linux__
+#if !defined(__linux__) && !defined(sunos)
/*
* Create a whiteout.
*/
dump_ino_t
lowerbnd(dump_ino_t start)
{
- register struct entry *ep;
+ struct entry *ep;
for ( ; start < maxino; start++) {
ep = lookupino(start);
dump_ino_t
upperbnd(dump_ino_t start)
{
- register struct entry *ep;
+ struct entry *ep;
for ( ; start > ROOTINO; start--) {
ep = lookupino(start);
* 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;
/* read tapepos */
while ((*p != 0) && (*p != '\t'))
*pp++ = *p++;
- tmptpos = atol(numbuff);
+ tmptpos = atoll(numbuff);
if (exactmatch) {
if (tmpino == ino) {
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;
+ }
+}