From 0d40bf4b19470cb32fb5710521b366713b8d7edd Mon Sep 17 00:00:00 2001 From: kib Date: Fri, 25 Mar 2011 11:43:49 +0000 Subject: [PATCH] Fully emulate MDIOCLIST for compat32. MFC after: 1 week --- sys/compat/freebsd32/freebsd32_ioctl.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/compat/freebsd32/freebsd32_ioctl.c b/sys/compat/freebsd32/freebsd32_ioctl.c index 3fcc418370fa..227a08b3b8cb 100644 --- a/sys/compat/freebsd32/freebsd32_ioctl.c +++ b/sys/compat/freebsd32/freebsd32_ioctl.c @@ -64,7 +64,7 @@ freebsd32_ioctl_md(struct thread *td, struct freebsd32_ioctl_args *uap, struct md_ioctl mdv; struct md_ioctl32 md32; u_long com = 0; - int error; + int i, error; if (uap->com & IOC_IN) { if ((error = copyin(uap->data, &md32, sizeof(md32)))) { @@ -116,6 +116,14 @@ freebsd32_ioctl_md(struct thread *td, struct freebsd32_ioctl_args *uap, CP(mdv, md32, md_base); CP(mdv, md32, md_fwheads); CP(mdv, md32, md_fwsectors); + if (com == MDIOCLIST) { + /* + * Use MDNPAD, and not MDNPAD32. Padding is + * allocated and used by compat32 ABI. + */ + for (i = 0; i < MDNPAD; i++) + CP(mdv, md32, md_pad[i]); + } error = copyout(&md32, uap->data, sizeof(md32)); } return error;