Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/sbin/restore Pull up revisions 1.40-1.41 (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/f36d41ad8faa
branches:  netbsd-1-4
changeset: 471005:f36d41ad8faa
user:      he <he%NetBSD.org@localhost>
date:      Wed Oct 11 18:49:10 2000 +0000

description:
Pull up revisions 1.40-1.41 (requested by enami):
  Make restore correctly handle large dumps with large inode maps.
  Fixes PR#11188.

diffstat:

 sbin/restore/tape.c |  38 +++++++++++++++++++++++++++++---------
 1 files changed, 29 insertions(+), 9 deletions(-)

diffs (83 lines):

diff -r fed85c196270 -r f36d41ad8faa sbin/restore/tape.c
--- a/sbin/restore/tape.c       Wed Oct 11 18:45:16 2000 +0000
+++ b/sbin/restore/tape.c       Wed Oct 11 18:49:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tape.c,v 1.38.2.1 2000/01/31 19:46:54 he Exp $ */
+/*     $NetBSD: tape.c,v 1.38.2.2 2000/10/11 18:49:10 he Exp $ */
 
 /*
  * Copyright (c) 1983, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)tape.c     8.9 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: tape.c,v 1.38.2.1 2000/01/31 19:46:54 he Exp $");
+__RCSID("$NetBSD: tape.c,v 1.38.2.2 2000/10/11 18:49:10 he Exp $");
 #endif
 #endif /* not lint */
 
@@ -701,7 +701,8 @@
        gettingfile++;
 loop:
        for (i = 0; i < spcl.c_count; i++) {
-               if (spcl.c_addr[i]) {
+               if (spcl.c_type == TS_BITS || spcl.c_type == TS_CLRI ||
+                   spcl.c_addr[i]) {
                        readtape(&buf[curblk++][0]);
                        if (curblk == fssize / TP_BSIZE) {
                                (*fill)((char *)buf, (long)(size > TP_BSIZE ?
@@ -719,9 +720,21 @@
                                TP_BSIZE : size));
                }
                if ((size -= TP_BSIZE) <= 0) {
-                       for (i++; i < spcl.c_count; i++)
-                               if (spcl.c_addr[i])
-                                       readtape(junk);
+                       if (spcl.c_type == TS_BITS || spcl.c_type == TS_CLRI) {
+                               /*
+                                * In this case, the following expression
+                                * should always be false since the size was
+                                * initially set to spcl.c_dinode.di_size and
+                                * it is initialized to spcl.c_count * TP_BSIZE
+                                * in gethead().
+                                */
+                               if (!(size == 0 && i == spcl.c_count - 1))
+                                       panic("inconsistent map size\n");
+                       } else {
+                               for (i++; i < spcl.c_count; i++)
+                                       if (spcl.c_addr[i])
+                                               readtape(junk);
+                       }
                        break;
                }
        }
@@ -1126,8 +1139,6 @@
                 */
                buf->c_inumber = 0;
                buf->c_dinode.di_size = buf->c_count * TP_BSIZE;
-               for (i = 0; i < buf->c_count; i++)
-                       buf->c_addr[i]++;
                break;
 
        case TS_TAPE:
@@ -1206,10 +1217,19 @@
        fprintf(stderr, "\n");
 newcalc:
        blks = 0;
-       if (header->c_type != TS_END)
+       switch (header->c_type) {
+       case TS_END:
+               break;
+       case TS_CLRI:
+       case TS_BITS:
+               blks = header->c_count;
+               break;
+       default:
                for (i = 0; i < header->c_count; i++)
                        if (header->c_addr[i] != 0)
                                blks++;
+               break;
+       }
        predict = blks;
        blksread = 0;
        prevtype = header->c_type;



Home | Main Index | Thread Index | Old Index