[comp.os.minix] BADBLOCKS 1.5 FIX

ssharkey@magnus.ircc.ohio-state.edu (Scott A Sharkey) (02/19/91)

Enclosed are my changes to badblocks (std PH 1.5 distribution) to correct
problems handling bad blocks >8191.  These changes are essentially the
same as what Andy just posted from 1.6, except that I couldn't get his
version to compile (probably all the posixification and V2 file system
changes).  Anyway, this works, and so should Andy's version.  I verified 
with both de and fsck, on a disk which had 24 bad spots, above and below
the 8K mark.  

-Scott


*** badblocks.org	Sun Feb 17 18:11:50 1991
--- badblocks.c	Mon Feb 18 12:19:39 1991
***************
*** 465,475 ****
    unsigned z_num;
    char wrd_str[17], bit_str[17];
  
!   z_num = num + 1 - sp->s_firstdatazone;
  
    block = z_num >> BIT_MAP_SHIFT;	/* which block */
    offset = z_num - (block << BIT_MAP_SHIFT);	/* offset in block */
!   words = offset / INT_BITS;	/* which word */
  
    blk_offset = (long) (2 + sp->s_imap_block);
    blk_offset *= (long) BLOCK_SIZE;
--- 465,475 ----
    unsigned z_num;
    char wrd_str[17], bit_str[17];
  
!   z_num = num - (sp->s_firstdatazone - 1);
  
    block = z_num >> BIT_MAP_SHIFT;	/* which block */
    offset = z_num - (block << BIT_MAP_SHIFT);	/* offset in block */
!   words = z_num / INT_BITS;	/* which word */
  
    blk_offset = (long) (2 + sp->s_imap_block);
    blk_offset *= (long) BLOCK_SIZE;
-- 
Scott Sharkey				A Guest of The Ohio State University
LANshark Systems			
3000 Stone Mountain Dr.			ssharkey@magnus.ircc.ohio-state.edu
Pickerington, Ohio 43147		(614) 866-5553