1/* 2 * Copyright (c) 1980, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 19 unchanged lines hidden (view full) --- 28 */ 29 30#if 0 31#ifndef lint 32static const char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95"; 33#endif /* not lint */ 34#endif 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sbin/fsck_ffs/pass1.c 136281 2004-10-08 20:44:47Z truckman $"); |
37 38#include <sys/param.h> 39#include <sys/stat.h> 40#include <sys/sysctl.h> 41 42#include <ufs/ufs/dinode.h> 43#include <ufs/ufs/dir.h> 44#include <ufs/ffs/fs.h> --- 139 unchanged lines hidden (view full) --- 184 } 185 freeinodebuf(); 186} 187 188static void 189checkinode(ino_t inumber, struct inodesc *idesc) 190{ 191 union dinode *dp; |
192 off_t kernmaxfilesize; 193 ufs2_daddr_t ndb; 194 mode_t mode; 195 int j, ret, offset; 196 197 dp = getnextinode(inumber); 198 mode = DIP(dp, di_mode) & IFMT; 199 if (mode == 0) { --- 96 unchanged lines hidden (view full) --- 296 printf("bad indirect addr: %ju\n", 297 (uintmax_t)DIP(dp, di_ib[j])); 298 goto unknown; 299 } 300 if (ftypeok(dp) == 0) 301 goto unknown; 302 n_files++; 303 inoinfo(inumber)->ino_linkcnt = DIP(dp, di_nlink); |
304 if (mode == IFDIR) { 305 if (DIP(dp, di_size) == 0) 306 inoinfo(inumber)->ino_state = DCLEAR; |
307 else if (DIP(dp, di_nlink) <= 0) 308 inoinfo(inumber)->ino_state = DZLINK; |
309 else 310 inoinfo(inumber)->ino_state = DSTATE; 311 cacheino(dp, inumber); 312 countdirs++; |
313 } else if (DIP(dp, di_nlink) <= 0) 314 inoinfo(inumber)->ino_state = FZLINK; 315 else |
316 inoinfo(inumber)->ino_state = FSTATE; 317 inoinfo(inumber)->ino_type = IFTODT(mode); 318 badblk = dupblk = 0; 319 idesc->id_number = inumber; 320 if (DIP(dp, di_flags) & SF_SNAPSHOT) 321 idesc->id_type = SNAP; 322 else 323 idesc->id_type = ADDR; --- 144 unchanged lines hidden --- |