X-Git-Url: https://git.wh0rd.org/?p=dump.git;a=blobdiff_plain;f=dump%2Ftraverse.c;h=0ea5b96f7b355255844bc5f85672543ed2c25f15;hp=c4e1e9ab0dde48fe1ab28bb3d7aa1dfd46f3b47b;hb=a94ecd1155631b9f88488a19268874c0e3c6601c;hpb=35b24fb7fabcf6df3b37aebf70c228d5b0688d32 diff --git a/dump/traverse.c b/dump/traverse.c index c4e1e9a..0ea5b96 100644 --- a/dump/traverse.c +++ b/dump/traverse.c @@ -41,7 +41,7 @@ #ifndef lint static const char rcsid[] = - "$Id: traverse.c,v 1.31 2001/03/28 12:59:48 stelian Exp $"; + "$Id: traverse.c,v 1.32 2001/04/10 13:42:22 stelian Exp $"; #endif /* not lint */ #include @@ -369,6 +369,54 @@ mapfiles(dump_ino_t maxino, long *tapesize) } #endif /* __linux__ */ +#ifdef __linux__ +int +maponefile(dump_ino_t maxino, long *tapesize, char *directory) +{ + errcode_t retval; + ext2_ino_t dir_ino; + char dir_name [MAXPATHLEN]; + int i, anydirskipped = 0; + + /* + * Mark every directory in the path as being dumped + */ + for (i = 0; i < strlen (directory); i++) { + if (directory[i] == '/') { + strncpy (dir_name, directory, i); + dir_name[i] = '\0'; + retval = ext2fs_namei(fs, ROOTINO, ROOTINO, + dir_name, &dir_ino); + if (retval) { + com_err(disk, retval, + "while translating %s", dir_name); + exit(X_ABORT); + } + mapfileino((dump_ino_t) dir_ino, 0, + tapesize, &anydirskipped); + } + } + /* + * Mark the final directory + */ + retval = ext2fs_namei(fs, ROOTINO, ROOTINO, directory, &dir_ino); + if (retval) { + com_err(disk, retval, "while translating %s", directory); + exit(X_ABORT); + } + mapfileino((dump_ino_t)dir_ino, 0, tapesize, &anydirskipped); + + mapfileino(ROOTINO, 0, tapesize, &anydirskipped); + + /* + * Restore gets very upset if the root is not dumped, + * so ensure that it always is dumped. + */ + SETINO(ROOTINO, dumpdirmap); + return anydirskipped; +} +#endif /* __linux__ */ + #ifdef __linux__ struct mapfile_context { long *tapesize;