]> git.wh0rd.org - dump.git/commitdiff
Added -e exclude inode option to dump.
authorStelian Pop <stelian@popies.net>
Fri, 4 Feb 2000 20:22:21 +0000 (20:22 +0000)
committerStelian Pop <stelian@popies.net>
Fri, 4 Feb 2000 20:22:21 +0000 (20:22 +0000)
CHANGES
THANKS
dump/dump.8.in
dump/dump.h
dump/main.c
dump/traverse.c

diff --git a/CHANGES b/CHANGES
index d86fccbc4575139b6ef2a9071ab41ef2a09711aa..fc249e1ecf062b9a9a84233fc5233137611183d3 100644 (file)
--- 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 <ike@isl.stanford.edu> for contributing with the patch.
+
 Changes between versions 0.4b12 and 0.4b13 (released January 21, 2000)
 ======================================================================
 
diff --git a/THANKS b/THANKS
index b599c8a7e2007e2fa921ce2ce2dc5b4ae5316285..c29886252afba66b06bc992be100bd36491cdf5b 100644 (file)
--- 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
index 05d53ddb5cbb8016c4fde829c719de33af76b5ae..469ff1b3b82282e9ee299bf827d25f72d957ff9e 100644 (file)
@@ -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
index 7b66e05a8eaf8bf2731939f144b39e4323395d66..23331ff8dd66c6ba950414c3b947f86c7cd266bc 100644 (file)
@@ -4,7 +4,7 @@
  *     Remy Card <card@Linux.EU.Org>, 1994-1997
  *     Stelian Pop <pop@cybercable.fr>, 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 */
+
index f5fd9893b875bb818bf95d95ac4dd2a9e06379ec..806de5efe278b990f2844d9f994f9b39d02b7cb1 100644 (file)
@@ -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 <sys/param.h>
@@ -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);
 }
index f149b120b13555d31245e7fc9f09ea61d94cde84..ed52904ffe6dd150c35ac0e20a438fc4c367272d 100644 (file)
@@ -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 <sys/param.h>
@@ -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<iexclude_num; idx++) {
+                       if (ino == iexclude_list[idx]) {
+                               msg("Excluding inode number %d\n", ino);
+                               return; /* if in list then skip */
+                       }
+               }
+       }
+
        if (mode == IFDIR)
                SETINO(ino, dumpdirmap);
        if (WANTTODUMP(dp)) {