diff options
author | Alexander von Gernler <grunk@cvs.openbsd.org> | 2007-04-14 11:54:01 +0000 |
---|---|---|
committer | Alexander von Gernler <grunk@cvs.openbsd.org> | 2007-04-14 11:54:01 +0000 |
commit | 7504b181e38b9dd51b4387388b00afac49a74969 (patch) | |
tree | fe4b16dc9cb0cda6496caf22f11eab867b46ab69 /sbin/fsck_vnd | |
parent | 20c18c3380804cc6d23ed4f4fd39157772e2d556 (diff) |
introduce {fsck,mount}_vnd tools to be able to describe vnd images
in /etc/fstab instead of using some weird homegrown scripts.
No support for boot time mounting yet, so "noauto" is still needed.
original idea from david@
help and discussion todd@ bluhm@ beck@, manpage help jmc@
ok simon@ tedu@ bluhm@ todd@, "looks good" thib@
Diffstat (limited to 'sbin/fsck_vnd')
-rw-r--r-- | sbin/fsck_vnd/Makefile | 8 | ||||
-rw-r--r-- | sbin/fsck_vnd/fsck_vnd.8 | 76 | ||||
-rw-r--r-- | sbin/fsck_vnd/fsck_vnd.c | 68 |
3 files changed, 152 insertions, 0 deletions
diff --git a/sbin/fsck_vnd/Makefile b/sbin/fsck_vnd/Makefile new file mode 100644 index 00000000000..4ef694a64a1 --- /dev/null +++ b/sbin/fsck_vnd/Makefile @@ -0,0 +1,8 @@ +# $OpenBSD: Makefile,v 1.1 2007/04/14 11:54:00 grunk Exp $ + +PROG=fsck_vnd +SRCS=fsck_vnd.c + +MAN=fsck_vnd.8 + +.include <bsd.prog.mk> diff --git a/sbin/fsck_vnd/fsck_vnd.8 b/sbin/fsck_vnd/fsck_vnd.8 new file mode 100644 index 00000000000..6dc0bbb5e7b --- /dev/null +++ b/sbin/fsck_vnd/fsck_vnd.8 @@ -0,0 +1,76 @@ +.\" $OpenBSD: fsck_vnd.8,v 1.1 2007/04/14 11:54:00 grunk Exp $ +.\" +.\" Copyright (c) 2007 Alexander von Gernler <grunk@openbsd.org> +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd April 13, 2007 +.Dt FSCK_VND 8 +.Os +.Sh NAME +.Nm fsck_vnd +.Nd vnd image consistency checker +.Sh SYNOPSIS +.Nm fsck_vnd +.Op Fl fnpy +.Ar image ... +.Sh DESCRIPTION +The +.Nm +utility pretends to verify image files to be configured using +.Xr vnconfig 8 . +It is a bogus script that exists to please the +.Xr fstab 5 +semantics for the +.Ar vnd +file system. +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Fl f +This option is ignored by +.Nm fsck_vnd , +and is present only for compatibility with programs that +check other file system types for consistency, such as +.Xr fsck_ffs 8 . +.It Fl n +Assume a +.Dq no +response to all questions asked by +.Nm fsck_vnd . +This option is provided for compatibility reasons. +.It Fl p +Preen the specified file systems. +This option is provided for compatibility reasons. +.It Fl y +Causes +.Nm +to assume +.Dq yes +as the answer to all operator questions. +This option is provided for compatibility reasons. +.El +.Sh SEE ALSO +.Xr fs 5 , +.Xr fstab 5 , +.Xr fsck 8 , +.Xr fsck_ffs 8 , +.Xr mount_vnd 8 , +.Xr rc 8 +.Sh HISTORY +The +.Nm +command first appeared in +.Ox 4.2 . +.Sh AUTHORS +.An Alexander von Gernler . diff --git a/sbin/fsck_vnd/fsck_vnd.c b/sbin/fsck_vnd/fsck_vnd.c new file mode 100644 index 00000000000..1f266e1fea3 --- /dev/null +++ b/sbin/fsck_vnd/fsck_vnd.c @@ -0,0 +1,68 @@ +/* $OpenBSD: fsck_vnd.c,v 1.1 2007/04/14 11:54:00 grunk Exp $ */ + +/* + * Copyright (c) 2007 Alexander von Gernler <grunk@pestilenz.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/types.h> +#include <sys/stat.h> + +#include <err.h> +#include <stdio.h> +#include <unistd.h> + +__dead void usage(void); + + +__dead void +usage(void) +{ + extern char *__progname; + + fprintf(stderr, "usage: %s [-fnpy] image ...\n", __progname); + exit(1); +} + +int +main(int argc, char *argv[]) +{ + int ch, i; + struct stat sb; + + while ((ch = getopt(argc, argv, "fnpy")) != -1) { + switch (ch) { + case 'f': + case 'n': + case 'p': + case 'y': + break; + default: + usage(); + /* NOTREACHED */ + } + } + argc -= optind; + argv += optind; + + if (argc < 1) + usage(); + + /* the only check we can do on vnd images */ + for (i=0; i<argc; i++) + if (stat(argv[i], &sb) == -1) + err(1, "stat"); + + return (0); +} |