+/* The WANTTODUMP macro decides whether a file should be dumped. */
+#define WANTTODUMP(dp, ino) \
+ (CHANGEDSINCE(dp, spcl.c_ddate) && \
+ (!NODUMP_FLAG(dp)) && \
+ (!exclude_ino(ino)))
+
+/*
+ * Determine if given inode should be dumped
+ */
+void
+mapfileino(ino_t ino, long *tapesize, int *dirskipped)
+{
+ register int mode;
+ register struct dinode *dp;
+
+ /*
+ * Skip inode if we've already marked it for dumping
+ */
+ if (TSTINO(ino, usedinomap))
+ return;
+ dp = getino(ino);
+ if ((mode = (dp->di_mode & IFMT)) == 0)
+ return;
+#ifdef __linux__
+ if (dp->di_nlink == 0 || dp->di_dtime != 0)
+ return;
+#endif
+ /*
+ * Put all dirs in dumpdirmap, inodes that are to be dumped in the
+ * used map. All inode but dirs who have the nodump attribute go
+ * to the usedinomap.
+ */
+ SETINO(ino, usedinomap);
+
+ if (mode == IFDIR)
+ SETINO(ino, dumpdirmap);
+ if (WANTTODUMP(dp, ino)) {
+ SETINO(ino, dumpinomap);
+ if (mode != IFREG && mode != IFDIR && mode != IFLNK)
+ *tapesize += 1;
+ else
+ *tapesize += blockest(dp);
+ return;
+ }
+ if (mode == IFDIR) {
+ if ( NODUMP_FLAG(dp) || exclude_ino(ino) )
+ CLRINO(ino, usedinomap);
+ *dirskipped = 1;
+ }
+}
+