summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2008-09-19 15:17:32 +0000
committerobrien <obrien@FreeBSD.org>2008-09-19 15:17:32 +0000
commit0c0da6bba72d56bf2e0d5bf968756ed695d82acf (patch)
treea9d6ccf748bc69f3be4e95072ed4b5a233f5ad73 /sys/compat
parent99d8d99aa0169e2294a176be083085bf7a734d40 (diff)
downloadFreeBSD-src-0c0da6bba72d56bf2e0d5bf968756ed695d82acf.zip
FreeBSD-src-0c0da6bba72d56bf2e0d5bf968756ed695d82acf.tar.gz
Add freebsd32 compat shim for nmount(2).
(and quiet some compiler warnings for vfs_donmount)
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c48
-rw-r--r--sys/compat/freebsd32/syscalls.master2
2 files changed, 47 insertions, 3 deletions
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index b9678cb9..917a672 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -85,6 +85,8 @@ __FBSDID("$FreeBSD$");
#include <machine/cpu.h>
+#include <security/audit/audit.h>
+
#include <compat/freebsd32/freebsd32_util.h>
#include <compat/freebsd32/freebsd32.h>
#include <compat/freebsd32/freebsd32_ipc.h>
@@ -2552,8 +2554,51 @@ freebsd32_cpuset_setaffinity(struct thread *td,
return (cpuset_setaffinity(td, &ap));
}
-#if 0
+int
+freebsd32_nmount(struct thread *td,
+ struct freebsd32_nmount_args /* {
+ struct iovec *iovp;
+ unsigned int iovcnt;
+ int flags;
+ } */ *uap)
+{
+ struct uio *auio;
+ struct iovec *iov;
+ int error, k;
+
+ AUDIT_ARG(fflags, uap->flags);
+
+ /*
+ * Filter out MNT_ROOTFS. We do not want clients of nmount() in
+ * userspace to set this flag, but we must filter it out if we want
+ * MNT_UPDATE on the root file system to work.
+ * MNT_ROOTFS should only be set in the kernel in vfs_mountroot_try().
+ */
+ uap->flags &= ~MNT_ROOTFS;
+
+ /*
+ * check that we have an even number of iovec's
+ * and that we have at least two options.
+ */
+ if ((uap->iovcnt & 1) || (uap->iovcnt < 4))
+ return (EINVAL);
+ error = freebsd32_copyinuio(uap->iovp, uap->iovcnt, &auio);
+ if (error)
+ return (error);
+ for (iov = auio->uio_iov, k = 0; k < uap->iovcnt; ++k, ++iov) {
+ if (iov->iov_len > MMAXOPTIONLEN) {
+ free(auio, M_IOV);
+ return (EINVAL);
+ }
+ }
+
+ error = vfs_donmount(td, uap->flags, auio);
+ free(auio, M_IOV);
+ return error;
+}
+
+#if 0
int
freebsd32_xxx(struct thread *td, struct freebsd32_xxx_args *uap)
{
@@ -2578,5 +2623,4 @@ freebsd32_xxx(struct thread *td, struct freebsd32_xxx_args *uap)
}
return (error);
}
-
#endif
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master
index 4f3780f..3fedb3e 100644
--- a/sys/compat/freebsd32/syscalls.master
+++ b/sys/compat/freebsd32/syscalls.master
@@ -651,7 +651,7 @@
375 AUE_NULL UNIMPL nfsclnt
376 AUE_EACCESS NOPROTO { int eaccess(char *path, int flags); }
377 AUE_NULL UNIMPL afs_syscall
-378 AUE_NMOUNT NOPROTO { int nmount(struct iovec *iovp, \
+378 AUE_NMOUNT STD { int freebsd32_nmount(struct iovec32 *iovp, \
unsigned int iovcnt, int flags); }
379 AUE_NULL UNIMPL kse_exit
380 AUE_NULL UNIMPL kse_wakeup
OpenPOWER on IntegriCloud