summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2005-11-21 14:27:56 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2005-11-21 14:27:56 +0000
commite819c0e21dfa7606a6d74692c0eacf3630f38bea (patch)
tree54a26dff44422f678470fd8efb492e8501c6f561
parent10ce4991f7723cb6e89f56a1f7a6d3cc9b34c97a (diff)
Accept and pass through -b option for fsck_ffs and fsck_ext2fs
OK mickey@
-rw-r--r--sbin/fsck/fsck.810
-rw-r--r--sbin/fsck/fsck.c15
2 files changed, 20 insertions, 5 deletions
diff --git a/sbin/fsck/fsck.8 b/sbin/fsck/fsck.8
index b0014184d47..4d0fd45cb62 100644
--- a/sbin/fsck/fsck.8
+++ b/sbin/fsck/fsck.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: fsck.8,v 1.26 2005/02/03 05:00:07 jaredy Exp $
+.\" $OpenBSD: fsck.8,v 1.27 2005/11/21 14:27:55 millert Exp $
.\" $NetBSD: fsck.8,v 1.14 1996/10/03 20:08:29 christos Exp $
.\"
.\" Copyright (c) 1996 Christos Zoulas. All rights reserved.
@@ -38,6 +38,7 @@
.Nm fsck
.Bk -words
.Op Fl dfnpvy
+.Op Fl b Ar block#
.Op Fl l Ar maxparallel
.Op Fl T Ar fstype : Ns Ar fsoptions
.Op Fl t Ar fstype
@@ -76,6 +77,13 @@ checked.
.Pp
The options are as follows:
.Bl -tag -width Ds
+.It Fl b Ar block#
+Causes
+.Nm
+to use the specified block as the location of the superblock.
+Block 32 is usually an alternate super block.
+This option is only valid for filesystems that support backup superblocks
+(ffs and ext2fs).
.It Fl d
Debugging mode.
Just print the commands without executing them.
diff --git a/sbin/fsck/fsck.c b/sbin/fsck/fsck.c
index 5fadbdcddcd..5cad2b8a56f 100644
--- a/sbin/fsck/fsck.c
+++ b/sbin/fsck/fsck.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsck.c,v 1.22 2005/11/12 13:28:34 deraadt Exp $ */
+/* $OpenBSD: fsck.c,v 1.23 2005/11/21 14:27:55 millert Exp $ */
/* $NetBSD: fsck.c,v 1.7 1996/10/03 20:06:30 christos Exp $ */
/*
@@ -35,7 +35,7 @@
*
*/
-static const char rcsid[] = "$OpenBSD: fsck.c,v 1.22 2005/11/12 13:28:34 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: fsck.c,v 1.23 2005/11/21 14:27:55 millert Exp $";
#include <sys/param.h>
#include <sys/mount.h>
@@ -90,7 +90,7 @@ main(int argc, char *argv[])
struct fstab *fs;
int i, rval = 0;
char *vfstype = NULL;
- char globopt[3];
+ char *p, globopt[3];
struct rlimit rl;
/* Increase our data size to the max */
@@ -110,7 +110,7 @@ main(int argc, char *argv[])
TAILQ_INIT(&selhead);
TAILQ_INIT(&opthead);
- while ((i = getopt(argc, argv, "dvpfnyl:t:T:")) != -1)
+ while ((i = getopt(argc, argv, "dvpfnyb:l:T:t:")) != -1)
switch (i) {
case 'd':
flags |= CHECK_DEBUG;
@@ -130,6 +130,13 @@ main(int argc, char *argv[])
options = catopt(options, globopt, 1);
break;
+ case 'b':
+ if (asprintf(&p, "-b %s", optarg) == -1)
+ err(1, "malloc failed");
+ options = catopt(options, p, 1);
+ free(p);
+ break;
+
case 'l':
maxrun = atoi(optarg);
break;