Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/netbsd32 Handle the KFILTER_BYFILTER and KFILTER_...



details:   https://anonhg.NetBSD.org/src/rev/8af8c1f13f53
branches:  trunk
changeset: 958618:8af8c1f13f53
user:      simonb <simonb%NetBSD.org@localhost>
date:      Thu Jan 14 08:22:51 2021 +0000

description:
Handle the KFILTER_BYFILTER and KFILTER_BYNAME ioctls for compat32.
Passes "atf kernel/kqueue/t_ioctl".

diffstat:

 sys/compat/netbsd32/netbsd32_ioctl.c |  29 +++++++++++++++++++++++++++--
 sys/compat/netbsd32/netbsd32_ioctl.h |  15 ++++++++++++++-
 2 files changed, 41 insertions(+), 3 deletions(-)

diffs (93 lines):

diff -r 11bb3080ea4c -r 8af8c1f13f53 sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c      Thu Jan 14 08:00:45 2021 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c      Thu Jan 14 08:22:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_ioctl.c,v 1.115 2021/01/14 08:00:45 simonb Exp $      */
+/*     $NetBSD: netbsd32_ioctl.c,v 1.116 2021/01/14 08:22:51 simonb 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.115 2021/01/14 08:00:45 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.116 2021/01/14 08:22:51 simonb Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ntp.h"
@@ -244,6 +244,16 @@
 }
 
 static inline void
+netbsd32_to_kfilter_mapping(struct netbsd32_kfilter_mapping *s32p,
+    struct kfilter_mapping *p, u_long cmd)
+{
+
+       p->name = (char *)NETBSD32PTR64(s32p->name);
+       p->len = s32p->len;
+       p->filter = s32p->filter;
+}
+
+static inline void
 netbsd32_to_atareq(struct netbsd32_atareq *s32p, struct atareq *p, u_long cmd)
 {
 
@@ -755,6 +765,16 @@
 }
 
 static inline void
+netbsd32_from_kfilter_mapping(struct kfilter_mapping *p,
+    struct netbsd32_kfilter_mapping *s32p, u_long cmd)
+{
+
+       NETBSD32PTR32(s32p->name, p->name);
+       s32p->len = p->len;
+       s32p->filter = p->filter;
+}
+
+static inline void
 netbsd32_from_atareq(struct atareq *p,
     struct netbsd32_atareq *s32p, u_long cmd)
 {
@@ -1369,6 +1389,11 @@
                IOCTL_STRUCT_CONV_TO(DIOCWFORMAT, format_op);
 #endif
 
+       case KFILTER_BYFILTER32:
+               IOCTL_STRUCT_CONV_TO(KFILTER_BYFILTER, kfilter_mapping);
+       case KFILTER_BYNAME32:
+               IOCTL_STRUCT_CONV_TO(KFILTER_BYNAME, kfilter_mapping);
+
        case ATAIOCCOMMAND32:
                IOCTL_STRUCT_CONV_TO(ATAIOCCOMMAND, atareq);
 
diff -r 11bb3080ea4c -r 8af8c1f13f53 sys/compat/netbsd32/netbsd32_ioctl.h
--- a/sys/compat/netbsd32/netbsd32_ioctl.h      Thu Jan 14 08:00:45 2021 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.h      Thu Jan 14 08:22:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_ioctl.h,v 1.75 2021/01/14 08:00:45 simonb Exp $       */
+/*     $NetBSD: netbsd32_ioctl.h,v 1.76 2021/01/14 08:22:51 simonb Exp $       */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -89,6 +89,19 @@
 #define DIOCWFORMAT32  _IOWR('d', 106, struct netbsd32_format_op)
 #endif
 
+/* from <sys/event.h> */
+
+struct netbsd32_kfilter_mapping {
+       netbsd32_charp  name;           /* name to lookup or return */
+       netbsd32_size_t len;            /* length of name */
+       uint32_t        filter;         /* filter to lookup or return */
+};
+
+/* map filter to name (max size len) */
+#define KFILTER_BYFILTER32     _IOWR('k', 0, struct netbsd32_kfilter_mapping)
+/* map name to filter (len ignored) */
+#define KFILTER_BYNAME32       _IOWR('k', 1, struct netbsd32_kfilter_mapping)
+
 /* from <sys/ataio.h> */
 struct netbsd32_atareq {
        netbsd32_u_long         flags;



Home | Main Index | Thread Index | Old Index