summaryrefslogtreecommitdiff
path: root/sbin/mount_nnpfs
diff options
context:
space:
mode:
authorJanne Johansson <jj@cvs.openbsd.org>2009-06-03 14:45:57 +0000
committerJanne Johansson <jj@cvs.openbsd.org>2009-06-03 14:45:57 +0000
commitea9bbf428f51194a52c45ac274c35dba174a741c (patch)
tree301aa894fd92a097d769b8cac575c8a0fce07329 /sbin/mount_nnpfs
parent0c52879fa54117b2bd312fe5fff17f310dbdb7eb (diff)
Arla client rename from xfs to nnpfs for later upgrades. Tested on various arches. ok todd@ beck@
Diffstat (limited to 'sbin/mount_nnpfs')
-rw-r--r--sbin/mount_nnpfs/Makefile11
-rw-r--r--sbin/mount_nnpfs/mount_nnpfs.886
-rw-r--r--sbin/mount_nnpfs/mount_nnpfs.c105
3 files changed, 202 insertions, 0 deletions
diff --git a/sbin/mount_nnpfs/Makefile b/sbin/mount_nnpfs/Makefile
new file mode 100644
index 00000000000..a45371ad862
--- /dev/null
+++ b/sbin/mount_nnpfs/Makefile
@@ -0,0 +1,11 @@
+# $OpenBSD: Makefile,v 1.1 2009/06/03 14:45:49 jj Exp $
+
+PROG= mount_nnpfs
+SRCS= mount_nnpfs.c getmntopts.c
+MAN= mount_nnpfs.8
+
+MOUNT= ${.CURDIR}/../mount
+CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT}
+.PATH: ${MOUNT}
+
+.include <bsd.prog.mk>
diff --git a/sbin/mount_nnpfs/mount_nnpfs.8 b/sbin/mount_nnpfs/mount_nnpfs.8
new file mode 100644
index 00000000000..874d551c7ab
--- /dev/null
+++ b/sbin/mount_nnpfs/mount_nnpfs.8
@@ -0,0 +1,86 @@
+.\" $OpenBSD: mount_nnpfs.8,v 1.1 2009/06/03 14:45:49 jj Exp $
+.\" $NetBSD: mount_null.8,v 1.4 1996/04/10 20:57:19 thorpej Exp $
+.\"
+.\" Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
+.\" (Royal Institute of Technology, Stockholm, Sweden).
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the Kungliga Tekniska
+.\" Högskolan and its contributors.
+.\"
+.\" 4. Neither the name of the Institute nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd $Mdocdate: June 3 2009 $
+.Dt MOUNT_NNPFS 8
+.Os
+.Sh NAME
+.Nm mount_nnpfs
+.Nd mount the nnpfs filesystem
+.Sh SYNOPSIS
+.Nm mount_nnpfs
+.Op Fl o Ar options
+.Ar special
+.Ar node
+.Sh DESCRIPTION
+The
+.Nm
+command mounts one of the nnpfs character devices,
+.Ar special ,
+on mount point
+.Ar node .
+The character device is used
+for communication with a user-land cache manager and file provider.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl o Ar options
+Options are specified with a
+.Fl o
+flag followed by a comma separated string of options.
+See the
+.Xr mount 8
+man page for possible options and their meanings.
+.El
+.Pp
+The nnpfs filesystem was written primarily to make a free, AFS-compatible
+filesystem (Arla).
+But since the nnpfs interface is simple and generic
+it could be used for other filesystems as well.
+.\"
+.Sh SEE ALSO
+.Xr mount 2 ,
+.Xr afsd 8 ,
+.Xr mount 8 ,
+.Xr umount 8
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Ox 2.4 .
diff --git a/sbin/mount_nnpfs/mount_nnpfs.c b/sbin/mount_nnpfs/mount_nnpfs.c
new file mode 100644
index 00000000000..89f2b617c87
--- /dev/null
+++ b/sbin/mount_nnpfs/mount_nnpfs.c
@@ -0,0 +1,105 @@
+/* $OpenBSD: mount_nnpfs.c,v 1.1 2009/06/03 14:45:49 jj Exp $ */
+/*
+ * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the Kungliga Tekniska
+ * Högskolan and its contributors.
+ *
+ * 4. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <sys/param.h>
+#include <sys/mount.h>
+#include <errno.h>
+#include <err.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <paths.h>
+#include "mntopts.h"
+
+
+extern char *__progname;
+
+static const struct mntopt mopts[] = {
+ MOPT_STDOPTS,
+ MOPT_ASYNC,
+ MOPT_SYNC,
+ MOPT_UPDATE,
+ MOPT_RELOAD,
+ {NULL}
+};
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: %s [-o options] special node\n",
+ __progname);
+ exit(1);
+}
+
+int
+main(int argc, char **argv)
+{
+ int ch;
+ int mntflags = 0;
+ char path[MAXPATHLEN];
+
+ optind = optreset = 1;
+ while ((ch = getopt(argc, argv, "o:")) != -1)
+ switch (ch) {
+ case 'o':
+ getmntopts(optarg, mopts, &mntflags);
+ break;
+ case '?':
+ default:
+ usage();
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc != 2)
+ usage();
+
+ if (realpath(argv[1], path) == NULL)
+ err(1, "realpath %s", argv[1]);
+
+ if (mount(MOUNT_NNPFS, path, mntflags, argv[0])) {
+ if (errno == EOPNOTSUPP)
+ errx(1, "Filesystem not supported by kernel");
+ else
+ err(1, NULL);
+ }
+
+ return 0;
+}