Patch #1 to bf

Brant Cheikes brant at manta.pha.pa.us
Wed May 24 15:08:11 AEST 1989


Peter Fales (psfales at ihlpb.att.com) found and fixed a bug in bf, the
block->inode mapping utility that I posted some months back.  Herewith
is a patch file correcting that bug and making a few other minor
source tweaks.

*** bf.c-old	Tue May 23 20:38:27 1989
--- bf.c	Wed May 24 00:54:34 1989
***************
*** 1,5
  /*
!  * bf.c 1.0
   * Search filesystem for particular blocks, returning corresponding inodes.
   *
   * Brant Cheikes

--- 1,5 -----
  /*
!  * bf.c 1.1
   * Search filesystem for particular blocks, returning corresponding inodes.
   *
   * Brant Cheikes
***************
*** 6,12
   * University of Pennsylvania, Department of Computer and Information Science
   * brant at manta.pha.pa.us, brant at linc.cis.upenn.edu, bpa!manta!brant
   *
!  * Copyright (C) 1989 Brant A. Cheikes.  All rights reserved.
   *
   * bf is distributed in the hope that it will be useful, but WITHOUT ANY
   * WARRANTY.  No author or distributor accepts responsibility to anyone

--- 6,12 -----
   * University of Pennsylvania, Department of Computer and Information Science
   * brant at manta.pha.pa.us, brant at linc.cis.upenn.edu, bpa!manta!brant
   *
!  * Copyright (c) 1989 Brant A. Cheikes.  All rights reserved.
   *
   * bf is distributed in the hope that it will be useful, but WITHOUT ANY
   * WARRANTY.  No author or distributor accepts responsibility to anyone
***************
*** 17,22
   * but only under the conditions described in the GNU General Public License.
   * Among other things, the copyright notice and this notice must be preserved
   * on all copies.
   */
  
  #define KERNEL

--- 17,29 -----
   * but only under the conditions described in the GNU General Public License.
   * Among other things, the copyright notice and this notice must be preserved
   * on all copies.
+  *
+  * Modification History:
+  *  1.1		Tue May 23 20:40:03 EDT 1989
+  *	Peter Fales (att!ihlpb!psfales, psfales at ihlpb.att.com)
+  *	reported a bug in which the first three blocks in the
+  *	filesystem were incorrectly treated as part of the i-list.
+  *	Some other minor fixups too, while I'm at it.
   */
  
  #define KERNEL
***************
*** 98,104
      } else if (blk == 1) {
        (void) puts("block 1 reserved");
        --nblk;
!     } else if (blk < superblk.s_isize+3) {
        (void) printf("block %ld in i-list\n",blk);
        --nblk;
      } else if (blk > superblk.s_fsize) {

--- 105,111 -----
      } else if (blk == 1) {
        (void) puts("block 1 reserved");
        --nblk;
!     } else if (blk < superblk.s_isize) {
        (void) printf("block %ld in i-list\n",blk);
        --nblk;
      } else if (blk > superblk.s_fsize) {
***************
*** 102,108
        (void) printf("block %ld in i-list\n",blk);
        --nblk;
      } else if (blk > superblk.s_fsize) {
!       (void) printf("block %ld outside fs\n",blk);
        --nblk;
      } else
        /*

--- 109,115 -----
        (void) printf("block %ld in i-list\n",blk);
        --nblk;
      } else if (blk > superblk.s_fsize) {
!       (void) printf("block %ld outside file system\n",blk);
        --nblk;
      } else
        /*
***************
*** 112,118
    }
  
    /*
!    * Verify that we still have blocks to look for.
     */
    if (nblk == 0)
      barf("feh! no blocks",0);

--- 119,125 -----
    }
  
    /*
!    * Look for all blocks that remain.
     */
    if (nblk)
      (void) done(scan_ilist(fsdev,&superblk,nblk,bitmap));
***************
*** 114,126
    /*
     * Verify that we still have blocks to look for.
     */
!   if (nblk == 0)
!     barf("feh! no blocks",0);
! 
!   /*
!    * Scan the allocated block list.
!    */
!   (void) done(scan_ilist(fsdev,&superblk,nblk,bitmap));
  }
  
  /*

--- 121,128 -----
    /*
     * Look for all blocks that remain.
     */
!   if (nblk)
!     (void) done(scan_ilist(fsdev,&superblk,nblk,bitmap));
  }
  
  /*
***************
*** 340,346
    if (s > 0)
      (void) perror(msg);
    else
!     (void) fprintf(stderr,"%s\n",msg);
    done(s);
  }
  

--- 342,348 -----
    if (s > 0)
      (void) perror(msg);
    else
!     (void) fprintf(stderr,"internal error: %s\n",msg);
    done(s);
  }
  
-- 
Brant Cheikes
University of Pennsylvania, Department of Computer and Information Science
brant at manta.pha.pa.us, brant at linc.cis.upenn.edu, bpa!manta!brant



More information about the Comp.sys.att mailing list