Deleted Added
sdiff udiff text old ( 100935 ) new ( 101037 )
full compact
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

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

31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35#if 0
36static const char sccsid[] = "@(#)pass2.c 8.9 (Berkeley) 4/28/95";
37#endif
38static const char rcsid[] =
39 "$FreeBSD: head/sbin/fsck_ffs/pass2.c 100935 2002-07-30 13:01:25Z phk $";
40#endif /* not lint */
41
42#include <sys/param.h>
43
44#include <ufs/ufs/dinode.h>
45#include <ufs/ufs/dir.h>
46#include <ufs/ffs/fs.h>
47
48#include <err.h>
49#include <string.h>
50
51#include "fsck.h"
52
53#define MINDIRSIZE (sizeof (struct dirtemplate))
54
55static int blksort(const void *, const void *);
56static int pass2check(struct inodesc *);

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

129 * Check the integrity of each directory.
130 */
131 memset(&curino, 0, sizeof(struct inodesc));
132 curino.id_type = DATA;
133 curino.id_func = pass2check;
134 inpend = &inpsort[inplast];
135 for (inpp = inpsort; inpp < inpend; inpp++) {
136 if (got_siginfo) {
137 printf("%s: phase 2: dir %d of %d (%d%%)\n", cdevname,
138 inpp - inpsort, (int)inplast,
139 (int)((inpp - inpsort) * 100 / inplast));
140 got_siginfo = 0;
141 }
142 inp = *inpp;
143 if (inp->i_isize == 0)
144 continue;
145 if (inp->i_isize < MINDIRSIZE) {
146 direrror(inp->i_number, "DIRECTORY TOO SHORT");
147 inp->i_isize = roundup(MINDIRSIZE, DIRBLKSIZ);
148 if (reply("FIX") == 1) {
149 dp = ginode(inp->i_number);
150 DIP(dp, di_size) = inp->i_isize;
151 inodirty();
152 }
153 } else if ((inp->i_isize & (DIRBLKSIZ - 1)) != 0) {
154 getpathname(pathbuf, inp->i_number, inp->i_number);
155 if (usedsoftdep)
156 pfatal("%s %s: LENGTH %d NOT MULTIPLE OF %d",
157 "DIRECTORY", pathbuf, inp->i_isize,
158 DIRBLKSIZ);
159 else
160 pwarn("%s %s: LENGTH %d NOT MULTIPLE OF %d",
161 "DIRECTORY", pathbuf, inp->i_isize,
162 DIRBLKSIZ);
163 if (preen)
164 printf(" (ADJUSTED)\n");
165 inp->i_isize = roundup(inp->i_isize, DIRBLKSIZ);
166 if (preen || reply("ADJUST") == 1) {
167 dp = ginode(inp->i_number);
168 DIP(dp, di_size) =
169 roundup(inp->i_isize, DIRBLKSIZ);
170 inodirty();

--- 296 unchanged lines hidden ---