Fully emulate MDIOCLIST for compat32.

MFC after:	1 week
This commit is contained in:
kib 2011-03-25 11:43:49 +00:00
parent abbe29dccf
commit 0d40bf4b19

View File

@ -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;