Handle FSSIOCSET and FSSIOCGET; vndconfig(8) works with compat32 now.

XXX: FSSIOCSET50 and FSSIOCGET50 are not (yet) handled.
This commit is contained in:
simonb 2021-01-14 08:00:45 +00:00
parent 4a20ca39ed
commit f89159bb0d
3 changed files with 80 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32.h,v 1.134 2020/11/01 18:51:02 pgoyette Exp $ */
/* $NetBSD: netbsd32.h,v 1.135 2021/01/14 08:00:45 simonb Exp $ */
/*
* Copyright (c) 1998, 2001, 2008, 2015 Matthew R. Green
@ -203,6 +203,7 @@ typedef netbsd32_pointer_t netbsd32_semidp_t;
typedef netbsd32_uint64 netbsd32_dev_t;
typedef netbsd32_int64 netbsd32_off_t;
typedef netbsd32_uint64 netbsd32_ino_t;
typedef netbsd32_int64 netbsd32_blkcnt_t;
/* from <sys/spawn.h> */
typedef netbsd32_pointer_t netbsd32_posix_spawn_file_actionsp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_ioctl.c,v 1.114 2020/07/21 05:33:51 simonb Exp $ */
/* $NetBSD: netbsd32_ioctl.c,v 1.115 2021/01/14 08:00:45 simonb 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.114 2020/07/21 05:33:51 simonb Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.115 2021/01/14 08:00:45 simonb Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
@ -93,6 +93,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.114 2020/07/21 05:33:51 simonb
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>
#include <dev/fssvar.h>
#include <dev/vndvar.h>
/* convert to/from different structures */
@ -260,6 +261,30 @@ netbsd32_to_atareq(struct netbsd32_atareq *s32p, struct atareq *p, u_long cmd)
p->error = s32p->error;
}
static inline void
netbsd32_to_fss_set(struct netbsd32_fss_set *s32p, struct fss_set *p,
u_long cmd)
{
p->fss_mount = (char *)NETBSD32PTR64(s32p->fss_mount);
p->fss_bstore = (char *)NETBSD32PTR64(s32p->fss_bstore);
p->fss_csize = s32p->fss_csize;
p->fss_flags = s32p->fss_flags;
}
static inline void
netbsd32_to_fss_get(struct netbsd32_fss_get *s32p, struct fss_get *p,
u_long cmd)
{
memcpy(p->fsg_mount, s32p->fsg_mount, MNAMELEN);
netbsd32_to_timeval(&s32p->fsg_time, &p->fsg_time);
p->fsg_csize = s32p->fsg_csize;
p->fsg_mount_size = s32p->fsg_mount_size;
p->fsg_bs_size = s32p->fsg_bs_size;
}
static inline void
netbsd32_to_vnd_ioctl(struct netbsd32_vnd_ioctl *s32p,
struct vnd_ioctl *p, u_long cmd)
@ -748,6 +773,30 @@ netbsd32_from_atareq(struct atareq *p,
s32p->error = p->error;
}
static inline void
netbsd32_from_fss_set(struct fss_set *p, struct netbsd32_fss_set *s32p,
u_long cmd)
{
NETBSD32PTR32(s32p->fss_mount, p->fss_mount);
NETBSD32PTR32(s32p->fss_bstore, p->fss_bstore);
s32p->fss_csize = p->fss_csize;
s32p->fss_flags = p->fss_flags;
}
static inline void
netbsd32_from_fss_get(struct fss_get *p, struct netbsd32_fss_get *s32p,
u_long cmd)
{
memcpy(s32p->fsg_mount, p->fsg_mount, MNAMELEN);
netbsd32_from_timeval(&p->fsg_time, &s32p->fsg_time);
s32p->fsg_csize = p->fsg_csize;
s32p->fsg_mount_size = p->fsg_mount_size;
s32p->fsg_bs_size = p->fsg_bs_size;
}
static inline void
netbsd32_from_vnd_ioctl(struct vnd_ioctl *p,
struct netbsd32_vnd_ioctl *s32p, u_long cmd)
@ -1446,6 +1495,12 @@ netbsd32_ioctl(struct lwp *l,
case SIOCGETSGCNT32:
IOCTL_STRUCT_CONV_TO(SIOCGETSGCNT, sioc_sg_req);
case FSSIOCSET32: /* XXX FSSIOCSET50 not yet handled */
IOCTL_STRUCT_CONV_TO(FSSIOCSET, fss_set);
case FSSIOCGET32: /* XXX FSSIOCGET50 not yet handled */
IOCTL_STRUCT_CONV_TO(FSSIOCGET, fss_get);
case VNDIOCSET32:
IOCTL_STRUCT_CONV_TO(VNDIOCSET, vnd_ioctl);

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_ioctl.h,v 1.74 2021/01/14 02:43:04 simonb Exp $ */
/* $NetBSD: netbsd32_ioctl.h,v 1.75 2021/01/14 08:00:45 simonb Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@ -477,6 +477,26 @@ struct netbsd32_sioc_sg_req {
/* from <sys/sockio.h> */
#define SIOCGETSGCNT32 _IOWR('u', 52, struct netbsd32_sioc_sg_req) /* sg pkt cnt */
/* from <dev/ffsvar.h> */
struct netbsd32_fss_set {
netbsd32_charp fss_mount; /* Mount point of file system */
netbsd32_charp fss_bstore; /* Path of backing store */
blksize_t fss_csize; /* Preferred cluster size */
int fss_flags; /* Initial flags */
};
struct netbsd32_fss_get {
char fsg_mount[MNAMELEN]; /* Mount point of file system */
struct netbsd32_timeval fsg_time; /* Time this snapshot was taken */
blksize_t fsg_csize; /* Current cluster size */
netbsd32_blkcnt_t fsg_mount_size; /* # clusters on file system */
netbsd32_blkcnt_t fsg_bs_size; /* # clusters on backing store */
};
/* XXX: FSSIOCSET50 and FSSIOCGET50 are not (yet) handled */
#define FSSIOCSET32 _IOW('F', 5, struct netbsd32_fss_set) /* Configure */
#define FSSIOCGET32 _IOR('F', 1, struct netbsd32_fss_get) /* Status */
struct netbsd32_vnd_ioctl {
netbsd32_charp vnd_file; /* pathname of file to mount */
int vnd_flags; /* flags; see below */