Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/common Instead of calling clockctl_ioctl directly...



details:   https://anonhg.NetBSD.org/src/rev/898e0b1430f3
branches:  trunk
changeset: 772448:898e0b1430f3
user:      apb <apb%NetBSD.org@localhost>
date:      Wed Jan 04 14:31:17 2012 +0000

description:
Instead of calling clockctl_ioctl directly, lookup the cdevsw and
call its d_ioctl function.  This should fix an undefined reference to
`clockctlioctl' when you build a kernel that has COMPAT_50 but does not
have pseudo-device clockctl.

diffstat:

 sys/compat/common/kern_time_50.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (46 lines):

diff -r a6be092f47fa -r 898e0b1430f3 sys/compat/common/kern_time_50.c
--- a/sys/compat/common/kern_time_50.c  Wed Jan 04 14:09:48 2012 +0000
+++ b/sys/compat/common/kern_time_50.c  Wed Jan 04 14:31:17 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_time_50.c,v 1.21 2012/01/04 13:45:55 apb Exp $    */
+/*     $NetBSD: kern_time_50.c,v 1.22 2012/01/04 14:31:17 apb Exp $    */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.21 2012/01/04 13:45:55 apb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.22 2012/01/04 14:31:17 apb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -38,6 +38,7 @@
 #endif
 
 #include <sys/param.h>
+#include <sys/conf.h>
 #include <sys/systm.h>
 #include <sys/namei.h>
 #include <sys/filedesc.h>
@@ -625,6 +626,10 @@
     struct lwp *l)
 {
        int error = 0;
+       const struct cdevsw *cd = cdevsw_lookup(dev);
+
+       if (cd == NULL || cd->d_ioctl == NULL)
+               return ENXIO;
 
        switch (cmd) {
        case CLOCKCTL_OSETTIMEOFDAY: {
@@ -672,7 +677,7 @@
        }
        case CLOCKCTL_ONTP_ADJTIME:
                /* The ioctl number changed but the data did not change. */
-               error = clockctlioctl(dev, CLOCKCTL_NTP_ADJTIME,
+               error = (cd->d_ioctl)(dev, CLOCKCTL_NTP_ADJTIME,
                    data, flags, l);
                break;
        default:



Home | Main Index | Thread Index | Old Index