add support for the netbsd 5.0 versions of the VND* ioctls.

This commit is contained in:
mrg 2010-09-19 09:46:59 +00:00
parent d56ef50154
commit c97f9c82aa
2 changed files with 41 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_ioctl.c,v 1.48 2010/09/19 09:09:30 mrg Exp $ */
/* $NetBSD: netbsd32_ioctl.c,v 1.49 2010/09/19 09:46:59 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.48 2010/09/19 09:09:30 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.49 2010/09/19 09:46:59 mrg Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -71,6 +71,8 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.48 2010/09/19 09:09:30 mrg Exp
#include <compat/netbsd32/netbsd32_ioctl.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <dev/vndvar.h>
/* prototypes for the converters */
static inline void netbsd32_to_partinfo(struct netbsd32_partinfo *,
struct partinfo *, u_long);
@ -236,6 +238,16 @@ netbsd32_to_vnd_user(struct netbsd32_vnd_user *s32p, struct vnd_user *p, u_long
p->vnu_ino = s32p->vnu_ino;
}
static inline void
netbsd32_to_vnd_ioctl50(struct netbsd32_vnd_ioctl50 *s32p, struct vnd_ioctl50 *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_size = s32p->vnd_size;
}
/*
* handle ioctl conversions from 64-bit kernel -> netbsd32
*/
@ -365,6 +377,15 @@ netbsd32_from_vnd_user(struct vnd_user *p, struct netbsd32_vnd_user *s32p, u_lon
s32p->vnu_ino = p->vnu_ino;
}
static inline void
netbsd32_from_vnd_ioctl50(struct vnd_ioctl50 *p, struct netbsd32_vnd_ioctl50 *s32p, u_long cmd)
{
s32p->vnd_flags = p->vnd_flags;
s32p->vnd_geom = p->vnd_geom;
s32p->vnd_size = p->vnd_size;
}
/*
* main ioctl syscall.
@ -600,6 +621,12 @@ printf("netbsd32_ioctl(%d, %x, %x): %s group %c base %d len %d\n",
case VNDIOCGET32:
IOCTL_STRUCT_CONV_TO(VNDIOCGET, vnd_user);
case VNDIOCSET5032:
IOCTL_STRUCT_CONV_TO(VNDIOCSET50, vnd_ioctl50);
case VNDIOCCLR5032:
IOCTL_STRUCT_CONV_TO(VNDIOCCLR50, vnd_ioctl50);
default:
#ifdef NETBSD32_MD_IOCTL
error = netbsd32_md_ioctl(fp, com, data32, l);

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_ioctl.h,v 1.26 2010/09/19 09:09:30 mrg Exp $ */
/* $NetBSD: netbsd32_ioctl.h,v 1.27 2010/09/19 09:46:59 mrg Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@ -372,4 +372,15 @@ struct netbsd32_vnd_user {
#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 */
/* from <dev/vnd.c> */
struct netbsd32_vnd_ioctl50 {
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_size; /* (returned) size of disk */
} __packed;
#define VNDIOCSET5032 _IOWR('F', 0, struct netbsd32_vnd_ioctl50)
#define VNDIOCCLR5032 _IOW('F', 1, struct netbsd32_vnd_ioctl50)
#endif