Module Name:    src
Committed By:   christos
Date:           Mon Mar 16 00:05:29 UTC 2020

Modified Files:
        src/sys/compat/netbsd32: netbsd32_ioctl.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/compat/netbsd32/netbsd32_ioctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.110 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.111
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.110	Sat Mar 14 00:39:15 2020
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	Sun Mar 15 20:05:29 2020
@@ -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 @@ netbsd32_to_clockctl_clock_settime(
 	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 @@ netbsd32_to_clockctl_ntp_adjtime(
 	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 @@ netbsd32_from_clockctl_clock_settime(con
 	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 @@ netbsd32_from_clockctl_ntp_adjtime(const
 	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 @@ netbsd32_from_dkwedge_list(const struct 
 	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 @@ netbsd32_ioctl(struct lwp *l,
 		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:

Reply via email to