Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/netbsd32 support VND* ioctls.
details: https://anonhg.NetBSD.org/src/rev/986fa02992a7
branches: trunk
changeset: 757724:986fa02992a7
user: mrg <mrg%NetBSD.org@localhost>
date: Sun Sep 19 09:09:30 2010 +0000
description:
support VND* ioctls.
diffstat:
sys/compat/netbsd32/netbsd32_ioctl.c | 52 ++++++++++++++++++++++++++++++++++-
sys/compat/netbsd32/netbsd32_ioctl.h | 36 ++++++++++++++++++++++++-
2 files changed, 85 insertions(+), 3 deletions(-)
diffs (141 lines):
diff -r acf401cf653d -r 986fa02992a7 sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c Sun Sep 19 07:11:42 2010 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c Sun Sep 19 09:09:30 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ioctl.c,v 1.47 2010/04/23 15:19:20 rmind Exp $ */
+/* $NetBSD: netbsd32_ioctl.c,v 1.48 2010/09/19 09:09:30 mrg 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.47 2010/04/23 15:19:20 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.48 2010/09/19 09:09:30 mrg Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -216,6 +216,26 @@
p->wrong_if = (u_long)s32p->wrong_if;
}
+static inline void
+netbsd32_to_vnd_ioctl(struct netbsd32_vnd_ioctl *s32p, struct vnd_ioctl *p, u_long cmd)
+{
+
+ p->vnd_file = (char *)NETBSD32PTR64(s32p->vnd_file);
+ p->vnd_flags = s32p->vnd_flags;
+ p->vnd_geom = s32p->vnd_geom;
+ p->vnd_osize = s32p->vnd_osize;
+ p->vnd_size = s32p->vnd_size;
+}
+
+static inline void
+netbsd32_to_vnd_user(struct netbsd32_vnd_user *s32p, struct vnd_user *p, u_long cmd)
+{
+
+ p->vnu_unit = s32p->vnu_unit;
+ p->vnu_dev = s32p->vnu_dev;
+ p->vnu_ino = s32p->vnu_ino;
+}
+
/*
* handle ioctl conversions from 64-bit kernel -> netbsd32
*/
@@ -326,6 +346,25 @@
s32p->wrong_if = (netbsd32_u_long)p->wrong_if;
}
+static inline void
+netbsd32_from_vnd_ioctl(struct vnd_ioctl *p, struct netbsd32_vnd_ioctl *s32p, u_long cmd)
+{
+
+ s32p->vnd_flags = p->vnd_flags;
+ s32p->vnd_geom = p->vnd_geom;
+ s32p->vnd_osize = p->vnd_osize;
+ s32p->vnd_size = p->vnd_size;
+}
+
+static inline void
+netbsd32_from_vnd_user(struct vnd_user *p, struct netbsd32_vnd_user *s32p, u_long cmd)
+{
+
+ s32p->vnu_unit = p->vnu_unit;
+ s32p->vnu_dev = p->vnu_dev;
+ s32p->vnu_ino = p->vnu_ino;
+}
+
/*
* main ioctl syscall.
@@ -552,6 +591,15 @@
case SIOCGETSGCNT32:
IOCTL_STRUCT_CONV_TO(SIOCGETSGCNT, sioc_sg_req);
+ case VNDIOCSET32:
+ IOCTL_STRUCT_CONV_TO(VNDIOCSET, vnd_ioctl);
+
+ case VNDIOCCLR32:
+ IOCTL_STRUCT_CONV_TO(VNDIOCCLR, vnd_ioctl);
+
+ case VNDIOCGET32:
+ IOCTL_STRUCT_CONV_TO(VNDIOCGET, vnd_user);
+
default:
#ifdef NETBSD32_MD_IOCTL
error = netbsd32_md_ioctl(fp, com, data32, l);
diff -r acf401cf653d -r 986fa02992a7 sys/compat/netbsd32/netbsd32_ioctl.h
--- a/sys/compat/netbsd32/netbsd32_ioctl.h Sun Sep 19 07:11:42 2010 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.h Sun Sep 19 09:09:30 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ioctl.h,v 1.25 2009/12/09 04:50:47 christos Exp $ */
+/* $NetBSD: netbsd32_ioctl.h,v 1.26 2010/09/19 09:09:30 mrg Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -26,6 +26,15 @@
* SUCH DAMAGE.
*/
+#include <sys/device.h>
+#include <sys/disklabel.h>
+#include <sys/disk.h>
+
+#include <net/zlib.h>
+
+#include <dev/dkvar.h>
+#include <dev/vndvar.h>
+
/* we define some handy macros here... */
#define IOCTL_STRUCT_CONV_TO(cmd, type) \
size = IOCPARM_LEN(cmd); \
@@ -339,3 +348,28 @@
/* from <sys/sockio.h> */
#define SIOCGETSGCNT32 _IOWR('u', 52, struct netbsd32_sioc_sg_req) /* sg pkt cnt */
#endif
+
+/*
+ * The next two structures are marked "__packed" as they normally end up
+ * being padded in 64-bit mode.
+ */
+struct netbsd32_vnd_ioctl {
+ netbsd32_charp vnd_file; /* pathname of file to mount */
+ int vnd_flags; /* flags; see below */
+ struct vndgeom vnd_geom; /* geometry to emulate */
+ unsigned int vnd_osize; /* (returned) size of disk */
+ uint64_t vnd_size; /* (returned) size of disk */
+} __packed;
+
+struct netbsd32_vnd_user {
+ int vnu_unit; /* which vnd unit */
+ dev_t vnu_dev; /* file is on this device... */
+ ino_t vnu_ino; /* ...at this inode */
+} __packed;
+
+#if 1
+/* from <dev/vndvar.h> */
+#define VNDIOCSET32 _IOWR('F', 0, struct netbsd32_vnd_ioctl) /* enable disk */
+#define VNDIOCCLR32 _IOW('F', 1, struct netbsd32_vnd_ioctl) /* disable disk */
+#define VNDIOCGET32 _IOWR('F', 3, struct netbsd32_vnd_user) /* get list */
+#endif
Home |
Main Index |
Thread Index |
Old Index