summaryrefslogtreecommitdiffstats
path: root/sbin/mount_reiserfs
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/mount_reiserfs')
-rw-r--r--sbin/mount_reiserfs/Makefile13
-rw-r--r--sbin/mount_reiserfs/mount_reiserfs.888
-rw-r--r--sbin/mount_reiserfs/mount_reiserfs.c106
3 files changed, 207 insertions, 0 deletions
diff --git a/sbin/mount_reiserfs/Makefile b/sbin/mount_reiserfs/Makefile
new file mode 100644
index 0000000..686629f
--- /dev/null
+++ b/sbin/mount_reiserfs/Makefile
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+PROG = mount_reiserfs
+SRCS = mount_reiserfs.c getmntopts.c
+MAN = mount_reiserfs.8
+
+# mount_reiserfs needs mntopts.h and getmntopts.c from src/sbin/mount/
+MOUNT ?= ${.CURDIR}/../mount
+CFLAGS += -I${MOUNT}
+
+.PATH: ${MOUNT}
+
+.include <bsd.prog.mk>
diff --git a/sbin/mount_reiserfs/mount_reiserfs.8 b/sbin/mount_reiserfs/mount_reiserfs.8
new file mode 100644
index 0000000..ebc948a
--- /dev/null
+++ b/sbin/mount_reiserfs/mount_reiserfs.8
@@ -0,0 +1,88 @@
+.\"
+.\" Copyright (c) 1993,1994 Christopher G. Demetriou
+.\" Copyright (c) 1999 Semen Ustimenko
+.\" Copyright (c) 2005 Jean-Sébastien Pédron
+.\" 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 acknowledgment:
+.\" This product includes software developed by Christopher G. Demetriou.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd February 3, 2005
+.Dt MOUNT_REISERFS 8
+.Os
+.Sh NAME
+.Nm mount_reiserfs
+.Nd mount a ReiserFS file system
+.Sh SYNOPSIS
+.Nm
+.Pa special
+.Pa node
+.Sh DESCRIPTION
+The
+.Nm
+utility attaches the ReiserFS file system residing on the device
+.Pa special
+to the global file system namespace at the location
+indicated by
+.Pa node .
+.Pp
+This command is normally executed by
+.Xr mount 8
+at boot time, but can be used by any user to mount a
+ReiserFS file system on any directory that they own (provided,
+of course, that they have appropriate access to the device that
+contains the file system).
+.Sh EXAMPLES
+To mount a ReiserFS volume located in
+.Pa /dev/ad1s1 :
+.Pp
+.Dl "mount_reiserfs /dev/ad1s1 /mnt"
+.Sh SEE ALSO
+.Xr mount 2 ,
+.Xr unmount 2 ,
+.Xr fstab 5 ,
+.Xr mount 8
+.Sh CAVEATS
+This utility is primarily used for read access to a ReiserFS volume.
+Writing to a volume is currently unsupported.
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Fx 6.0 .
+.Sh AUTHORS
+The ReiserFS kernel implementation was written by
+.An Hans Reiser (http://www.namesys.com/) ,
+and ported to
+.Fx
+by
+.An Jean-Sébastien Pédron <dumbbell@FreeBSD.org> .
+.Pp
+The
+.Nm
+utility and manual were written by
+.An Jean-Sébastien Pédron <dumbbell@FreeBSD.org> .
diff --git a/sbin/mount_reiserfs/mount_reiserfs.c b/sbin/mount_reiserfs/mount_reiserfs.c
new file mode 100644
index 0000000..90f8731
--- /dev/null
+++ b/sbin/mount_reiserfs/mount_reiserfs.c
@@ -0,0 +1,106 @@
+/*-
+ * Copyright (c) 2005 Jean-Sébastien Pédron
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/param.h>
+#include <sys/mount.h>
+#include <sys/uio.h>
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+#include "mntopts.h"
+
+struct mntopt mopts[] = {
+ MOPT_STDOPTS,
+ { NULL }
+};
+
+void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+ struct iovec *iov;
+ int ch, mntflags, iovlen;
+ char *dev, *dir, mntpath[MAXPATHLEN];
+
+ mntflags = 0;
+ while ((ch = getopt(argc, argv, "o:")) != -1) {
+ switch(ch) {
+ case 'o':
+ getmntopts(optarg, mopts, &mntflags, 0);
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc != 2)
+ usage();
+
+ dev = argv[0];
+ dir = argv[1];
+
+ /*
+ * Resolve the mountpoint with realpath(3) and remove unnecessary
+ * slashes from the devicename if there are any.
+ */
+ (void)checkpath(dir, mntpath);
+ (void)rmslashes(dev, dev);
+
+ /* Read-only support for now */
+ mntflags |= MNT_RDONLY;
+
+ /* Prepare the options vector for nmount(). build_iovec() is declared
+ * in mntopts.h. */
+ iov = NULL;
+ iovlen = 0;
+ build_iovec(&iov, &iovlen, "fstype", "reiserfs", -1);
+ build_iovec(&iov, &iovlen, "fspath", mntpath, -1);
+ build_iovec(&iov, &iovlen, "from", dev, -1);
+
+ if (nmount(iov, iovlen, mntflags) < 0)
+ err(EX_OSERR, "%s", dev);
+
+ exit(0);
+}
+
+void
+usage(void)
+{
+ fprintf(stderr,
+ "usage: mount_reiserfs [-o options] special node\n");
+ exit(EX_USAGE);
+}
OpenPOWER on IntegriCloud