From: Stelian Pop Date: Fri, 4 Feb 2000 20:22:21 +0000 (+0000) Subject: Added -e exclude inode option to dump. X-Git-Tag: release_0_4b14~5 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=20c345aa6780d2b021ce6cdbd812e4f021273640;p=dump.git Added -e exclude inode option to dump. --- diff --git a/CHANGES b/CHANGES index d86fccb..fc249e1 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.38 2000/01/26 11:38:07 stelian Exp $ +$Id: CHANGES,v 1.39 2000/02/04 20:22:21 stelian Exp $ Changes between versions 0.4b13 and 0.4b14 (released ????????????????) ====================================================================== @@ -18,6 +18,9 @@ Changes between versions 0.4b13 and 0.4b14 (released ????????????????) 3. Improved the output of dump in order to tell which directory it is currently dumping (when dumping a subtree). +4. Added the '-e' exclude inode option to dump. Thanks to + Isaac Chuang for contributing with the patch. + Changes between versions 0.4b12 and 0.4b13 (released January 21, 2000) ====================================================================== diff --git a/THANKS b/THANKS index b599c8a..c298862 100644 --- a/THANKS +++ b/THANKS @@ -1,4 +1,4 @@ -$Id: THANKS,v 1.18 2000/01/25 14:16:01 stelian Exp $ +$Id: THANKS,v 1.19 2000/02/04 20:22:21 stelian Exp $ Dump and restore were written by the people of the CSRG at the University of California, Berkeley. @@ -24,6 +24,7 @@ Here is a partial list of them (if I have forgotten someone, please complain): Stephen Carr sgcarr@civeng.adelaide.edu.au Rob Cermak cermak@ahab.rutgers.edu +Isaac Chuang ike@isl.stanford.edu Rainer Clasen bj@ncc.cicely.de Abhijit Dasgupta abhijit@ans.net Jason Fearon jasonf@netrider.org.au diff --git a/dump/dump.8.in b/dump/dump.8.in index 05d53dd..469ff1b 100644 --- a/dump/dump.8.in +++ b/dump/dump.8.in @@ -30,7 +30,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dump.8.in,v 1.10 2000/01/21 10:23:30 stelian Exp $ +.\" $Id: dump.8.in,v 1.11 2000/02/04 20:22:21 stelian Exp $ .\" .Dd __DATE__ .Dt DUMP 8 @@ -137,6 +137,12 @@ will constrain writes to MAXBSIZE. .It Fl c Change the defaults for use with a cartridge tape drive, with a density of 8000 bpi, and a length of 1700 feet. +.It Fl e Ar inode +Exclude +.Ar inode +from the dump (you can use +.Ar stat +to find the inode number for a file or directory). .It Fl h Ar level Honor the user .Dq nodump diff --git a/dump/dump.h b/dump/dump.h index 7b66e05..23331ff 100644 --- a/dump/dump.h +++ b/dump/dump.h @@ -4,7 +4,7 @@ * Remy Card , 1994-1997 * Stelian Pop , 1999-2000 * - * $Id: dump.h,v 1.9 2000/01/21 10:17:41 stelian Exp $ + * $Id: dump.h,v 1.10 2000/02/04 20:22:21 stelian Exp $ */ /*- @@ -257,3 +257,7 @@ extern void exit(); extern off_t lseek(); extern const char *strerror(); #endif + + /* 04-Feb-00 ILC */ +#define IEXCLUDE_MAXNUM 256 /* max size of inode exclude list */ + diff --git a/dump/main.c b/dump/main.c index f5fd989..806de5e 100644 --- a/dump/main.c +++ b/dump/main.c @@ -40,7 +40,7 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.14 2000/01/26 11:38:08 stelian Exp $"; + "$Id: main.c,v 1.15 2000/02/04 20:22:21 stelian Exp $"; #endif /* not lint */ #include @@ -105,6 +105,9 @@ static long numarg __P((const char *, long, long)); static void obsolete __P((int *, char **[])); static void usage __P((void)); +ino_t iexclude_list[IEXCLUDE_MAXNUM]; /* the inode exclude list */ +int iexclude_num = 0; /* number of elements in the list */ + int main(int argc, char *argv[]) { @@ -152,9 +155,9 @@ main(int argc, char *argv[]) obsolete(&argc, &argv); #ifdef KERBEROS -#define optstring "0123456789aB:b:cd:f:h:kL:Mns:ST:uWw" +#define optstring "0123456789aB:b:cd:e:f:h:kL:Mns:ST:uWw" #else -#define optstring "0123456789aB:b:cd:f:h:L:Mns:ST:uWw" +#define optstring "0123456789aB:b:cd:e:f:h:L:Mns:ST:uWw" #endif while ((ch = getopt(argc, argv, optstring)) != -1) #undef optstring @@ -194,6 +197,14 @@ main(int argc, char *argv[]) if (density >= 625 && !bflag) ntrec = HIGHDENSITYTREC; break; + + /* 04-Feb-00 ILC */ + case 'e': /* exclude an inode */ + iexclude_list[iexclude_num++] = + numarg("inode to exclude",0L,0L); + msg("Added %d to exclude list\n", + iexclude_list[iexclude_num-1]); + break; case 'f': /* output file */ tapeprefix = optarg; @@ -695,7 +706,7 @@ usage(void) "k" #endif "MnSu] [-B records] [-b blocksize] [-d density]\n" - "\t%s [-f file] [-h level] [-s feet] [-T date] filesystem\n" + "\t%s [-e inode#] [-f file] [-h level] [-s feet] [-T date] filesystem\n" "\t%s [-W | -w]\n", __progname, white, __progname); exit(X_STARTUP); } diff --git a/dump/traverse.c b/dump/traverse.c index f149b12..ed52904 100644 --- a/dump/traverse.c +++ b/dump/traverse.c @@ -40,7 +40,7 @@ #ifndef lint static const char rcsid[] = - "$Id: traverse.c,v 1.14 2000/01/21 10:17:41 stelian Exp $"; + "$Id: traverse.c,v 1.15 2000/02/04 20:22:21 stelian Exp $"; #endif /* not lint */ #include @@ -190,6 +190,9 @@ blockest(struct dinode *dp) #define WANTTODUMP(dp) CHANGEDSINCE(dp, spcl.c_ddate) #endif +extern ino_t iexclude_list[IEXCLUDE_MAXNUM]; /* the inode exclude list */ +extern int iexclude_num; /* number of elements in the list */ + /* * Determine if given inode should be dumped */ @@ -217,6 +220,18 @@ mapfileino(ino_t ino, long *tapesize, int *dirskipped) * to the usedinomap. */ SETINO(ino, usedinomap); + + /* 04-Feb-00 ILC */ + if(iexclude_num) { /* if there are inodes in the exclude list */ + int idx; /* then check this inode against it */ + for (idx=0; idx