Deleted Added
full compact
pass2.c (331722) pass2.c (344887)
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[] = "@(#)pass2.c 8.9 (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[] = "@(#)pass2.c 8.9 (Berkeley) 4/28/95";
33#endif /* not lint */
34#endif
35#include <sys/cdefs.h>
36__FBSDID("$FreeBSD: stable/11/sbin/fsck_ffs/pass2.c 331722 2018-03-29 02:50:57Z eadler $");
36__FBSDID("$FreeBSD: stable/11/sbin/fsck_ffs/pass2.c 344887 2019-03-07 13:53:59Z kib $");
37
38#include <sys/param.h>
39#include <sys/sysctl.h>
40
41#include <ufs/ufs/dinode.h>
42#include <ufs/ufs/dir.h>
43#include <ufs/ffs/fs.h>
44

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

105 }
106 if (reply("FIX") == 0) {
107 ckfini(0);
108 exit(EEXIT);
109 }
110 dp = ginode(ROOTINO);
111 DIP_SET(dp, di_mode, DIP(dp, di_mode) & ~IFMT);
112 DIP_SET(dp, di_mode, DIP(dp, di_mode) | IFDIR);
37
38#include <sys/param.h>
39#include <sys/sysctl.h>
40
41#include <ufs/ufs/dinode.h>
42#include <ufs/ufs/dir.h>
43#include <ufs/ffs/fs.h>
44

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

105 }
106 if (reply("FIX") == 0) {
107 ckfini(0);
108 exit(EEXIT);
109 }
110 dp = ginode(ROOTINO);
111 DIP_SET(dp, di_mode, DIP(dp, di_mode) & ~IFMT);
112 DIP_SET(dp, di_mode, DIP(dp, di_mode) | IFDIR);
113 inodirty();
113 inodirty(dp);
114 break;
115
116 case DSTATE:
117 case DZLINK:
118 break;
119
120 default:
121 errx(EEXIT, "BAD STATE %d FOR ROOT INODE",

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

151 if (inp->i_isize == 0)
152 continue;
153 if (inp->i_isize < MINDIRSIZE) {
154 direrror(inp->i_number, "DIRECTORY TOO SHORT");
155 inp->i_isize = roundup(MINDIRSIZE, DIRBLKSIZ);
156 if (reply("FIX") == 1) {
157 dp = ginode(inp->i_number);
158 DIP_SET(dp, di_size, inp->i_isize);
114 break;
115
116 case DSTATE:
117 case DZLINK:
118 break;
119
120 default:
121 errx(EEXIT, "BAD STATE %d FOR ROOT INODE",

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

151 if (inp->i_isize == 0)
152 continue;
153 if (inp->i_isize < MINDIRSIZE) {
154 direrror(inp->i_number, "DIRECTORY TOO SHORT");
155 inp->i_isize = roundup(MINDIRSIZE, DIRBLKSIZ);
156 if (reply("FIX") == 1) {
157 dp = ginode(inp->i_number);
158 DIP_SET(dp, di_size, inp->i_isize);
159 inodirty();
159 inodirty(dp);
160 }
161 } else if ((inp->i_isize & (DIRBLKSIZ - 1)) != 0) {
162 getpathname(pathbuf, inp->i_number, inp->i_number);
163 if (usedsoftdep)
164 pfatal("%s %s: LENGTH %jd NOT MULTIPLE OF %d",
165 "DIRECTORY", pathbuf,
166 (intmax_t)inp->i_isize, DIRBLKSIZ);
167 else
168 pwarn("%s %s: LENGTH %jd NOT MULTIPLE OF %d",
169 "DIRECTORY", pathbuf,
170 (intmax_t)inp->i_isize, DIRBLKSIZ);
171 if (preen)
172 printf(" (ADJUSTED)\n");
173 inp->i_isize = roundup(inp->i_isize, DIRBLKSIZ);
174 if (preen || reply("ADJUST") == 1) {
175 dp = ginode(inp->i_number);
176 DIP_SET(dp, di_size,
177 roundup(inp->i_isize, DIRBLKSIZ));
160 }
161 } else if ((inp->i_isize & (DIRBLKSIZ - 1)) != 0) {
162 getpathname(pathbuf, inp->i_number, inp->i_number);
163 if (usedsoftdep)
164 pfatal("%s %s: LENGTH %jd NOT MULTIPLE OF %d",
165 "DIRECTORY", pathbuf,
166 (intmax_t)inp->i_isize, DIRBLKSIZ);
167 else
168 pwarn("%s %s: LENGTH %jd NOT MULTIPLE OF %d",
169 "DIRECTORY", pathbuf,
170 (intmax_t)inp->i_isize, DIRBLKSIZ);
171 if (preen)
172 printf(" (ADJUSTED)\n");
173 inp->i_isize = roundup(inp->i_isize, DIRBLKSIZ);
174 if (preen || reply("ADJUST") == 1) {
175 dp = ginode(inp->i_number);
176 DIP_SET(dp, di_size,
177 roundup(inp->i_isize, DIRBLKSIZ));
178 inodirty();
178 inodirty(dp);
179 }
180 }
181 dp = &dino;
182 memset(dp, 0, sizeof(struct ufs2_dinode));
183 DIP_SET(dp, di_mode, IFDIR);
184 DIP_SET(dp, di_size, inp->i_isize);
185 for (i = 0; i < MIN(inp->i_numblks, NDADDR); i++)
186 DIP_SET(dp, di_db[i], inp->i_blks[i]);

--- 480 unchanged lines hidden ---
179 }
180 }
181 dp = &dino;
182 memset(dp, 0, sizeof(struct ufs2_dinode));
183 DIP_SET(dp, di_mode, IFDIR);
184 DIP_SET(dp, di_size, inp->i_isize);
185 for (i = 0; i < MIN(inp->i_numblks, NDADDR); i++)
186 DIP_SET(dp, di_db[i], inp->i_blks[i]);

--- 480 unchanged lines hidden ---