Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Split out the quota code from the rest of compat_netbsd3...



details:   https://anonhg.NetBSD.org/src/rev/6f5dc507f5d9
branches:  trunk
changeset: 970094:6f5dc507f5d9
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Thu Mar 12 15:02:29 2020 +0000

description:
Split out the quota code from the rest of compat_netbsd32 module.  This
allows loading of compat_netbsd32 on kernels that don't have ``options
QUOTA'' enabled.

diffstat:

 sys/compat/netbsd32/files.netbsd32             |    4 +-
 sys/compat/netbsd32/netbsd32_compat_50.c       |   28 +------
 sys/compat/netbsd32/netbsd32_compat_50_quota.c |  100 +++++++++++++++++++++++++
 sys/compat/netbsd32/netbsd32_quota.c           |   34 +++++++-
 sys/compat/netbsd32/syscalls.master            |   15 +--
 sys/modules/Makefile                           |    6 +-
 sys/modules/compat_netbsd32/Makefile           |    7 +-
 sys/modules/compat_netbsd32_50/Makefile        |    4 +-
 sys/modules/compat_netbsd32_quota/Makefile     |   15 +++
 sys/modules/compat_netbsd32_quota_50/Makefile  |   15 +++
 10 files changed, 178 insertions(+), 50 deletions(-)

diffs (truncated from 396 to 300 lines):

diff -r 79f29b8851fb -r 6f5dc507f5d9 sys/compat/netbsd32/files.netbsd32
--- a/sys/compat/netbsd32/files.netbsd32        Thu Mar 12 14:52:04 2020 +0000
+++ b/sys/compat/netbsd32/files.netbsd32        Thu Mar 12 15:02:29 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.netbsd32,v 1.49 2019/09/22 22:59:38 christos Exp $
+#      $NetBSD: files.netbsd32,v 1.50 2020/03/12 15:02:29 pgoyette Exp $
 #
 # config file description for machine-independent netbsd32 compat code.
 # included by ports that need it.
@@ -54,6 +54,8 @@
 file   compat/netbsd32/netbsd32_compat_40.c    compat_netbsd32 & compat_40
 file   compat/netbsd32/netbsd32_compat_43.c    compat_netbsd32 & (compat_43 | compat_sunos | compat_linux32)
 file   compat/netbsd32/netbsd32_compat_50.c    compat_netbsd32 & compat_50
+file   compat/netbsd32/netbsd32_compat_50_quota.c compat_netbsd32 & compat_50 &
+                                                       quota
 file   compat/netbsd32/netbsd32_rndpseudo_50.c compat_netbsd32 & compat_50
 file   compat/netbsd32/netbsd32_compat_50_sysv.c compat_netbsd32 & compat_50 &
                                                (sysvmsg | sysvsem | sysvshm)
diff -r 79f29b8851fb -r 6f5dc507f5d9 sys/compat/netbsd32/netbsd32_compat_50.c
--- a/sys/compat/netbsd32/netbsd32_compat_50.c  Thu Mar 12 14:52:04 2020 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_50.c  Thu Mar 12 15:02:29 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_compat_50.c,v 1.46 2020/02/27 20:54:24 pgoyette Exp $ */
+/*     $NetBSD: netbsd32_compat_50.c,v 1.47 2020/03/12 15:02:29 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.46 2020/02/27 20:54:24 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.47 2020/03/12 15:02:29 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -916,26 +916,6 @@
        return copyout(&s32it, SCARG_P32(uap, itv), sizeof(s32it));
 }
 
-#ifdef QUOTA
-int
-compat_50_netbsd32_quotactl(struct lwp *l, const struct compat_50_netbsd32_quotactl_args *uap, register_t *retval)
-{
-       /* {
-               syscallarg(const netbsd32_charp) path;
-               syscallarg(int) cmd;
-               syscallarg(int) uid;
-               syscallarg(netbsd32_voidp) arg;
-       } */
-       struct compat_50_sys_quotactl_args ua;
-
-       NETBSD32TOP_UAP(path, const char);
-       NETBSD32TO64_UAP(cmd);
-       NETBSD32TO64_UAP(uid);
-       NETBSD32TOP_UAP(arg, void *);
-       return (compat_50_sys_quotactl(l, &ua, retval));
-}
-#endif
-
 #ifdef NTP
 int
 compat_50_netbsd32_ntp_gettime(struct lwp *l,
@@ -1026,10 +1006,6 @@
            (sy_call_t *)compat_50_netbsd32_setitimer }, 
        { NETBSD32_SYS_compat_50_netbsd32_getitimer, 0,
            (sy_call_t *)compat_50_netbsd32_getitimer }, 
