DragonFly BSD
DragonFly submit List (threaded) for 2005-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

[PATCH] sbin/dump bug fixing


From: Sepherosa Ziehau <sepherosa@xxxxxxxxxxxx>
Date: Fri, 1 Apr 2005 15:51:02 +0800 (CST)

some patch for sbin/dump extracted from FreeBSD

sbin/dump/dump.h      1.7.6.4 -> 1.7.6.5
sbin/dump/itime.c     1.3.2.1 -> 1.3.2.2
sbin/dump/traverse.c  1.10.2.6 -> 1.10.2.8

We probably need them

Best Regards,
sephe
Index: dump.h
===================================================================
RCS file: /opt/df_cvs/src/sbin/dump/dump.h,v
retrieving revision 1.5
diff -u -r1.5 dump.h
--- dump.h	4 Feb 2004 17:39:59 -0000	1.5
+++ dump.h	1 Apr 2005 07:41:36 -0000
@@ -168,13 +168,13 @@
 	time_t	dd_ddate;
 };
 int	nddates;		/* number of records (might be zero) */
-int	ddates_in;		/* we have read the increment file */
 struct	dumpdates **ddatev;	/* the arrayfied version */
 void	initdumptimes(void);
 void	getdumptime(void);
 void	putdumptime(void);
-#define	ITITERATE(i, ddp) \
-	for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i])
+#define	ITITERATE(i, ddp) 	\
+	if (ddatev != NULL)	\
+		for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i])
 
 void	sig(int signo);
 
Index: itime.c
===================================================================
RCS file: /opt/df_cvs/src/sbin/dump/itime.c,v
retrieving revision 1.7
diff -u -r1.7 itime.c
--- itime.c	27 Dec 2004 22:36:37 -0000	1.7
+++ itime.c	1 Apr 2005 07:41:36 -0000
@@ -67,7 +67,6 @@
 SLIST_HEAD(dthead, dumptime) dthead = SLIST_HEAD_INITIALIZER(dthead);
 struct	dumpdates **ddatev = 0;
 int	nddates = 0;
-int	ddates_in = 0;
 
 static	void dumprecout(FILE *, struct dumpdates *);
 static	int getrecord(FILE *, struct dumpdates *);
@@ -120,7 +119,6 @@
 		SLIST_INSERT_HEAD(&dthead, dtwalk, dt_list);
 	}
 
-	ddates_in = 1;
 	/*
 	 *	arrayify the list, leaving enough room for the additional
 	 *	record that we may have to add to the ddate structure
@@ -183,7 +181,6 @@
 	free((char *)ddatev);
 	ddatev = 0;
 	nddates = 0;
-	ddates_in = 0;
 	readdumptimes(df);
 	if (fseek(df, 0L, 0) < 0)
 		quit("fseek: %s\n", strerror(errno));
Index: traverse.c
===================================================================
RCS file: /opt/df_cvs/src/sbin/dump/traverse.c,v
retrieving revision 1.8
diff -u -r1.8 traverse.c
--- traverse.c	27 Dec 2004 22:36:37 -0000	1.8
+++ traverse.c	1 Apr 2005 07:41:36 -0000
@@ -223,7 +223,7 @@
 		for (ret = 0, i = 0; filesize > 0 && i < NDADDR; i++) {
 			if (di.di_db[i] != 0)
 				ret |= searchdir(ino, di.di_db[i],
-					(long)dblksize(sblock, dp, i),
+					(long)dblksize(sblock, &di, i),
 					filesize, tapesize, nodump);
 			if (ret & HASDUMPEDFILE)
 				filesize = 0;
@@ -238,7 +238,7 @@
 		}
 		if (ret & HASDUMPEDFILE) {
 			SETINO(ino, dumpinomap);
-			*tapesize += blockest(dp);
+			*tapesize += blockest(&di);
 			change = 1;
 			continue;
 		}
@@ -328,12 +328,15 @@
 			ip = getino(dp->d_ino);
 			if (TSTINO(dp->d_ino, dumpinomap)) {
 				CLRINO(dp->d_ino, dumpinomap);
-				CLRINO(dp->d_ino, usedinomap);
 				*tapesize -= blockest(ip);
 			}
-			/* Add back to dumpdirmap to propagate nodump. */
+			/*
+			 * Add back to dumpdirmap and remove from usedinomap
+			 * to propagate nodump.
+			 */
 			if ((ip->di_mode & IFMT) == IFDIR) {
 				SETINO(dp->d_ino, dumpdirmap);
+				CLRINO(dp->d_ino, usedinomap);
 				ret |= HASSUBDIRS;
 			}
 		} else {


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]