+#ifdef __linux__
+int
+mapfiles(dump_ino_t maxino, long *tapesize)
+{
+ ext2_ino_t ino;
+ int anydirskipped = 0;
+ ext2_inode_scan scan;
+ errcode_t err;
+ struct ext2_inode inode;
+
+ /*
+ * We use libext2fs's inode scanning routines, which are particularly
+ * robust. (Note that getino cannot return an error.)
+ */
+ err = ext2fs_open_inode_scan(fs, 0, &scan);
+ if (err) {
+ com_err(disk, err, "while opening inodes\n");
+ exit(X_ABORT);
+ }
+ for (;;) {
+ err = ext2fs_get_next_inode(scan, &ino, &inode);
+ if (err == EXT2_ET_BAD_BLOCK_IN_INODE_TABLE)
+ continue;
+ if (err) {
+ com_err(disk, err, "while scanning inode #%ld\n",
+ (long)ino);
+ exit(X_ABORT);
+ }
+ if (ino == 0)
+ break;
+
+ curino = ino;
+ mapfileino(ino, (struct dinode const *)&inode, tapesize,
+ &anydirskipped);
+ }
+ ext2fs_close_inode_scan(scan);
+
+ /*
+ * Restore gets very upset if the root is not dumped,
+ * so ensure that it always is dumped.
+ */
+ SETINO(ROOTINO, dumpinomap);
+ return (anydirskipped);
+}
+#else