Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/netbsd32 Add netbsd32 support for drvctl(4)
details: https://anonhg.NetBSD.org/src/rev/b29e03111263
branches: trunk
changeset: 346444:b29e03111263
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Wed Jul 13 11:11:53 2016 +0000
description:
Add netbsd32 support for drvctl(4)
diffstat:
sys/compat/netbsd32/netbsd32_ioctl.c | 60 ++++++++++++++++++++++++++++++++++-
sys/compat/netbsd32/netbsd32_ioctl.h | 21 ++++++++++++-
2 files changed, 78 insertions(+), 3 deletions(-)
diffs (134 lines):
diff -r 68e715daaab1 -r b29e03111263 sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c Wed Jul 13 09:56:20 2016 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c Wed Jul 13 11:11:53 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ioctl.c,v 1.83 2015/12/08 20:36:14 christos Exp $ */
+/* $NetBSD: netbsd32_ioctl.c,v 1.84 2016/07/13 11:11:53 jmcneill 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.83 2015/12/08 20:36:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.84 2016/07/13 11:11:53 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -56,6 +56,7 @@
#include <sys/clockctl.h>
#include <sys/exec_elf.h>
#include <sys/ksyms.h>
+#include <sys/drvctlio.h>
#ifdef __sparc__
#include <dev/sun/fbio.h>
@@ -475,6 +476,29 @@
}
}
+static inline void
+netbsd32_to_devlistargs(
+ const struct netbsd32_devlistargs *s32p,
+ struct devlistargs *p,
+ u_long cmd)
+{
+ memcpy(p->l_devname, s32p->l_devname, sizeof(p->l_devname));
+ p->l_children = s32p->l_children;
+ p->l_childname = NETBSD32PTR64(s32p->l_childname);
+}
+
+static inline void
+netbsd32_to_devrescanargs(
+ const struct netbsd32_devrescanargs *s32p,
+ struct devrescanargs *p,
+ u_long cmd)
+{
+ memcpy(p->busname, s32p->busname, sizeof(p->busname));
+ memcpy(p->ifattr, s32p->ifattr, sizeof(p->ifattr));
+ p->numlocators = s32p->numlocators;
+ p->locators = NETBSD32PTR64(s32p->locators);
+}
+
/*
* handle ioctl conversions from 64-bit kernel -> netbsd32
*/
@@ -874,6 +898,29 @@
}
}
+static inline void
+netbsd32_from_devlistargs(
+ const struct devlistargs *p,
+ struct netbsd32_devlistargs *s32p,
+ u_long cmd)
+{
+ memcpy(s32p->l_devname, p->l_devname, sizeof(s32p->l_devname));
+ s32p->l_children = p->l_children;
+ NETBSD32PTR32(s32p->l_childname, p->l_childname);
+}
+
+static inline void
+netbsd32_from_devrescanargs(
+ const struct devrescanargs *p,
+ struct netbsd32_devrescanargs *s32p,
+ u_long cmd)
+{
+ memcpy(s32p->busname, p->busname, sizeof(s32p->busname));
+ memcpy(s32p->ifattr, p->ifattr, sizeof(s32p->ifattr));
+ s32p->numlocators = p->numlocators;
+ NETBSD32PTR32(s32p->locators, p->locators);
+}
+
/*
* main ioctl syscall.
*
@@ -1263,6 +1310,15 @@
case IOC_NPF_RULE32:
IOCTL_STRUCT_CONV_TO(IOC_NPF_RULE, plistref);
+ case DRVRESCANBUS32:
+ IOCTL_STRUCT_CONV_TO(DRVRESCANBUS, devrescanargs);
+ case DRVLISTDEV32:
+ IOCTL_STRUCT_CONV_TO(DRVLISTDEV, devlistargs);
+ case DRVCTLCOMMAND32:
+ IOCTL_STRUCT_CONV_TO(DRVCTLCOMMAND, plistref);
+ case DRVGETEVENT32:
+ IOCTL_STRUCT_CONV_TO(DRVGETEVENT, plistref);
+
default:
#ifdef NETBSD32_MD_IOCTL
error = netbsd32_md_ioctl(fp, com, data32, l);
diff -r 68e715daaab1 -r b29e03111263 sys/compat/netbsd32/netbsd32_ioctl.h
--- a/sys/compat/netbsd32/netbsd32_ioctl.h Wed Jul 13 09:56:20 2016 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.h Wed Jul 13 11:11:53 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ioctl.h,v 1.53 2015/12/08 20:36:14 christos Exp $ */
+/* $NetBSD: netbsd32_ioctl.h,v 1.54 2016/07/13 11:11:53 jmcneill Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -604,3 +604,22 @@
#define IOC_NPF_STATS32 _IOW('N', 104, netbsd32_voidp)
#define IOC_NPF_SAVE32 _IOR('N', 105, struct netbsd32_plistref)
#define IOC_NPF_RULE32 _IOWR('N', 107, struct netbsd32_plistref)
+
+/* From sys/drvctlio.h */
+struct netbsd32_devlistargs {
+ char l_devname[16];
+ netbsd32_charpp l_childname;
+ netbsd32_size_t l_children;
+};
+
+struct netbsd32_devrescanargs {
+ char busname[16];
+ char ifattr[16];
+ unsigned int numlocators;
+ netbsd32_intp locators;
+};
+
+#define DRVRESCANBUS32 _IOW('D', 124, struct netbsd32_devrescanargs)
+#define DRVCTLCOMMAND32 _IOWR('D', 125, struct netbsd32_plistref)
+#define DRVLISTDEV32 _IOWR('D', 127, struct netbsd32_devlistargs)
+#define DRVGETEVENT32 _IOR('D', 128, struct netbsd32_plistref)
Home |
Main Index |
Thread Index |
Old Index