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[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95"; 33#endif /* not lint */ 34#endif 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sbin/fsck_ffs/inode.c 241012 2012-09-27 23:30:58Z mdf $"); |
37 38#include <sys/param.h> 39#include <sys/stdint.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> --- 235 unchanged lines hidden (view full) --- 280 * General purpose interface for reading inodes. 281 */ 282union dinode * 283ginode(ino_t inumber) 284{ 285 ufs2_daddr_t iblk; 286 287 if (inumber < ROOTINO || inumber > maxino) |
288 errx(EEXIT, "bad inode number %ju to ginode", 289 (uintmax_t)inumber); |
290 if (startinum == 0 || 291 inumber < startinum || inumber >= startinum + INOPB(&sblock)) { 292 iblk = ino_to_fsba(&sblock, inumber); 293 if (pbp != 0) 294 pbp->b_flags &= ~B_INUSE; 295 pbp = getdatablk(iblk, sblock.fs_bsize); 296 startinum = (inumber / INOPB(&sblock)) * INOPB(&sblock); 297 } --- 17 unchanged lines hidden (view full) --- 315 int j; 316 long size; 317 mode_t mode; 318 ufs2_daddr_t ndb, dblk; 319 union dinode *dp; 320 static caddr_t nextinop; 321 322 if (inumber != nextino++ || inumber > lastvalidinum) |
323 errx(EEXIT, "bad inode number %ju to nextinode", 324 (uintmax_t)inumber); |
325 if (inumber >= lastinum) { 326 readcnt++; 327 dblk = fsbtodb(&sblock, ino_to_fsba(&sblock, lastinum)); 328 if (readcnt % readpercg == 0) { 329 size = partialsize; 330 lastinum += partialcnt; 331 } else { 332 size = inobufsize; --- 62 unchanged lines hidden (view full) --- 395 return (dp); 396} 397 398void 399setinodebuf(ino_t inum) 400{ 401 402 if (inum % sblock.fs_ipg != 0) |
403 errx(EEXIT, "bad inode number %ju to setinodebuf", 404 (uintmax_t)inum); |
405 lastvalidinum = inum + sblock.fs_ipg - 1; 406 startinum = 0; 407 nextino = inum; 408 lastinum = inum; 409 readcnt = 0; 410 if (inodebuf != NULL) 411 return; 412 inobufsize = blkroundup(&sblock, INOBUFSIZE); --- 74 unchanged lines hidden (view full) --- 487{ 488 struct inoinfo *inp; 489 490 for (inp = inphead[inumber % dirhash]; inp; inp = inp->i_nexthash) { 491 if (inp->i_number != inumber) 492 continue; 493 return (inp); 494 } |
495 errx(EEXIT, "cannot find inode %ju", (uintmax_t)inumber); |
496 return ((struct inoinfo *)0); 497} 498 499/* 500 * Clean up all the inode cache structure. 501 */ 502void 503inocleanup(void) --- 228 unchanged lines hidden --- |