-#ifdef QUOTA
-       { NETBSD32_SYS_compat_50_netbsd32_quotactl, 0,
-           (sy_call_t *)compat_50_netbsd32_quotactl }, 
-#endif
 #ifdef NTP
        { NETBSD32_SYS_compat_50_netbsd32_ntp_gettime, 0,
            (sy_call_t *)compat_50_netbsd32_ntp_gettime }, 
diff -r 79f29b8851fb -r 6f5dc507f5d9 sys/compat/netbsd32/netbsd32_compat_50_quota.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_50_quota.c    Thu Mar 12 15:02:29 2020 +0000
@@ -0,0 +1,100 @@
+/*     $NetBSD: netbsd32_compat_50_quota.c,v 1.1 2020/03/12 15:02:29 pgoyette Exp $    */
+
+/*-
+ * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50_quota.c,v 1.1 2020/03/12 15:02:29 pgoyette Exp $");
+
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#include "opt_compat_netbsd32.h"
+#include "opt_quota.h"
+#endif
+
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/syscallargs.h>
+#include <sys/syscallvar.h>
+
+#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_syscall.h>
+#include <compat/netbsd32/netbsd32_syscallargs.h>
+
+#if defined(COMPAT_50) && defined(QUOTA)
+
+int
+compat_50_netbsd32_quotactl(struct lwp *l, const struct compat_50_netbsd32_quotactl_args *uap, register_t *retval)
+{
+       /* {
+               syscallarg(const netbsd32_charp) path;
+               syscallarg(int) cmd;
+               syscallarg(int) uid;
+               syscallarg(netbsd32_voidp) arg;
+       } */
+       struct compat_50_sys_quotactl_args ua;
+
+       NETBSD32TOP_UAP(path, const char);
+       NETBSD32TO64_UAP(cmd);
+       NETBSD32TO64_UAP(uid);
+       NETBSD32TOP_UAP(arg, void *);
+       return (compat_50_sys_quotactl(l, &ua, retval));
+}
+
+static struct syscall_package compat_netbsd32_quota_50_syscalls[] = {
+       { NETBSD32_SYS_compat_50_netbsd32_quotactl, 0,
+           (sy_call_t *)compat_50_netbsd32_quotactl }, 
+       { 0, 0, NULL }
+}; 
+
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_quota_50,
+    "compat_netbsd32_50,compat_50,compat_50_quota");
+
+static int
+compat_netbsd32_quota_50_modcmd(modcmd_t cmd, void *arg)
+{
+       int ret;
+
+       switch (cmd) {
+       case MODULE_CMD_INIT:
+                ret = syscall_establish(&emul_netbsd32,
+                   compat_netbsd32_quota_50_syscalls);
+               return ret;
+
+       case MODULE_CMD_FINI:
+                ret = syscall_disestablish(&emul_netbsd32,
+                   compat_netbsd32_quota_50_syscalls);
+               return ret;
+
+       default:
+               return ENOTTY;
+       }
+}
+#endif /* COMPAT_50 && QUOTA */
diff -r 79f29b8851fb -r 6f5dc507f5d9 sys/compat/netbsd32/netbsd32_quota.c
--- a/sys/compat/netbsd32/netbsd32_quota.c      Thu Mar 12 14:52:04 2020 +0000
+++ b/sys/compat/netbsd32/netbsd32_quota.c      Thu Mar 12 15:02:29 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_quota.c,v 1.2 2019/06/18 16:22:54 christos Exp $      */
+/*     $NetBSD: netbsd32_quota.c,v 1.3 2020/03/12 15:02:29 pgoyette Exp $      */
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_quota.c,v 1.2 2019/06/18 16:22:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_quota.c,v 1.3 2020/03/12 15:02:29 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_quota.h"
@@ -38,13 +38,13 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/quotactl.h>
-#include <sys/filedesc.h>
+#include <sys/module.h>
 #include <sys/vfs_syscalls.h>
+#include <sys/syscallvar.h>
 
 #include <compat/netbsd32/netbsd32.h>
 #include <compat/netbsd32/netbsd32_syscall.h>
 #include <compat/netbsd32/netbsd32_syscallargs.h>
