Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/netbsd32 Don't open-code ioctls, pass back to the...



details:   https://anonhg.NetBSD.org/src/rev/d554298cf736
branches:  trunk
changeset: 970210:d554298cf736
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Mar 16 00:05:29 2020 +0000

description:
Don't open-code ioctls, pass back to the 64 bit ones (found by maxv@),

diffstat:

 sys/compat/netbsd32/netbsd32_ioctl.c |  64 ++---------------------------------
 1 files changed, 4 insertions(+), 60 deletions(-)

diffs (120 lines):

diff -r 07840b6a1350 -r d554298cf736 sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c      Sun Mar 15 23:51:27 2020 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c      Mon Mar 16 00:05:29 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_ioctl.c,v 1.110 2020/03/14 04:39:15 maxv Exp $        */
+/*     $NetBSD: netbsd32_ioctl.c,v 1.111 2020/03/16 00:05:29 christos Exp $    */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.110 2020/03/14 04:39:15 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.111 2020/03/16 00:05:29 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ntp.h"
@@ -498,7 +498,6 @@
        p->tp = NETBSD32PTR64(s32p->tp);
 }
 
-#ifdef NTP
 static inline void
 netbsd32_to_clockctl_ntp_adjtime(
     const struct netbsd32_clockctl_ntp_adjtime *s32p,
@@ -508,7 +507,6 @@
        p->tp = NETBSD32PTR64(s32p->tp);
        p->retval = s32p->retval;
 }
-#endif
 
 static inline void
 netbsd32_to_ksyms_gsymbol(const struct netbsd32_ksyms_gsymbol *s32p,
@@ -947,7 +945,6 @@
        NETBSD32PTR32(s32p->tp, p->tp);
 }
 
-#ifdef NTP
 static inline void
 netbsd32_from_clockctl_ntp_adjtime(const struct clockctl_ntp_adjtime *p,
     struct netbsd32_clockctl_ntp_adjtime *s32p, u_long cmd)
@@ -956,7 +953,6 @@
        NETBSD32PTR32(s32p->tp, p->tp);
        s32p->retval = p->retval;
 }
-#endif
 
 static inline void
 netbsd32_from_ksyms_gsymbol( const struct ksyms_gsymbol *p,
@@ -1039,34 +1035,6 @@
        s32p->dkwl_ncopied = p->dkwl_ncopied;
 }
 
-#ifdef NTP
-static int
-netbsd32_do_clockctl_ntp_adjtime(struct clockctl_ntp_adjtime *args)
-{
-
-       struct netbsd32_timex ntv32;
-       struct timex ntv;
-       int error;
-
-       if (vec_ntp_adjtime1 == NULL)
-               return EINVAL;
-
-       error = copyin(args->tp, &ntv32, sizeof(ntv32));
-       if (error)
-               return error;
-
-       netbsd32_to_timex(&ntv32, &ntv);
-       (*vec_ntp_adjtime1)(&ntv);
-       netbsd32_from_timex(&ntv, &ntv32);
-
-       error = copyout(&ntv32, args->tp, sizeof(ntv32));
-       if (error == 0)
-               args->retval = ntp_timestatus();
-
-       return error;
-}
-#endif
-
 /*
  * main ioctl syscall.
  *
@@ -1457,32 +1425,8 @@
                IOCTL_STRUCT_CONV_TO(CLOCKCTL_CLOCK_SETTIME,
                    clockctl_clock_settime);
        case CLOCKCTL_NTP_ADJTIME32:
-#ifdef NTP
-               {
-                       size = IOCPARM_LEN(CLOCKCTL_NTP_ADJTIME);
-                       if (size > sizeof(stkbuf))
-                               data = memp = kmem_alloc(size, KM_SLEEP);
-                       else
-                               data = (void *)stkbuf;
-
-                       netbsd32_to_clockctl_ntp_adjtime(
-                               (const struct netbsd32_clockctl_ntp_adjtime *)data32,
-                               (struct clockctl_ntp_adjtime *)data,
-                               CLOCKCTL_NTP_ADJTIME);
-                       error = netbsd32_do_clockctl_ntp_adjtime(
-                               (struct clockctl_ntp_adjtime *)data);
-                       netbsd32_from_clockctl_ntp_adjtime(
-                               (const struct clockctl_ntp_adjtime *)data,
-                               (struct netbsd32_clockctl_ntp_adjtime *)data32,
-                               CLOCKCTL_NTP_ADJTIME);
-
-                       break;
-               }
-#else
-               error = ENOTTY;
-               break;
-#endif /* NTP */
-
+               IOCTL_STRUCT_CONV_TO(CLOCKCTL_NTP_ADJTIME,
+                   clockctl_ntp_adjtime);
        case KIOCGSYMBOL32:
                IOCTL_STRUCT_CONV_TO(KIOCGSYMBOL, ksyms_gsymbol);
        case KIOCGVALUE32:



Home | Main Index | Thread Index | Old Index