Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/netbsd32 provide clockctl ioctl emulation



details:   https://anonhg.NetBSD.org/src/rev/14d3f5850e93
branches:  trunk
changeset: 779222:14d3f5850e93
user:      christos <christos%NetBSD.org@localhost>
date:      Fri May 11 19:00:36 2012 +0000

description:
provide clockctl ioctl emulation

diffstat:

 sys/compat/netbsd32/netbsd32_ioctl.c |  162 ++++++++++++++++++++++------------
 sys/compat/netbsd32/netbsd32_ioctl.h |   35 +++++++-
 2 files changed, 137 insertions(+), 60 deletions(-)

diffs (257 lines):

diff -r 048e7b2fe0e9 -r 14d3f5850e93 sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c      Fri May 11 18:41:12 2012 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c      Fri May 11 19:00:36 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_ioctl.c,v 1.64 2011/10/06 03:19:32 macallan Exp $     */
+/*     $NetBSD: netbsd32_ioctl.c,v 1.65 2012/05/11 19:00:36 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.64 2011/10/06 03:19:32 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.65 2012/05/11 19:00:36 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -52,6 +52,7 @@
 #include <sys/kmem.h>
 #include <sys/envsys.h>
 #include <sys/wdog.h>
+#include <sys/clockctl.h>
 
 #ifdef __sparc__
 #include <dev/sun/fbio.h>
@@ -76,63 +77,6 @@
 
 #include <dev/vndvar.h>
 
-/* prototypes for the converters */
-static inline void netbsd32_to_partinfo(struct netbsd32_partinfo *,
-                                         struct partinfo *, u_long);
-#if 0
-static inline void netbsd32_to_format_op(struct netbsd32_format_op *,
-                                          struct format_op *, u_long);
-#endif
-static inline void netbsd32_to_oifreq(struct netbsd32_oifreq *, struct oifreq *,
-                                      u_long cmd);
-static inline void netbsd32_to_ifreq(struct netbsd32_ifreq *, struct ifreq *,
-                                      u_long cmd);
-static inline void netbsd32_to_if_addrprefreq(
-    const struct netbsd32_if_addrprefreq *, struct if_addrprefreq *, u_long);
-static inline void netbsd32_to_ifconf(struct netbsd32_ifconf *,
-                                       struct ifconf *, u_long);
-static inline void netbsd32_to_ifmediareq(struct netbsd32_ifmediareq *,
-                                           struct ifmediareq *, u_long);
-static inline void netbsd32_to_ifdrv(struct netbsd32_ifdrv *, struct ifdrv *,
-                                      u_long);
-static inline void netbsd32_to_sioc_vif_req(struct netbsd32_sioc_vif_req *,
-                                             struct sioc_vif_req *, u_long);
-static inline void netbsd32_to_sioc_sg_req(struct netbsd32_sioc_sg_req *,
-                                            struct sioc_sg_req *, u_long);
-static inline void netbsd32_from_partinfo(struct partinfo *,
-                                           struct netbsd32_partinfo *, u_long);
-#if 0
-static inline void netbsd32_from_format_op(struct format_op *,
-                                            struct netbsd32_format_op *,
-                                            u_long);
-#endif
-static inline void netbsd32_from_if_addrprefreq(const struct if_addrprefreq *,
-                                       struct netbsd32_if_addrprefreq *,
-                                       u_long);
-static inline void netbsd32_from_ifreq(struct ifreq *,
-                                         struct netbsd32_ifreq *, u_long);
-static inline void netbsd32_from_oifreq(struct oifreq *,
-                                         struct netbsd32_oifreq *, u_long);
-static inline void netbsd32_from_ifconf(struct ifconf *,
-                                         struct netbsd32_ifconf *, u_long);
-static inline void netbsd32_from_ifmediareq(struct ifmediareq *,
-                                             struct netbsd32_ifmediareq *,
-                                             u_long);
-static inline void netbsd32_from_ifdrv(struct ifdrv *,
-                                        struct netbsd32_ifdrv *, u_long);
-static inline void netbsd32_from_sioc_vif_req(struct sioc_vif_req *,
-                                               struct netbsd32_sioc_vif_req *,
-                                               u_long);
-static inline void netbsd32_from_sioc_sg_req(struct sioc_sg_req *,
-                                              struct netbsd32_sioc_sg_req *,
-                                              u_long);
-
-/* wsdisplay stuff */
-static inline void netbsd32_to_wsdisplay_addscreendata(
-                       struct netbsd32_wsdisplay_addscreendata *,
-                       struct wsdisplay_addscreendata *,
-                       u_long);
-
 /* convert to/from different structures */
 
 static inline void
@@ -361,6 +305,50 @@
        c->mask = NETBSD32PTR64(c32->mask);
 }
 
