From 6795d62e0d3e35d138c90daa9fd62d96fe2562b5 Mon Sep 17 00:00:00 2001 From: njoly Date: Fri, 24 Sep 2010 13:12:53 +0000 Subject: [PATCH] Add support for envsys(4) version 2 ioctls. --- sys/compat/netbsd32/netbsd32_ioctl.c | 28 ++++++++++++++++++++++++++-- sys/compat/netbsd32/netbsd32_ioctl.h | 12 +++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/sys/compat/netbsd32/netbsd32_ioctl.c b/sys/compat/netbsd32/netbsd32_ioctl.c index 408bb17e5ff6..dfc9f14e2293 100644 --- a/sys/compat/netbsd32/netbsd32_ioctl.c +++ b/sys/compat/netbsd32/netbsd32_ioctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.c,v 1.50 2010/09/19 10:33:31 mrg Exp $ */ +/* $NetBSD: netbsd32_ioctl.c,v 1.51 2010/09/24 13:12:53 njoly Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.50 2010/09/19 10:33:31 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.51 2010/09/24 13:12:53 njoly Exp $"); #include #include @@ -50,6 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.50 2010/09/19 10:33:31 mrg Exp #include #include #include +#include #ifdef __sparc__ #include @@ -248,6 +249,14 @@ netbsd32_to_vnd_ioctl50(struct netbsd32_vnd_ioctl50 *s32p, struct vnd_ioctl50 *p p->vnd_size = s32p->vnd_size; } +static inline void +netbsd32_to_plistref(struct netbsd32_plistref *s32p, struct plistref *p, u_long cmd) +{ + + p->pref_plist = NETBSD32PTR64(s32p->pref_plist); + p->pref_len = s32p->pref_len; +} + static inline void netbsd32_to_u_long(netbsd32_u_long *s32p, u_long *p, u_long cmd) { @@ -393,6 +402,14 @@ netbsd32_from_vnd_ioctl50(struct vnd_ioctl50 *p, struct netbsd32_vnd_ioctl50 *s3 s32p->vnd_size = p->vnd_size; } +static inline void +netbsd32_from_plistref(struct plistref *p, struct netbsd32_plistref *s32p, u_long cmd) +{ + + NETBSD32PTR32(s32p->pref_plist, p->pref_plist); + s32p->pref_len = p->pref_len; +} + static inline void netbsd32_from_u_long(u_long *p, netbsd32_u_long *s32p, u_long cmd) { @@ -644,6 +661,13 @@ printf("netbsd32_ioctl(%d, %x, %x): %s group %c base %d len %d\n", case VNDIOCCLR5032: IOCTL_STRUCT_CONV_TO(VNDIOCCLR50, vnd_ioctl50); + case ENVSYS_GETDICTIONARY32: + IOCTL_STRUCT_CONV_TO(ENVSYS_GETDICTIONARY, plistref); + case ENVSYS_SETDICTIONARY32: + IOCTL_STRUCT_CONV_TO(ENVSYS_SETDICTIONARY, plistref); + case ENVSYS_REMOVEPROPS32: + IOCTL_STRUCT_CONV_TO(ENVSYS_REMOVEPROPS, plistref); + default: #ifdef NETBSD32_MD_IOCTL error = netbsd32_md_ioctl(fp, com, data32, l); diff --git a/sys/compat/netbsd32/netbsd32_ioctl.h b/sys/compat/netbsd32/netbsd32_ioctl.h index a1bb5fec604b..4faa9d7a5669 100644 --- a/sys/compat/netbsd32/netbsd32_ioctl.h +++ b/sys/compat/netbsd32/netbsd32_ioctl.h @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.h,v 1.28 2010/09/19 10:33:31 mrg Exp $ */ +/* $NetBSD: netbsd32_ioctl.h,v 1.29 2010/09/24 13:12:53 njoly Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -372,3 +372,13 @@ struct netbsd32_vnd_ioctl50 { /* from */ #define VNDIOCSET5032 _IOWR('F', 0, struct netbsd32_vnd_ioctl50) #define VNDIOCCLR5032 _IOW('F', 1, struct netbsd32_vnd_ioctl50) + +struct netbsd32_plistref { + netbsd32_voidp pref_plist; /* plist data */ + netbsd32_size_t pref_len; /* total length of plist data */ +}; + +#define ENVSYS_GETDICTIONARY32 _IOWR('E', 0, struct netbsd32_plistref) +#define ENVSYS_SETDICTIONARY32 _IOWR('E', 1, struct netbsd32_plistref) +#define ENVSYS_REMOVEPROPS32 _IOWR('E', 2, struct netbsd32_plistref) +