1 |
uberlord 07/09/15 08:54:26 |
2 |
|
3 |
Added: fsck_ext2fs.8 e2fsprogs-1.40-fbsd.patch |
4 |
fsck_ext2fs.c |
5 |
Log: |
6 |
Add the fsck_ext2fs helper and man page for FreeBSD and add a patch for 1.40.2 to work on FreeBSD. |
7 |
(Portage version: 2.1.3.9) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 sys-fs/e2fsprogs/files/fsck_ext2fs.8 |
11 |
|
12 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/e2fsprogs/files/fsck_ext2fs.8?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/e2fsprogs/files/fsck_ext2fs.8?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: fsck_ext2fs.8 |
16 |
=================================================================== |
17 |
.TH fsck_ext2fs 8 2006-07-02 "Matthias Andree" "FreeBSD Ports" |
18 |
.\" |
19 |
.\" fsck_ext2fs.8 - manual page for fsck_ext2fs wrapper |
20 |
.\" |
21 |
.\" (C) Copyright 2006 by Matthias Andree <matthias.andree@×××.de> |
22 |
.\" |
23 |
.\" License: This file may be redistributed in accordance with the terms |
24 |
.\" of the GNU General Public License v2. |
25 |
.\" |
26 |
.\" Upstream $Id: fsck_ext2fs.8,v 1.1 2007/09/15 08:54:26 uberlord Exp $ |
27 |
.\" $FreeBSD: ports/sysutils/e2fsprogs/files/fsck_ext2fs.8,v 1.1 2006/07/04 15:47:51 leeym Exp $ |
28 |
.\" |
29 |
.SH NAME |
30 |
.B fsck_ext2fs |
31 |
\- compatibility wrapper for e2fsck |
32 |
.SH SYNOPSIS |
33 |
.P |
34 |
.B fsck_ext2fs |
35 |
[\fB\-Fpfnyv\fR] [\fB\-b\fR \fIblock\fR] |
36 |
.SH DESCRIPTION |
37 |
.P |
38 |
\fBfsck_ext2fs\fR maps the traditional FreeBSD \fBfsck_ffs\fR options to |
39 |
options with the same functionality for \fBe2fsck,\fR runs \fBe2fsck\fR |
40 |
and then maps its exit status to values that FreeBSD understands. |
41 |
\fBe2fsck\fR is a utility to check and repair ext2 and ext3 file |
42 |
systems. |
43 |
|
44 |
.SH OPTIONS |
45 |
.IP \fB\-F\fR |
46 |
(check foreground mode required) Immediately exits with status 1 to tell |
47 |
\fBfsck\fR that ext2fs cannot be checked in the background. \fBfsck\fR |
48 |
usually runs \fBfsck_*\fR programs twice, first with \fB\-F\fR to find |
49 |
out if they can do background checking, then either immediately without |
50 |
\fB\-F\fR for foreground checking or deferred in the background with |
51 |
\fB\-B\fR. |
52 |
.IP \fB\-p\fR |
53 |
(preen mode) This option suppresses adding the \fB\-f\fR option (unless |
54 |
\fB\-f\fR is also given) and adds the \fB\-p\fR option to the |
55 |
\fBe2fsck\fR command line. This causes \fBe2fsck\fR to automatically fix |
56 |
any filesystem problems that can safely be fixed without operator |
57 |
intervention. Without this option given, \fBe2fsck\fR will be run with |
58 |
the \fB\-f\fR option to force a check, since interactive scan and repair |
59 |
mode is the default on FreeBSD, but not on Linux where \fBe2fsck\fR |
60 |
comes from. |
61 |
.IP \fB\-f\fR |
62 |
(force check) This option forces the check of a clean file system while |
63 |
preening and is passed to \fBe2fsck\fR verbatim. |
64 |
.IP \fB\-n\fR |
65 |
("no" mode) This option causes the file system to be opened in read-only |
66 |
mode and assume "no" as answer to all questions. This is the only way to |
67 |
safely run \fBfsck\fR on a mounted ext2 or ext3 file system. This option |
68 |
is passed to \fBe2fsck\fR verbatim. |
69 |
.IP \fB\-y\fR |
70 |
("yes" mode) This option is passed verbatim to \fBe2fsck\fR and causes |
71 |
it to assume "yes" as answer to all questions. This allows the |
72 |
non-interactive use of e2fsck but is rather aggressive. Use with care. |
73 |
.IP \fB\-v\fR |
74 |
(verbose output) This option is passed verbatim to \fBe2fsck\fR and |
75 |
causes it to verbosely report its progress. |
76 |
.IP "\fB\-b\fR \fIblock\fR" |
77 |
(use alternate super block) This option is passed verbatim to |
78 |
\fBe2fsck\fR and selects an alternate super block, for use when the |
79 |
primary super block has been damaged. Please see the \fBe2fsck\fR(8) |
80 |
manual page for details. |
81 |
|
82 |
.SH EXIT STATUS |
83 |
If errors remain after \fBe2fsck\fR, an invalid option or too many |
84 |
options have been specified, \fBe2fsck\fR was killed with a signal or |
85 |
the \fIfork\fB system call failed, \fBfsck_ext2fs\fR exits with status |
86 |
EXIT_FAILURE (usually 1). If \fBe2fsck\fR cannot be started, exits with |
87 |
status 127. If the file system is clean after \fBe2fsck\fR operation, |
88 |
exits with status EXIT_SUCCESS (0). |
89 |
|
90 |
.SH NOTES |
91 |
.P |
92 |
This utility is merely meant as an adaptor so that \fBe2fsck\fR can be |
93 |
run during the boot process, it does not support all options that |
94 |
\fBe2fsck\fR offers. If you need one of its advanced options, please run |
95 |
\fBe2fsck\fR directly. |
96 |
|
97 |
.SH FILES |
98 |
.TP |
99 |
.I /sbin/e2fsck |
100 |
is the location of the \fBe2fsck\fR program to run. |
101 |
|
102 |
.SH AUTHOR |
103 |
.P |
104 |
Matthias Andree <matthias.andree@×××.de> wrote the program and this |
105 |
manual page. |
106 |
.SH CONFORMING TO |
107 |
The FreeBSD 6.1 command line interface for \fBfsck_ufs\fR(8). |
108 |
.SH SEE ALSO |
109 |
.BR fsck (8), |
110 |
.BR e2fsck (8) |
111 |
and |
112 |
.BR fsck_ufs (8). |
113 |
|
114 |
|
115 |
|
116 |
1.1 sys-fs/e2fsprogs/files/e2fsprogs-1.40-fbsd.patch |
117 |
|
118 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/e2fsprogs/files/e2fsprogs-1.40-fbsd.patch?rev=1.1&view=markup |
119 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/e2fsprogs/files/e2fsprogs-1.40-fbsd.patch?rev=1.1&content-type=text/plain |
120 |
|
121 |
Index: e2fsprogs-1.40-fbsd.patch |
122 |
=================================================================== |
123 |
--- a/lib/ext2fs/tdb.c.orig Thu Apr 5 02:43:05 2007 |
124 |
+++ b/lib/ext2fs/tdb.c Sat Jun 30 16:13:15 2007 |
125 |
@@ -36,7 +36,6 @@ |
126 |
#define HAVE_UTIME_H |
127 |
#define HAVE_UTIME |
128 |
#endif |
129 |
-#define _XOPEN_SOURCE 500 |
130 |
|
131 |
#include <unistd.h> |
132 |
#include <stdio.h> |
133 |
--- a/lib/ext2fs/ext2_fs.h.orig Sat Jun 30 16:36:37 2007 |
134 |
+++ b/lib/ext2fs/ext2_fs.h Sat Jun 30 16:36:43 2007 |
135 |
@@ -414,7 +414,7 @@ |
136 |
|
137 |
#define i_size_high i_dir_acl |
138 |
|
139 |
-#if defined(__KERNEL__) || defined(__linux__) |
140 |
+#if defined(__KERNEL__) || defined(__linux__) || defined(__FreeBSD__) |
141 |
#define i_reserved1 osd1.linux1.l_i_reserved1 |
142 |
#define i_frag osd2.linux2.l_i_frag |
143 |
#define i_fsize osd2.linux2.l_i_fsize |
144 |
|
145 |
|
146 |
|
147 |
1.1 sys-fs/e2fsprogs/files/fsck_ext2fs.c |
148 |
|
149 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/e2fsprogs/files/fsck_ext2fs.c?rev=1.1&view=markup |
150 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/e2fsprogs/files/fsck_ext2fs.c?rev=1.1&content-type=text/plain |
151 |
|
152 |
Index: fsck_ext2fs.c |
153 |
=================================================================== |
154 |
/* |
155 |
* fsck_ext2fs - wrapper for e2fsck on FreeBSD |
156 |
* Copyright (C) 2004,2006 Matthias Andree <matthias.andree@×××.de> |
157 |
* redistributable in accordance with the |
158 |
* GNU General Public License v2 |
159 |
* |
160 |
* $FreeBSD: ports/sysutils/e2fsprogs/files/fsck_ext2fs.c,v 1.5 2006/07/04 15:47:51 leeym Exp $ |
161 |
* |
162 |
* Upstream: $Id: fsck_ext2fs.c,v 1.1 2007/09/15 08:54:26 uberlord Exp $ |
163 |
* |
164 |
* format: gindent -kr |
165 |
*/ |
166 |
|
167 |
#include <sys/types.h> |
168 |
#include <unistd.h> |
169 |
#include <stdlib.h> |
170 |
#include <stdio.h> |
171 |
#include <string.h> |
172 |
#include <sys/wait.h> |
173 |
#include <sys/time.h> |
174 |
#include <sys/resource.h> |
175 |
#include <errno.h> |
176 |
|
177 |
__attribute__ ((noreturn)) |
178 |
static int die(const char *tag) |
179 |
{ |
180 |
perror(tag); |
181 |
exit(EXIT_FAILURE); |
182 |
} |
183 |
|
184 |
int main(int argc, char **argv) |
185 |
{ |
186 |
int ch, i = 1, force = 0, status, verbose = 0, t; |
187 |
long block = 0; |
188 |
enum { normal, preen, yes, no } mode = normal; |
189 |
char *cmd[256]; |
190 |
pid_t pid; |
191 |
|
192 |
cmd[0] = "/sbin/e2fsck"; |
193 |
while ((ch = getopt(argc, argv, "BFpfnyb:v")) != -1) { |
194 |
switch (ch) { |
195 |
case 'p': |
196 |
mode = preen; |
197 |
break; |
198 |
case 'f': |
199 |
force = 1; |
200 |
break; |
201 |
case 'n': |
202 |
mode = no; |
203 |
break; |
204 |
case 'y': |
205 |
mode = yes; |
206 |
break; |
207 |
case 'b': |
208 |
block = atol(optarg); |
209 |
break; |
210 |
case 'v': |
211 |
verbose++; |
212 |
break; |
213 |
case 'F': |
214 |
/* e2fsck does not support background checking, |
215 |
* hence exit with nonzero status to force |
216 |
* the foreground check. */ |
217 |
exit(1); |
218 |
case 'B': |
219 |
default: |
220 |
fprintf(stderr, "%s: unknown option -%c\n", |
221 |
argv[0], optopt); |
222 |
exit(EXIT_FAILURE); |
223 |
} |
224 |
} |
225 |
|
226 |
if (force) |
227 |
cmd[i++] = "-f"; |
228 |
|
229 |
switch (mode) { |
230 |
case normal: |
231 |
/* FreeBSD needs -f to force a check only in context |
232 |
* with -p -- so map normal to force to match |
233 |
* expectations */ |
234 |
if (!force) |
235 |
cmd[i++] = "-f"; |
236 |
break; |
237 |
case yes: |
238 |
cmd[i++] = "-y"; |
239 |
break; |
240 |
case no: |
241 |
cmd[i++] = "-n"; |
242 |
break; |
243 |
case preen: |
244 |
cmd[i++] = "-p"; |
245 |
break; |
246 |
} |
247 |
|
248 |
if (block) { |
249 |
static char b[30]; |
250 |
|
251 |
sprintf(b, "-b %ld", block); |
252 |
cmd[i++] = b; |
253 |
} |
254 |
|
255 |
/* silently limit verbose to 15 so we don't overflow the cmd array */ |
256 |
if (verbose > 15) |
257 |
verbose = 15; |
258 |
|
259 |
for (t = verbose; t > 1; t--) |
260 |
cmd[i++] = "-v"; |
261 |
|
262 |
while (optind < argc) { |
263 |
cmd[i++] = argv[optind++]; |
264 |
/* sanity check so we don't overflow the cmd buffer */ |
265 |
if (i+1 == sizeof(cmd)/sizeof(cmd[0])) { |
266 |
errno = E2BIG; |
267 |
die(argv[0]); |
268 |
} |
269 |
} |
270 |
|
271 |
cmd[i++] = 0; |
272 |
|
273 |
if (verbose) { |
274 |
for (i=0; cmd[i]; i++) |
275 |
fputs(cmd[i], stderr), |
276 |
fputc(' ', stderr); |
277 |
fputc('\n', stderr); |
278 |
} |
279 |
|
280 |
pid = fork(); |
281 |
switch (pid) { |
282 |
case -1: |
283 |
/* error */ |
284 |
die("fork"); |
285 |
break; |
286 |
case 0: |
287 |
/* child */ |
288 |
(void) execv(cmd[0], cmd); |
289 |
perror("execve"); |
290 |
_exit(127); |
291 |
default: |
292 |
/* parent */ |
293 |
if (pid != waitpid(pid, &status, 0)) |
294 |
die("waitpid"); |
295 |
if (WIFSIGNALED(status) |
296 |
|| (WIFEXITED(status) && WEXITSTATUS(status) >= 4)) |
297 |
exit(EXIT_FAILURE); |
298 |
} |
299 |
exit(EXIT_SUCCESS); |
300 |
} |
301 |
|
302 |
|
303 |
|
304 |
-- |
305 |
gentoo-commits@g.o mailing list |