diff options
author | David E. O'Brien <obrien@FreeBSD.org> | 2008-09-19 15:17:32 +0000 |
---|---|---|
committer | David E. O'Brien <obrien@FreeBSD.org> | 2008-09-19 15:17:32 +0000 |
commit | 6e6049e9df6850341d51adcd503cfe79a4f35e86 (patch) | |
tree | a9d6ccf748bc69f3be4e95072ed4b5a233f5ad73 /sys/compat/freebsd32/freebsd32_misc.c | |
parent | 67442c6e80b7267ada4b542c0cf0d4266d280528 (diff) | |
download | src-6e6049e9df6850341d51adcd503cfe79a4f35e86.tar.gz src-6e6049e9df6850341d51adcd503cfe79a4f35e86.zip |
Add freebsd32 compat shim for nmount(2).
(and quiet some compiler warnings for vfs_donmount)
Notes
Notes:
svn path=/head/; revision=183188
Diffstat (limited to 'sys/compat/freebsd32/freebsd32_misc.c')
-rw-r--r-- | sys/compat/freebsd32/freebsd32_misc.c | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index b9678cb909b0..917a672f676c 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 |