add FOUND return status for routines called from dirscan
SCCS-vsn: sbin/fsck/dir.c 5.3
SCCS-vsn: sbin/fsck/fsck.h 5.2
SCCS-vsn: sbin/fsck/inode.c 5.3
SCCS-vsn: sbin/fsck/pass3.c 5.2
SCCS-vsn: sbin/fsck/utilities.c 5.3
-static char sccsid[] = "@(#)dir.c 5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)dir.c 5.3 (Berkeley) %G%";
#endif not lint
#include <sys/param.h>
#endif not lint
#include <sys/param.h>
curino.id_parent = parentino->id_number;
curino.id_number = inumber;
(void)ckinode(dp, &curino);
curino.id_parent = parentino->id_number;
curino.id_number = inumber;
(void)ckinode(dp, &curino);
+ if (curino.id_entryno < 2) {
+ direrr(inumber, "NULL DIRECTORY");
+ if (reply("REMOVE") == 1)
+ statemap[inumber] = DCLEAR;
+ }
idesc->id_dirp = (DIRECT *)dbuf;
if ((n = (*idesc->id_func)(idesc)) & ALTERED) {
getblk(&fileblk, idesc->id_blkno, blksiz);
idesc->id_dirp = (DIRECT *)dbuf;
if ((n = (*idesc->id_func)(idesc)) & ALTERED) {
getblk(&fileblk, idesc->id_blkno, blksiz);
- if (fileblk.b_errs != NULL) {
- n &= ~ALTERED;
- } else {
- bcopy(dbuf, (char *)dp, dsize);
- dirty(&fileblk);
- sbdirty();
- }
+ bcopy(dbuf, (char *)dp, dsize);
+ dirty(&fileblk);
+ sbdirty();
}
if (n & STOP)
return (n);
}
if (n & STOP)
return (n);
blksiz = idesc->id_numfrags * sblock.fs_fsize;
getblk(&fileblk, idesc->id_blkno, blksiz);
blksiz = idesc->id_numfrags * sblock.fs_fsize;
getblk(&fileblk, idesc->id_blkno, blksiz);
- if (fileblk.b_errs != NULL) {
- idesc->id_filesize -= blksiz - idesc->id_loc;
- return NULL;
- }
if (idesc->id_loc % DIRBLKSIZ == 0 && idesc->id_filesize > 0 &&
idesc->id_loc < blksiz) {
dp = (DIRECT *)(dirblk.b_buf + idesc->id_loc);
if (idesc->id_loc % DIRBLKSIZ == 0 && idesc->id_filesize > 0 &&
idesc->id_loc < blksiz) {
dp = (DIRECT *)(dirblk.b_buf + idesc->id_loc);
idesc.id_type = DATA;
idesc.id_func = findino;
idesc.id_number = ROOTINO;
idesc.id_type = DATA;
idesc.id_func = findino;
idesc.id_number = ROOTINO;
- (void)ckinode(dp, &idesc);
- if (idesc.id_parent >= ROOTINO && idesc.id_parent < imax) {
+ if ((ckinode(dp, &idesc) & FOUND) != 0) {
lfdir = idesc.id_parent;
} else {
pwarn("NO lost+found DIRECTORY");
lfdir = idesc.id_parent;
} else {
pwarn("NO lost+found DIRECTORY");
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)fsck.h 5.1 (Berkeley) %G%
+ * @(#)fsck.h 5.2 (Berkeley) %G%
*/
#define MAXDUP 10 /* limit on dup blks (per inode) */
*/
#define MAXDUP 10 /* limit on dup blks (per inode) */
#define getbmap(x) isset(blockmap, x)
#define clrbmap(x) clrbit(blockmap, x)
#define getbmap(x) isset(blockmap, x)
#define clrbmap(x) clrbit(blockmap, x)
#define ALTERED 010
#define KEEPON 04
#define SKIP 02
#define ALTERED 010
#define KEEPON 04
#define SKIP 02
-static char sccsid[] = "@(#)inode.c 5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)inode.c 5.3 (Berkeley) %G%";
#endif not lint
#include <pwd.h>
#endif not lint
#include <pwd.h>
return (SKIP);
initbarea(&ib);
getblk(&ib, idesc->id_blkno, sblock.fs_bsize);
return (SKIP);
initbarea(&ib);
getblk(&ib, idesc->id_blkno, sblock.fs_bsize);
- if (ib.b_errs != NULL)
- return (SKIP);
ilevel--;
for (sizepb = sblock.fs_bsize, i = 0; i < ilevel; i++)
sizepb *= NINDIR(&sblock);
ilevel--;
for (sizepb = sblock.fs_bsize, i = 0; i < ilevel; i++)
sizepb *= NINDIR(&sblock);
if (dirp->d_ino != idesc->id_parent)
return (KEEPON);
bcopy(dirp->d_name, idesc->id_name, dirp->d_namlen + 1);
if (dirp->d_ino != idesc->id_parent)
return (KEEPON);
bcopy(dirp->d_name, idesc->id_name, dirp->d_namlen + 1);
if (strcmp(dirp->d_name, idesc->id_name) == 0 &&
dirp->d_ino >= ROOTINO && dirp->d_ino <= imax) {
idesc->id_parent = dirp->d_ino;
if (strcmp(dirp->d_name, idesc->id_name) == 0 &&
dirp->d_ino >= ROOTINO && dirp->d_ino <= imax) {
idesc->id_parent = dirp->d_ino;
-static char sccsid[] = "@(#)pass3.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)pass3.c 5.2 (Berkeley) %G%";
#endif not lint
#include <sys/param.h>
#endif not lint
#include <sys/param.h>
dp = ginode(orphan);
idesc.id_parent = 0;
idesc.id_number = orphan;
dp = ginode(orphan);
idesc.id_parent = 0;
idesc.id_number = orphan;
- (void)ckinode(dp, &idesc);
- if (idesc.id_parent == 0)
+ if ((ckinode(dp, &idesc) & FOUND) == 0)
break;
if (loopcnt >= sblock.fs_cstotal.cs_ndir)
break;
break;
if (loopcnt >= sblock.fs_cstotal.cs_ndir)
break;
-static char sccsid[] = "@(#)utilities.c 5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)utilities.c 5.3 (Berkeley) %G%";
#endif not lint
#include <stdio.h>
#endif not lint
#include <stdio.h>
bzero(&idesc, sizeof(struct inodesc));
idesc.id_type = DATA;
cp = &namebuf[BUFSIZ - 1];
bzero(&idesc, sizeof(struct inodesc));
idesc.id_type = DATA;
cp = &namebuf[BUFSIZ - 1];
if (curdir != ino) {
idesc.id_parent = curdir;
goto namelookup;
if (curdir != ino) {
idesc.id_parent = curdir;
goto namelookup;
idesc.id_number = ino;
idesc.id_func = findino;
idesc.id_name = "..";
idesc.id_number = ino;
idesc.id_func = findino;
idesc.id_name = "..";
- if ((ckinode(ginode(ino), &idesc) & STOP) == 0)
+ if ((ckinode(ginode(ino), &idesc) & FOUND) == 0)
break;
namelookup:
idesc.id_number = idesc.id_parent;
idesc.id_parent = ino;
idesc.id_func = findname;
idesc.id_name = namebuf;
break;
namelookup:
idesc.id_number = idesc.id_parent;
idesc.id_parent = ino;
idesc.id_func = findname;
idesc.id_name = namebuf;
- if ((ckinode(ginode(idesc.id_number), &idesc) & STOP) == 0)
+ if ((ckinode(ginode(idesc.id_number), &idesc) & FOUND) == 0)
break;
len = strlen(namebuf);
cp -= len;
break;
len = strlen(namebuf);
cp -= len;