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 ATAIOCCOMMAND ioctl form COMPAT_NETB...



details:   https://anonhg.NetBSD.org/src/rev/6eedc02d40db
branches:  trunk
changeset: 326279:6eedc02d40db
user:      manu <manu%NetBSD.org@localhost>
date:      Fri Jan 24 10:41:07 2014 +0000

description:
Add ATAIOCCOMMAND ioctl form COMPAT_NETBSD32

This enables SMART monitoring by a netbsd32 binary.

diffstat:

 sys/compat/netbsd32/netbsd32_ioctl.c |  42 ++++++++++++++++++++++++++++++++++-
 sys/compat/netbsd32/netbsd32_ioctl.h |  20 ++++++++++++++++-
 2 files changed, 59 insertions(+), 3 deletions(-)

diffs (118 lines):

diff -r 4b0ebf55f17f -r 6eedc02d40db sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c      Fri Jan 24 10:19:18 2014 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c      Fri Jan 24 10:41:07 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_ioctl.c,v 1.67 2012/08/06 08:27:49 skrll Exp $        */
+/*     $NetBSD: netbsd32_ioctl.c,v 1.68 2014/01/24 10:41:07 manu 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.67 2012/08/06 08:27:49 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.68 2014/01/24 10:41:07 manu Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -43,6 +43,7 @@
 #include <sys/audioio.h>
 #include <sys/disklabel.h>
 #include <sys/dkio.h>
+#include <sys/ataio.h>
 #include <sys/sockio.h>
 #include <sys/socket.h>
 #include <sys/ttycom.h>
@@ -187,6 +188,23 @@
 }
 
 static inline void
+netbsd32_to_atareq(struct netbsd32_atareq *s32p, struct atareq *p, u_long cmd)
+{
+       p->flags = (u_long)s32p->flags;
+       p->command = s32p->command;
+       p->features = s32p->features;
+       p->sec_count = s32p->sec_count;
+       p->sec_num = s32p->sec_num;
+       p->head = s32p->head;
+       p->cylinder = s32p->cylinder;
+       p->databuf =  (char *)NETBSD32PTR64(s32p->databuf);
+       p->datalen = (u_long)s32p->datalen;
+       p->timeout = s32p->timeout;
+       p->retsts = s32p->retsts;
+       p->error = s32p->error;
+}
+
+static inline void
 netbsd32_to_vnd_ioctl(struct netbsd32_vnd_ioctl *s32p, struct vnd_ioctl *p, u_long cmd)
 {
 
@@ -481,6 +499,23 @@
 }
 
 static inline void
+netbsd32_from_atareq(struct atareq *p, struct netbsd32_atareq *s32p, u_long cmd)
+{
+       s32p->flags = (netbsd32_u_long)p->flags;
+       s32p->command = p->command;
+       s32p->features = p->features;
+       s32p->sec_count = p->sec_count;
+       s32p->sec_num = p->sec_num;
+       s32p->head = p->head;
+       s32p->cylinder = p->cylinder;
+       NETBSD32PTR32(s32p->databuf, p->databuf);
+       s32p->datalen = (netbsd32_u_long)p->datalen;
+       s32p->timeout = p->timeout;
+       s32p->retsts = p->retsts;
+       s32p->error = p->error;
+}
+
+static inline void
 netbsd32_from_vnd_ioctl(struct vnd_ioctl *p, struct netbsd32_vnd_ioctl *s32p, u_long cmd)
 {
 
@@ -837,6 +872,9 @@
                IOCTL_STRUCT_CONV_TO(DIOCWFORMAT, format_op);
 #endif
 
+       case ATAIOCCOMMAND32:
+               IOCTL_STRUCT_CONV_TO(ATAIOCCOMMAND, atareq);
+
 /*
  * only a few ifreq syscalls need conversion and those are
  * all driver specific... XXX
diff -r 4b0ebf55f17f -r 6eedc02d40db sys/compat/netbsd32/netbsd32_ioctl.h
--- a/sys/compat/netbsd32/netbsd32_ioctl.h      Fri Jan 24 10:19:18 2014 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.h      Fri Jan 24 10:41:07 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_ioctl.h,v 1.43 2012/05/28 14:19:10 christos Exp $     */
+/*     $NetBSD: netbsd32_ioctl.h,v 1.44 2014/01/24 10:41:07 manu Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -90,6 +90,24 @@
 #define DIOCWFORMAT32  _IOWR('d', 106, struct netbsd32_format_op)
 #endif
 
+/* from <sys/ataio.h> */
+struct netbsd32_atareq {
+       netbsd32_u_long         flags;
+       u_char                  command;
+       u_char                  features;
+       u_char                  sec_count;
+       u_char                  sec_num;
+       u_char                  head;
+       u_short                 cylinder;
+       netbsd32_voidp          databuf;
+       netbsd32_u_long         datalen;
+       int                     timeout;
+       u_char                  retsts;
+       u_char                  error;
+};
+#define ATAIOCCOMMAND32                _IOWR('Q', 8, struct netbsd32_atareq)
+
+
 /* from <net/bpf.h> */
 struct netbsd32_bpf_program {
        u_int bf_len;



Home | Main Index | Thread Index | Old Index