Useful switch for 5.[02] ncheck
James Macropol
jm at wlbr.UUCP
Fri Aug 30 04:15:18 AEST 1985
The following are some useful diffs for the ncheck(1m) utility of
System 5.0 and 5.2. These add a "-b" switch, which functions similarly
to the existing "-i" switch, except that the names of files whose
block numbers match the given list will be printed. This is useful
to determine, for example, which file contains a newly discovered bad
block (fun :-( )
I'm sorry that licensing restrictions do not allow a more complete posting.
The following files are included:
man.5.0.diff Diff format changes to the 5.0 version of ncheck.1m
man.5.2.diff Diff format changes to the 5.2 version of ncheck.1m
ncheck.c.diff Diff format changes to both 5.0 and 5.2 versions of
ncheck.c
Jim Macropol
{ihnp4,trwrb,voder,scgvaxd,vortex}!wlbr!jm
------------- Cut Here ------------------------------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# man.5.0.diff
# man.5.2.diff
# ncheck.c.diff
# This archive created: Thu Aug 29 11:02:23 1985
export PATH; PATH=/bin:$PATH
if test -f 'man.5.0.diff'
then
echo shar: will not over-write existing file "'man.5.0.diff'"
else
cat << \SHAR_EOF > 'man.5.0.diff'
8a9,10
> .B \-b
> numbers ] [
23a26,28
> The
> .B \-b
> option reduces the report to only those files whose block numbers follow.
SHAR_EOF
fi # end of overwriting check
if test -f 'man.5.2.diff'
then
echo shar: will not over-write existing file "'man.5.2.diff'"
else
cat << \SHAR_EOF > 'man.5.2.diff'
32a33,34
> .B \-b
> numbers ] [
47a50,52
> The
> .B \-b
> option reduces the report to only those files whose block numbers follow.
SHAR_EOF
fi # end of overwriting check
if test -f 'ncheck.c.diff'
then
echo shar: will not over-write existing file "'ncheck.c.diff'"
else
cat << \SHAR_EOF > 'ncheck.c.diff'
50a51,52
> daddr_t blist[NB];
> int nxblk;
103a106,117
> case 'b':
> for(i=nxblk; i<NB; i++) {
> n = atol(argv[1]);
> if(n == 0)
> break;
> blist[i] = n;
> argv++;
> argc--;
> }
> nxblk = i;
> continue;
>
207a222,275
> chk0(ip)
> register struct dinode *ip;
> {
> register i;
>
> if ((ip->di_mode&IFMT)!=IFDIR && (ip->di_mode&IFMT)!=IFREG)
> return;
> l3tol(iaddr, ip->di_addr, NADDR);
> for (i=0; i<NADDR-3; i++)
> if (iaddr[i])
> chk1(iaddr[i]);
> for (; i< NADDR; i++)
> if (iaddr[i])
> chk1a(i - (NADDR - 3), iaddr[i]);
> }
>
> chk1a (level, bno)
>
> int level;
> daddr_t bno;
>
> {
> daddr_t ibuf[NIDIR];
> register i;
>
> chk1(bno);
> bread(bno, (char *)ibuf, (sizeof(daddr_t) * nidir));
> for (i=0; i<nidir; i++)
> if (ibuf[i])
> if (level)
> chk1a(level - 1, ibuf[i]);
> else
> chk1(ibuf[i]);
> }
>
> chk1 (bno)
>
> daddr_t bno;
>
> {
> register i;
>
> for (i=0; i<nxblk; i++)
> if (bno == blist[i]) {
> printf("bno %d ino %d\n", bno, ino);
> if (nxfile >= NB){
> nxblk = -1;
> fprintf(stderr,"Too many special files (increase ilist array)\n");
> return;
> }
> ilist[nxfile++] = ino;
> }
> }
>
210a279,280
> if (nxblk > 0)
> chk0(ip);
301c371
< if(ilist[0] == 0 && sflg==0)
---
> if(ilist[0] == 0 && sflg==0 && nxblk==0)
SHAR_EOF
fi # end of overwriting check
# End of shell archive
exit 0
More information about the Comp.sources.unix
mailing list