Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Change do_sys_mount() so that it only takes as argument ...
details: https://anonhg.NetBSD.org/src/rev/757b31b6fec1
branches: trunk
changeset: 811329:757b31b6fec1
user: maxv <maxv%NetBSD.org@localhost>
date: Fri Oct 23 19:40:10 2015 +0000
description:
Change do_sys_mount() so that it only takes as argument the type of the
drive instead of its associated vfsops. Makes it more friendly, and allows
compat binaries to autoload VFS modules if needed.
sent on tech-kern@, ok christos@
diffstat:
sys/compat/common/vfs_syscalls_40.c | 6 ++--
sys/compat/freebsd/freebsd_file.c | 10 ++-----
sys/compat/netbsd32/netbsd32_fs.c | 6 ++--
sys/compat/osf1/osf1_mount.c | 8 +++---
sys/compat/sunos/sunos_misc.c | 8 +++---
sys/compat/sunos32/sunos32_misc.c | 8 +++---
sys/compat/ultrix/ultrix_fs.c | 8 +++---
sys/kern/vfs_syscalls.c | 44 +++++++++++++++++++-----------------
sys/sys/mount.h | 4 +-
9 files changed, 50 insertions(+), 52 deletions(-)
diffs (truncated from 347 to 300 lines):
diff -r 8e2ca84da34f -r 757b31b6fec1 sys/compat/common/vfs_syscalls_40.c
--- a/sys/compat/common/vfs_syscalls_40.c Fri Oct 23 18:53:26 2015 +0000
+++ b/sys/compat/common/vfs_syscalls_40.c Fri Oct 23 19:40:10 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls_40.c,v 1.3 2011/01/19 10:21:16 tsutsui Exp $ */
+/* $NetBSD: vfs_syscalls_40.c,v 1.4 2015/10/23 19:40:10 maxv Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_40.c,v 1.3 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_40.c,v 1.4 2015/10/23 19:40:10 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -81,6 +81,6 @@
} */
register_t dummy;
- return do_sys_mount(l, NULL, SCARG(uap, type), SCARG(uap, path),
+ return do_sys_mount(l, SCARG(uap, type), UIO_USERSPACE, SCARG(uap, path),
SCARG(uap, flags), SCARG(uap, data), UIO_USERSPACE, 0, &dummy);
}
diff -r 8e2ca84da34f -r 757b31b6fec1 sys/compat/freebsd/freebsd_file.c
--- a/sys/compat/freebsd/freebsd_file.c Fri Oct 23 18:53:26 2015 +0000
+++ b/sys/compat/freebsd/freebsd_file.c Fri Oct 23 19:40:10 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: freebsd_file.c,v 1.33 2014/11/09 18:30:38 maxv Exp $ */
+/* $NetBSD: freebsd_file.c,v 1.34 2015/10/23 19:40:10 maxv Exp $ */
/*
* Copyright (c) 1995 Frank van der Linden
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: freebsd_file.c,v 1.33 2014/11/09 18:30:38 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_file.c,v 1.34 2015/10/23 19:40:10 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -98,16 +98,12 @@
syscallarg(void *) data;
} */
const char *type;
- struct vfsops *vfsops;
register_t dummy;
if ((type = convert_from_freebsd_mount_type(SCARG(uap, type))) == NULL)
return ENODEV;
- vfsops = vfs_getopsbyname(type);
- if (vfsops == NULL)
- return ENODEV;
- return do_sys_mount(l, vfsops, NULL, SCARG(uap, path),
+ return do_sys_mount(l, type, UIO_SYSSPACE, SCARG(uap, path),
SCARG(uap, flags), SCARG(uap, data), UIO_USERSPACE, 0, &dummy);
}
diff -r 8e2ca84da34f -r 757b31b6fec1 sys/compat/netbsd32/netbsd32_fs.c
--- a/sys/compat/netbsd32/netbsd32_fs.c Fri Oct 23 18:53:26 2015 +0000
+++ b/sys/compat/netbsd32/netbsd32_fs.c Fri Oct 23 19:40:10 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_fs.c,v 1.72 2014/10/05 20:17:28 christos Exp $ */
+/* $NetBSD: netbsd32_fs.c,v 1.73 2015/10/23 19:40:10 maxv Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.72 2014/10/05 20:17:28 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.73 2015/10/23 19:40:10 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -958,7 +958,7 @@
} else {
data_seg = UIO_USERSPACE;
}
- error = do_sys_mount(l, NULL, type, path, flags, data, data_seg,
+ error = do_sys_mount(l, mtype, UIO_SYSSPACE, path, flags, data, data_seg,
data_len, retval);
if (error)
return error;
diff -r 8e2ca84da34f -r 757b31b6fec1 sys/compat/osf1/osf1_mount.c
--- a/sys/compat/osf1/osf1_mount.c Fri Oct 23 18:53:26 2015 +0000
+++ b/sys/compat/osf1/osf1_mount.c Fri Oct 23 19:40:10 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_mount.c,v 1.52 2014/09/05 09:21:54 matt Exp $ */
+/* $NetBSD: osf1_mount.c,v 1.53 2015/10/23 19:40:11 maxv Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: osf1_mount.c,v 1.52 2014/09/05 09:21:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: osf1_mount.c,v 1.53 2015/10/23 19:40:11 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -261,7 +261,7 @@
bsd_ma.base = osf_ma.base;
bsd_ma.size = osf_ma.size;
- return do_sys_mount(l, vfs_getopsbyname("mfs"), NULL, SCARG(uap, path),
+ return do_sys_mount(l, "mfs", UIO_SYSSPACE, SCARG(uap, path),
SCARG(uap, flags), &bsd_ma, UIO_SYSSPACE, sizeof bsd_ma, &dummy);
}
@@ -312,6 +312,6 @@
if (bsd_na.flags & NFSMNT_RETRANS)
bsd_na.retrans = osf_na.retrans;
- return do_sys_mount(l, vfs_getopsbyname("nfs"), NULL, SCARG(uap, path),
+ return do_sys_mount(l, "nfs", UIO_SYSSPACE, SCARG(uap, path),
SCARG(uap, flags), &bsd_na, UIO_SYSSPACE, sizeof bsd_na, &dummy);
}
diff -r 8e2ca84da34f -r 757b31b6fec1 sys/compat/sunos/sunos_misc.c
--- a/sys/compat/sunos/sunos_misc.c Fri Oct 23 18:53:26 2015 +0000
+++ b/sys/compat/sunos/sunos_misc.c Fri Oct 23 19:40:10 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunos_misc.c,v 1.169 2014/09/05 09:21:55 matt Exp $ */
+/* $NetBSD: sunos_misc.c,v 1.170 2015/10/23 19:40:11 maxv Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunos_misc.c,v 1.169 2014/09/05 09:21:55 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunos_misc.c,v 1.170 2015/10/23 19:40:11 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -279,7 +279,7 @@
na.retrans = sna.retrans;
na.hostname = /* (char *)(u_long) */ sna.hostname;
- return do_sys_mount(l, vfs_getopsbyname("nfs"), NULL,
+ return do_sys_mount(l, "nfs", UIO_SYSSPACE,
SCARG(uap, dir), nflags, &na,
UIO_SYSSPACE, sizeof na, &dummy);
}
@@ -287,7 +287,7 @@
if (strcmp(fsname, "4.2") == 0)
strcpy(fsname, "ffs");
- return do_sys_mount(l, vfs_getopsbyname(fsname), NULL,
+ return do_sys_mount(l, fsname, UIO_SYSSPACE,
SCARG(uap, dir), nflags, SCARG(uap, data),
UIO_USERSPACE, 0, &dummy);
}
diff -r 8e2ca84da34f -r 757b31b6fec1 sys/compat/sunos32/sunos32_misc.c
--- a/sys/compat/sunos32/sunos32_misc.c Fri Oct 23 18:53:26 2015 +0000
+++ b/sys/compat/sunos32/sunos32_misc.c Fri Oct 23 19:40:10 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunos32_misc.c,v 1.75 2014/09/05 09:21:55 matt Exp $ */
+/* $NetBSD: sunos32_misc.c,v 1.76 2015/10/23 19:40:11 maxv Exp $ */
/* from :NetBSD: sunos_misc.c,v 1.107 2000/12/01 19:25:10 jdolecek Exp */
/*
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunos32_misc.c,v 1.75 2014/09/05 09:21:55 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunos32_misc.c,v 1.76 2015/10/23 19:40:11 maxv Exp $");
#define COMPAT_SUNOS 1
@@ -522,7 +522,7 @@
na.retrans = sna.retrans;
na.hostname = (char *)(u_long)sna.hostname;
- return do_sys_mount(l, vfs_getopsbyname("nfs"), NULL,
+ return do_sys_mount(l, "nfs", UIO_SYSSPACE,
SCARG_P32(uap, path), nflags, &na, UIO_SYSSPACE, sizeof na,
&dummy);
}
@@ -530,7 +530,7 @@
if (strcmp(fsname, "4.2") == 0)
strcpy(fsname, "ffs");
- return do_sys_mount(l, vfs_getopsbyname(fsname), NULL,
+ return do_sys_mount(l, fsname, UIO_SYSSPACE,
SCARG_P32(uap, path), nflags, SCARG_P32(uap, data), UIO_USERSPACE,
0, &dummy);
}
diff -r 8e2ca84da34f -r 757b31b6fec1 sys/compat/ultrix/ultrix_fs.c
--- a/sys/compat/ultrix/ultrix_fs.c Fri Oct 23 18:53:26 2015 +0000
+++ b/sys/compat/ultrix/ultrix_fs.c Fri Oct 23 19:40:10 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ultrix_fs.c,v 1.55 2015/07/24 13:02:52 maxv Exp $ */
+/* $NetBSD: ultrix_fs.c,v 1.56 2015/10/23 19:40:11 maxv Exp $ */
/*
* Copyright (c) 1995, 1997 Jonathan Stone
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ultrix_fs.c,v 1.55 2015/07/24 13:02:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ultrix_fs.c,v 1.56 2015/10/23 19:40:11 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -401,7 +401,7 @@
na.timeo = una.timeo;
na.retrans = una.retrans;
na.hostname = una.hostname;
- return do_sys_mount(l, vfs_getopsbyname("nfs"), NULL,
+ return do_sys_mount(l, "nfs", UIO_SYSSPACE,
SCARG(uap, special), nflags, &na, UIO_SYSSPACE,
sizeof na, &dummy);
}
@@ -431,7 +431,7 @@
printf("COMPAT_ULTRIX: mount with MNT_UPDATE on %s\n",
fsname);
}
- return do_sys_mount(l, vfs_getopsbyname("ffs"), NULL,
+ return do_sys_mount(l, "ffs", UIO_SYSSPACE,
SCARG(uap, dir), nflags, &ua, UIO_SYSSPACE, sizeof ua,
&dummy);
}
diff -r 8e2ca84da34f -r 757b31b6fec1 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c Fri Oct 23 18:53:26 2015 +0000
+++ b/sys/kern/vfs_syscalls.c Fri Oct 23 19:40:10 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls.c,v 1.500 2015/07/24 13:02:52 maxv Exp $ */
+/* $NetBSD: vfs_syscalls.c,v 1.501 2015/10/23 19:40:10 maxv Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.500 2015/07/24 13:02:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.501 2015/10/23 19:40:10 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_fileassoc.h"
@@ -360,13 +360,20 @@
}
static int
-mount_get_vfsops(const char *fstype, struct vfsops **vfsops)
+mount_get_vfsops(const char *fstype, enum uio_seg type_seg,
+ struct vfsops **vfsops)
{
char fstypename[sizeof(((struct statvfs *)NULL)->f_fstypename)];
int error;
- /* Copy file-system type from userspace. */
- error = copyinstr(fstype, fstypename, sizeof(fstypename), NULL);
+ if (type_seg == UIO_USERSPACE) {
+ /* Copy file-system type from userspace. */
+ error = copyinstr(fstype, fstypename, sizeof(fstypename), NULL);
+ } else {
+ error = copystr(fstype, fstypename, sizeof(fstypename), NULL);
+ KASSERT(error != 0);
+ }
+
if (error) {
/*
* Historically, filesystem types were identified by numbers.
@@ -445,26 +452,23 @@
syscallarg(size_t) data_len;
} */
- return do_sys_mount(l, NULL, SCARG(uap, type), SCARG(uap, path),
+ return do_sys_mount(l, SCARG(uap, type), UIO_USERSPACE, SCARG(uap, path),
SCARG(uap, flags), SCARG(uap, data), UIO_USERSPACE,
SCARG(uap, data_len), retval);
}
int
-do_sys_mount(struct lwp *l, struct vfsops *vfsops, const char *type,
+do_sys_mount(struct lwp *l, const char *type, enum uio_seg type_seg,
const char *path, int flags, void *data, enum uio_seg data_seg,
size_t data_len, register_t *retval)
{
+ struct vfsops *vfsops;
struct vnode *vp;
void *data_buf = data;
bool vfsopsrele = false;
size_t alloc_sz = 0;
int error;
- /* XXX: The calling convention of this routine is totally bizarre */
- if (vfsops)
- vfsopsrele = true;
Home |
Main Index |
Thread Index |
Old Index