-#include <compat/netbsd32/netbsd32_conv.h>
 
 #ifdef QUOTA
 int
@@ -140,4 +140,30 @@
 
        return do_sys_quotactl(SCARG_P32(uap, path), &args);
 }
+static struct syscall_package compat_netbsd32_quota_syscalls[] = {
+       { NETBSD32_SYS_netbsd32___quotactl, 0,
+           (sy_call_t *)netbsd32___quotactl },
+       { 0, 0, NULL }
+};
+
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_quota, "compat_netbsd32");
+
+static int
+compat_netbsd32_quota_modcmd(modcmd_t cmd, void *arg)
+{
+       int ret;
+
+       switch (cmd) {
+       case MODULE_CMD_INIT:
+               ret = syscall_establish(&emul_netbsd32,
+                   compat_netbsd32_quota_syscalls);
+               return ret;
+       case MODULE_CMD_FINI:
+               ret = syscall_disestablish(&emul_netbsd32,
+                   compat_netbsd32_quota_syscalls);
+               return ret;
+       default:
+               return ENOTTY;
+       }
+}
 #endif
diff -r 79f29b8851fb -r 6f5dc507f5d9 sys/compat/netbsd32/syscalls.master
--- a/sys/compat/netbsd32/syscalls.master       Thu Mar 12 14:52:04 2020 +0000
+++ b/sys/compat/netbsd32/syscalls.master       Thu Mar 12 15:02:29 2020 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.132 2020/03/07 00:56:41 pgoyette Exp $
+       $NetBSD: syscalls.master,v 1.133 2020/03/12 15:02:29 pgoyette Exp $
 
 ;      from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp
 ;      @(#)syscalls.master     8.2 (Berkeley) 1/13/94
@@ -356,13 +356,9 @@
 146    COMPAT_43 MODULAR compat_netbsd32_43    \
                        { int|netbsd32||killpg(int pgid, int signum); }
 147    NOARGS          { int|sys||setsid(void); }
-#if defined(QUOTA) || !defined(_KERNEL_OPT)
-148    COMPAT_50 MODULAR compat_netbsd32_50    \
+148    COMPAT_50 MODULAR compat_netbsd32_quota_50      \
                        { int|netbsd32||quotactl(netbsd32_charp path, int cmd, \
                            int uid, netbsd32_voidp arg); }
-#else
-148    EXCL            compat_netbsd32_quotactl
-#endif
 149    EXCL            compat_netbsd32_quota
 150    COMPAT_43 MODULAR compat_netbsd32_43    \
                        { int|netbsd32||ogetsockname(int fdec, \
@@ -1127,12 +1123,9 @@
                            int flag); }
 472    STD             { int|netbsd32||futimens(int fd, \
                            const netbsd32_timespecp_t tptr); }
-#if defined(QUOTA) || !defined(_KERNEL_OPT)
-473    STD             { int|netbsd32||__quotactl(const netbsd32_charp path, \
+473    STD MODULAR compat_netbsd32_quota       \
+                       { int|netbsd32||__quotactl(const netbsd32_charp path, \
                            netbsd32_voidp args); }
-#else
-473    EXCL            netbsd32___quotactl
-#endif
 474    NOERR           { int|netbsd32||posix_spawn(netbsd32_pid_tp pid, \
                            const netbsd32_charp path, \
                            const netbsd32_posix_spawn_file_actionsp \
diff -r 79f29b8851fb -r 6f5dc507f5d9 sys/modules/Makefile
--- a/sys/modules/Makefile      Thu Mar 12 14:52:04 2020 +0000
+++ b/sys/modules/Makefile      Thu Mar 12 15:02:29 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.242 2020/03/11 08:31:08 skrll Exp $
+#      $NetBSD: Makefile,v 1.243 2020/03/12 15:02:29 pgoyette Exp $
 
 .include <bsd.own.mk>
 
@@ -301,11 +301,13 @@
 SUBDIR+=       compat_netbsd32_mqueue
 SUBDIR+=       compat_netbsd32_nfssrv
 SUBDIR+=       compat_netbsd32_ptrace
+SUBDIR+=       compat_netbsd32_quota
+SUBDIR+=       compat_netbsd32_quota_50
+SUBDIR+=       compat_netbsd32_raid
 SUBDIR+=       compat_netbsd32_sysvipc
 SUBDIR+=       compat_netbsd32_sysvipc_10



Home | Main Index | Thread Index | Old Index