Deleted Added
full compact
pass2.c (100935) pass2.c (101037)
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[] =
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 $";
39 "$FreeBSD: head/sbin/fsck_ffs/pass2.c 101037 2002-07-31 12:01:14Z mux $";
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>
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 <stdint.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) {
50#include <string.h>
51
52#include "fsck.h"
53
54#define MINDIRSIZE (sizeof (struct dirtemplate))
55
56static int blksort(const void *, const void *);
57static int pass2check(struct inodesc *);

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

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

--- 296 unchanged lines hidden ---