Module Name: src
Committed By: manu
Date: Fri Jan 24 10:41:07 UTC 2014
Modified Files:
src/sys/compat/netbsd32: netbsd32_ioctl.c netbsd32_ioctl.h
Log Message:
Add ATAIOCCOMMAND ioctl form COMPAT_NETBSD32
This enables SMART monitoring by a netbsd32 binary.
To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/compat/netbsd32/netbsd32_ioctl.c
cvs rdiff -u -r1.43 -r1.44 src/sys/compat/netbsd32/netbsd32_ioctl.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/compat/netbsd32/netbsd32_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.67 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.68
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.67 Mon Aug 6 08:27:49 2012
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c Fri Jan 24 10:41:07 2014
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioc
#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 @@ netbsd32_to_sioc_sg_req(struct netbsd32_
}
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 @@ netbsd32_from_sioc_sg_req(struct sioc_sg
}
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 @@ netbsd32_ioctl(struct lwp *l, const stru
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
Index: src/sys/compat/netbsd32/netbsd32_ioctl.h
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.h:1.43 src/sys/compat/netbsd32/netbsd32_ioctl.h:1.44
--- src/sys/compat/netbsd32/netbsd32_ioctl.h:1.43 Mon May 28 14:19:10 2012
+++ src/sys/compat/netbsd32/netbsd32_ioctl.h Fri Jan 24 10:41:07 2014
@@ -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 @@ struct netbsd32_format_op {
#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;