Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/pgoyette-compat]: src/sys Additional use of NTP function pointers, since...
details: https://anonhg.NetBSD.org/src/rev/b5a8aef9e34d
branches: pgoyette-compat
changeset: 830792:b5a8aef9e34d
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Tue Sep 25 21:41:30 2018 +0000
description:
Additional use of NTP function pointers, since the NTP code might not
exist in the kernel. (NTP is not (yet) a module, so we don't need to
use the MP-safe mechanism.)
diffstat:
sys/compat/netbsd32/netbsd32_compat_30.c | 12 ++++++++----
sys/compat/netbsd32/netbsd32_compat_50.c | 12 ++++++++----
sys/compat/netbsd32/netbsd32_ioctl.c | 10 +++++++---
sys/compat/netbsd32/netbsd32_time.c | 18 ++++++++++++------
sys/kern/compat_stub.c | 4 +++-
sys/sys/compat_stub.h | 4 +++-
6 files changed, 41 insertions(+), 19 deletions(-)
diffs (246 lines):
diff -r 97ed7e84eebb -r b5a8aef9e34d sys/compat/netbsd32/netbsd32_compat_30.c
--- a/sys/compat/netbsd32/netbsd32_compat_30.c Tue Sep 25 01:26:58 2018 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_30.c Tue Sep 25 21:41:30 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_30.c,v 1.31.16.10 2018/09/23 08:02:50 pgoyette Exp $ */
+/* $NetBSD: netbsd32_compat_30.c,v 1.31.16.11 2018/09/25 21:41:30 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_30.c,v 1.31.16.10 2018/09/23 08:02:50 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_30.c,v 1.31.16.11 2018/09/25 21:41:30 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include <opt_ntp.h>
@@ -55,6 +55,7 @@
#include <sys/dirent.h>
#include <sys/kauth.h>
#include <sys/vfs_syscalls.h>
+#include <sys/compat_stub.h>
#include <compat/netbsd32/netbsd32.h>
#include <compat/netbsd32/netbsd32_syscall.h>
@@ -312,8 +313,11 @@
struct ntptimeval ntv;
int error = 0;
+ if (vec_ntp_gettime == NULL)
+ return EINVAL;
+
if (SCARG_P32(uap, ntvp)) {
- ntp_gettime(&ntv);
+ (*vec_ntp_gettime)(&ntv);
ntv32.time.tv_sec = ntv.time.tv_sec;
ntv32.time.tv_usec = ntv.time.tv_nsec / 1000;
@@ -322,7 +326,7 @@
error = copyout(&ntv32, SCARG_P32(uap, ntvp), sizeof(ntv32));
}
if (!error) {
- *retval = ntp_timestatus();
+ *retval = (*vec_ntp_timestatus)();
}
return (error);
diff -r 97ed7e84eebb -r b5a8aef9e34d sys/compat/netbsd32/netbsd32_compat_50.c
--- a/sys/compat/netbsd32/netbsd32_compat_50.c Tue Sep 25 01:26:58 2018 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_50.c Tue Sep 25 21:41:30 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_50.c,v 1.32.16.9 2018/09/23 09:16:25 pgoyette Exp $ */
+/* $NetBSD: netbsd32_compat_50.c,v 1.32.16.10 2018/09/25 21:41:30 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.32.16.9 2018/09/23 09:16:25 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.32.16.10 2018/09/25 21:41:30 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -68,6 +68,7 @@
#include <sys/kauth.h>
#include <sys/vfs_syscalls.h>
#include <sys/rnd.h>
+#include <sys/compat_stub.h>
#include <compat/netbsd32/netbsd32.h>
#include <compat/netbsd32/netbsd32_syscall.h>
@@ -943,8 +944,11 @@
struct ntptimeval ntv;
int error = 0;
+ if (vec_ntp_gettime == NULL)
+ return EINVAL;
+
if (SCARG_P32(uap, ntvp)) {
- ntp_gettime(&ntv);
+ (*vec_ntp_gettime)(&ntv);
ntv32.time.tv_sec = (int32_t)ntv.time.tv_sec;
ntv32.time.tv_nsec = ntv.time.tv_nsec;
@@ -955,7 +959,7 @@
error = copyout(&ntv32, SCARG_P32(uap, ntvp), sizeof(ntv32));
}
if (!error) {
- *retval = ntp_timestatus();
+ *retval = (*vec_ntp_timestatus)();
}
return (error);
diff -r 97ed7e84eebb -r b5a8aef9e34d sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c Tue Sep 25 01:26:58 2018 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c Tue Sep 25 21:41:30 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ioctl.c,v 1.91.2.2 2018/09/06 06:55:46 pgoyette Exp $ */
+/* $NetBSD: netbsd32_ioctl.c,v 1.91.2.3 2018/09/25 21:41:30 pgoyette 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.91.2.2 2018/09/06 06:55:46 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.91.2.3 2018/09/25 21:41:30 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
@@ -61,6 +61,7 @@
#include <sys/exec_elf.h>
#include <sys/ksyms.h>
#include <sys/drvctlio.h>
+#include <sys/compat_stub.h>
#ifdef __sparc__
#include <dev/sun/fbio.h>
@@ -1010,12 +1011,15 @@
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);
- ntp_adjtime1(&ntv);
+ (*vec_ntp_adjtime1)(&ntv);
netbsd32_from_timex(&ntv, &ntv32);
error = copyout(&ntv32, args->tp, sizeof(ntv));
diff -r 97ed7e84eebb -r b5a8aef9e34d sys/compat/netbsd32/netbsd32_time.c
--- a/sys/compat/netbsd32/netbsd32_time.c Tue Sep 25 01:26:58 2018 +0000
+++ b/sys/compat/netbsd32/netbsd32_time.c Tue Sep 25 21:41:30 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_time.c,v 1.49.12.1 2018/09/11 23:58:46 pgoyette Exp $ */
+/* $NetBSD: netbsd32_time.c,v 1.49.12.2 2018/09/25 21:41:30 pgoyette Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.49.12.1 2018/09/11 23:58:46 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.49.12.2 2018/09/25 21:41:30 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
@@ -63,8 +63,11 @@
struct ntptimeval ntv;
int error = 0;
+ if (vec_ntp_gettime == NULL)
+ return EINVAL;
+
if (SCARG_P32(uap, ntvp)) {
- ntp_gettime(&ntv);
+ (*vec_ntp_gettime)(&ntv);
ntv32.time.tv_sec = ntv.time.tv_sec;
ntv32.time.tv_nsec = ntv.time.tv_nsec;
@@ -75,7 +78,7 @@
error = copyout(&ntv32, SCARG_P32(uap, ntvp), sizeof(ntv32));
}
if (!error) {
- *retval = ntp_timestatus();
+ *retval = (*vec_ntp_timestatus)();
}
return (error);
@@ -92,6 +95,9 @@
int error = 0;
int modes;
+ if (vec_ntp_adjtime1 == NULL)
+ return EINVAL;
+
if ((error = copyin(SCARG_P32(uap, tp), &ntv32, sizeof(ntv32))))
return (error);
@@ -108,12 +114,12 @@
NULL)))
return (error);
- ntp_adjtime1(&ntv);
+ (*vec_ntp_adjtime1(&ntv);
netbsd32_from_timex(&ntv, &ntv32);
error = copyout(&ntv32, SCARG_P32(uap, tp), sizeof(ntv32));
if (!error) {
- *retval = ntp_timestatus();
+ *retval = (*vec_ntp_timestatus)();
}
return error;
}
diff -r 97ed7e84eebb -r b5a8aef9e34d sys/kern/compat_stub.c
--- a/sys/kern/compat_stub.c Tue Sep 25 01:26:58 2018 +0000
+++ b/sys/kern/compat_stub.c Tue Sep 25 21:41:30 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.24 2018/09/23 22:00:58 pgoyette Exp $ */
+/* $NetBSD: compat_stub.c,v 1.1.2.25 2018/09/25 21:41:30 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -52,9 +52,11 @@
#ifdef NTP
void (*vec_ntp_gettime)(struct ntptimeval *) = ntp_gettime;
int (*vec_ntp_timestatus)(void) = ntp_timestatus;
+void (*vec_ntp_adjtime1)(struct timex *) = ntp_adjtime1;
#else
void (*vec_ntp_gettime)(struct ntptimeval *) = NULL;
int (*vec_ntp_timestatus)(void) = NULL;
+void (*vec_ntp_adjtime1)(struct timex *) = NULL;
#endif
/*
diff -r 97ed7e84eebb -r b5a8aef9e34d sys/sys/compat_stub.h
--- a/sys/sys/compat_stub.h Tue Sep 25 01:26:58 2018 +0000
+++ b/sys/sys/compat_stub.h Tue Sep 25 21:41:30 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.h,v 1.1.2.36 2018/09/23 11:23:47 pgoyette Exp $ */
+/* $NetBSD: compat_stub.h,v 1.1.2.37 2018/09/25 21:41:30 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -42,9 +42,11 @@
*/
struct ntptimeval;
+struct timex;
extern void (*vec_ntp_gettime)(struct ntptimeval *);
extern int (*vec_ntp_timestatus)(void);
+extern void (*vec_ntp_adjtime1)(struct timex *);
MODULE_HOOK2(ntp_gettime_hooks, (struct ntptimeval *), (void))
Home |
Main Index |
Thread Index |
Old Index