+static inline void
+netbsd32_to_clockctl_settimeofday(
+    const struct netbsd32_clockctl_settimeofday *s32p,
+    struct clockctl_settimeofday *p,
+    u_long cmd)
+{
+
+       p->tv = NETBSD32PTR64(s32p->tv);
+       p->tzp = NETBSD32PTR64(s32p->tzp);
+}
+
+static inline void
+netbsd32_to_clockctl_adjtime(
+    const struct netbsd32_clockctl_adjtime *s32p,
+    struct clockctl_adjtime *p,
+    u_long cmd)
+{
+
+       p->delta = NETBSD32PTR64(s32p->delta);
+       p->olddelta = NETBSD32PTR64(s32p->olddelta);
+}
+
+static inline void
+netbsd32_to_clockctl_clock_settime(
+    const struct netbsd32_clockctl_clock_settime *s32p,
+    struct clockctl_clock_settime *p,
+    u_long cmd)
+{
+
+       p->clock_id = s32p->clock_id;
+       p->tp = NETBSD32PTR64(s32p->tp);
+}
+
+static inline void
+netbsd32_to_clockctl_ntp_adjtime(
+    const struct netbsd32_clockctl_ntp_adjtime *s32p,
+    struct clockctl_ntp_adjtime *p,
+    u_long cmd)
+{
+
+       p->tp = NETBSD32PTR64(s32p->tp);
+       p->retval = s32p->retval;
+}
+
 /*
  * handle ioctl conversions from 64-bit kernel -> netbsd32
  */
@@ -598,6 +586,50 @@
        *s32p = (netbsd32_u_long)*p;
 }
 
+static inline void
+netbsd32_from_clockctl_settimeofday(
+    const struct clockctl_settimeofday *p,
+    struct netbsd32_clockctl_settimeofday *s32p,
+    u_long cmd)
+{
+
+       NETBSD32PTR32(s32p->tv, p->tv);
+       NETBSD32PTR32(s32p->tzp, p->tzp);
+}
+
+static inline void
+netbsd32_from_clockctl_adjtime(
+    const struct clockctl_adjtime *p,
+    struct netbsd32_clockctl_adjtime *s32p,
+    u_long cmd)
+{
+
+       NETBSD32PTR32(s32p->delta, p->delta);
+       NETBSD32PTR32(s32p->olddelta, p->olddelta);
+}
+
+static inline void
+netbsd32_from_clockctl_clock_settime(
+    const struct clockctl_clock_settime *p,
+    struct netbsd32_clockctl_clock_settime *s32p,
+    u_long cmd)
+{
+
+       s32p->clock_id = p->clock_id;
+       NETBSD32PTR32(s32p->tp, p->tp);
+}
+
+static inline void
+netbsd32_from_clockctl_ntp_adjtime(
+    const struct clockctl_ntp_adjtime *p,
+    struct netbsd32_clockctl_ntp_adjtime *s32p,
+    u_long cmd)
+{
+
+       NETBSD32PTR32(s32p->tp, p->tp);
+       s32p->retval = p->retval;
+}
+
 /*
  * main ioctl syscall.
  *
@@ -927,6 +959,18 @@
        case POWER_EVENT_RECVDICT32:
                IOCTL_STRUCT_CONV_TO(POWER_EVENT_RECVDICT, plistref);
 
+       case CLOCKCTL_SETTIMEOFDAY32:
+               IOCTL_STRUCT_CONV_TO(CLOCKCTL_SETTIMEOFDAY,
+                   clockctl_settimeofday);
+       case CLOCKCTL_ADJTIME32:
+               IOCTL_STRUCT_CONV_TO(CLOCKCTL_ADJTIME, clockctl_adjtime);
+       case CLOCKCTL_CLOCK_SETTIME32:
+               IOCTL_STRUCT_CONV_TO(CLOCKCTL_CLOCK_SETTIME,
+                   clockctl_clock_settime);
+       case CLOCKCTL_NTP_ADJTIME32:
+               IOCTL_STRUCT_CONV_TO(CLOCKCTL_NTP_ADJTIME,
+                   clockctl_ntp_adjtime);
+
        default:
 #ifdef NETBSD32_MD_IOCTL
                error = netbsd32_md_ioctl(fp, com, data32, l);
diff -r 048e7b2fe0e9 -r 14d3f5850e93 sys/compat/netbsd32/netbsd32_ioctl.h
--- a/sys/compat/netbsd32/netbsd32_ioctl.h      Fri May 11 18:41:12 2012 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.h      Fri May 11 19:00:36 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_ioctl.h,v 1.41 2011/09/28 01:46:39 macallan Exp $     */
+/*     $NetBSD: netbsd32_ioctl.h,v 1.42 2012/05/11 19:00:36 christos Exp $     */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -463,3 +463,36 @@
        int             wc_count;
 };
 #define WDOGIOC_GWDOGS32       _IOWR('w', 5, struct netbsd32_wdog_conf)
+
+
+struct netbsd32_clockctl_settimeofday {
+       netbsd32_timevalp_t tv;
+       netbsd32_voidp tzp;
+};
+
+#define CLOCKCTL_SETTIMEOFDAY32 _IOW('C', 0x5, \
+    struct netbsd32_clockctl_settimeofday)
+
+struct netbsd32_clockctl_adjtime {
+       netbsd32_timevalp_t delta;
+       netbsd32_timevalp_t olddelta;
+};
+
+#define CLOCKCTL_ADJTIME32 _IOWR('C', 0x6, struct netbsd32_clockctl_adjtime)
+
+struct netbsd32_clockctl_clock_settime {
+       netbsd32_clockid_t clock_id;
+       netbsd32_timespecp_t tp;
+};
+
+#define CLOCKCTL_CLOCK_SETTIME32 _IOW('C', 0x7, \
+    struct netbsd32_clockctl_clock_settime)
+
+struct netbsd32_clockctl_ntp_adjtime {
+       netbsd32_timexp_t tp;
+       /* register_t */ int32_t retval;
+};
+
+#define CLOCKCTL_NTP_ADJTIME32 _IOWR('C', 0x8, \
+    struct netbsd32_clockctl_ntp_adjtime)
+



Home | Main Index | Thread Index | Old Index