Deleted Added
full compact
inode.c (221110) inode.c (241012)
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>
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 221110 2011-04-27 02:55:03Z des $");
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)
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 %d to ginode", inumber);
288 errx(EEXIT, "bad inode number %ju to ginode",
289 (uintmax_t)inumber);
289 if (startinum == 0 ||
290 inumber < startinum || inumber >= startinum + INOPB(&sblock)) {
291 iblk = ino_to_fsba(&sblock, inumber);
292 if (pbp != 0)
293 pbp->b_flags &= ~B_INUSE;
294 pbp = getdatablk(iblk, sblock.fs_bsize);
295 startinum = (inumber / INOPB(&sblock)) * INOPB(&sblock);
296 }

--- 17 unchanged lines hidden (view full) ---

314 int j;
315 long size;
316 mode_t mode;
317 ufs2_daddr_t ndb, dblk;
318 union dinode *dp;
319 static caddr_t nextinop;
320
321 if (inumber != nextino++ || inumber > lastvalidinum)
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)
322 errx(EEXIT, "bad inode number %d to nextinode", inumber);
323 errx(EEXIT, "bad inode number %ju to nextinode",
324 (uintmax_t)inumber);
323 if (inumber >= lastinum) {
324 readcnt++;
325 dblk = fsbtodb(&sblock, ino_to_fsba(&sblock, lastinum));
326 if (readcnt % readpercg == 0) {
327 size = partialsize;
328 lastinum += partialcnt;
329 } else {
330 size = inobufsize;

--- 62 unchanged lines hidden (view full) ---

393 return (dp);
394}
395
396void
397setinodebuf(ino_t inum)
398{
399
400 if (inum % sblock.fs_ipg != 0)
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)
401 errx(EEXIT, "bad inode number %d to setinodebuf", inum);
403 errx(EEXIT, "bad inode number %ju to setinodebuf",
404 (uintmax_t)inum);
402 lastvalidinum = inum + sblock.fs_ipg - 1;
403 startinum = 0;
404 nextino = inum;
405 lastinum = inum;
406 readcnt = 0;
407 if (inodebuf != NULL)
408 return;
409 inobufsize = blkroundup(&sblock, INOBUFSIZE);

--- 74 unchanged lines hidden (view full) ---

484{
485 struct inoinfo *inp;
486
487 for (inp = inphead[inumber % dirhash]; inp; inp = inp->i_nexthash) {
488 if (inp->i_number != inumber)
489 continue;
490 return (inp);
491 }
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 }
492 errx(EEXIT, "cannot find inode %d", inumber);
495 errx(EEXIT, "cannot find inode %ju", (uintmax_t)inumber);
493 return ((struct inoinfo *)0);
494}
495
496/*
497 * Clean up all the inode cache structure.
498 */
499void
500inocleanup(void)

--- 228 unchanged lines hidden ---
496 return ((struct inoinfo *)0);
497}
498
499/*
500 * Clean up all the inode cache structure.
501 */
502void
503inocleanup(void)

--- 228 unchanged lines hidden ---