| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: netbsd32_ioctl.c,v 1.91 2018/01/19 23:38:56 macallan Exp $ */ | | 1 | /* $NetBSD: netbsd32_ioctl.c,v 1.92 2018/03/06 07:59:59 mlelstv Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1998, 2001 Matthew R. Green | | 4 | * Copyright (c) 1998, 2001 Matthew R. Green |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -21,27 +21,27 @@ | | | @@ -21,27 +21,27 @@ |
21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | | 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
26 | * SUCH DAMAGE. | | 26 | * SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | /* | | 29 | /* |
30 | * handle ioctl conversions from netbsd32 -> 64-bit kernel | | 30 | * handle ioctl conversions from netbsd32 -> 64-bit kernel |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #include <sys/cdefs.h> | | 33 | #include <sys/cdefs.h> |
34 | __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.91 2018/01/19 23:38:56 macallan Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.92 2018/03/06 07:59:59 mlelstv Exp $"); |
35 | | | 35 | |
36 | #if defined(_KERNEL_OPT) | | 36 | #if defined(_KERNEL_OPT) |
37 | #include "opt_ntp.h" | | 37 | #include "opt_ntp.h" |
38 | #endif | | 38 | #endif |
39 | | | 39 | |
40 | #include <sys/param.h> | | 40 | #include <sys/param.h> |
41 | #include <sys/systm.h> | | 41 | #include <sys/systm.h> |
42 | #include <sys/filedesc.h> | | 42 | #include <sys/filedesc.h> |
43 | #include <sys/ioctl.h> | | 43 | #include <sys/ioctl.h> |
44 | #include <sys/file.h> | | 44 | #include <sys/file.h> |
45 | #include <sys/proc.h> | | 45 | #include <sys/proc.h> |
46 | #include <sys/socketvar.h> | | 46 | #include <sys/socketvar.h> |
47 | #include <sys/audioio.h> | | 47 | #include <sys/audioio.h> |
| @@ -525,26 +525,38 @@ netbsd32_to_devlistargs( | | | @@ -525,26 +525,38 @@ netbsd32_to_devlistargs( |
525 | | | 525 | |
526 | static inline void | | 526 | static inline void |
527 | netbsd32_to_devrescanargs( | | 527 | netbsd32_to_devrescanargs( |
528 | const struct netbsd32_devrescanargs *s32p, | | 528 | const struct netbsd32_devrescanargs *s32p, |
529 | struct devrescanargs *p, | | 529 | struct devrescanargs *p, |
530 | u_long cmd) | | 530 | u_long cmd) |
531 | { | | 531 | { |
532 | memcpy(p->busname, s32p->busname, sizeof(p->busname)); | | 532 | memcpy(p->busname, s32p->busname, sizeof(p->busname)); |
533 | memcpy(p->ifattr, s32p->ifattr, sizeof(p->ifattr)); | | 533 | memcpy(p->ifattr, s32p->ifattr, sizeof(p->ifattr)); |
534 | p->numlocators = s32p->numlocators; | | 534 | p->numlocators = s32p->numlocators; |
535 | p->locators = NETBSD32PTR64(s32p->locators); | | 535 | p->locators = NETBSD32PTR64(s32p->locators); |
536 | } | | 536 | } |
537 | | | 537 | |
| | | 538 | static inline void |
| | | 539 | netbsd32_to_dkwedge_list( |
| | | 540 | const struct netbsd32_dkwedge_list *s32p, |
| | | 541 | struct dkwedge_list *p, |
| | | 542 | u_long cmd) |
| | | 543 | { |
| | | 544 | p->dkwl_buf = s32p->dkwl_buf; |
| | | 545 | p->dkwl_bufsize = s32p->dkwl_bufsize; |
| | | 546 | p->dkwl_nwedges = s32p->dkwl_nwedges; |
| | | 547 | p->dkwl_ncopied = s32p->dkwl_ncopied; |
| | | 548 | } |
| | | 549 | |
538 | /* | | 550 | /* |
539 | * handle ioctl conversions from 64-bit kernel -> netbsd32 | | 551 | * handle ioctl conversions from 64-bit kernel -> netbsd32 |
540 | */ | | 552 | */ |
541 | | | 553 | |
542 | #if 0 | | 554 | #if 0 |
543 | static inline void | | 555 | static inline void |
544 | netbsd32_from_format_op(struct format_op *p, struct netbsd32_format_op *s32p, u_long cmd) | | 556 | netbsd32_from_format_op(struct format_op *p, struct netbsd32_format_op *s32p, u_long cmd) |
545 | { | | 557 | { |
546 | | | 558 | |
547 | /* filled in */ | | 559 | /* filled in */ |
548 | #if 0 | | 560 | #if 0 |
549 | s32p->df_buf = (netbsd32_charp)p->df_buf; | | 561 | s32p->df_buf = (netbsd32_charp)p->df_buf; |
550 | #endif | | 562 | #endif |
| @@ -967,26 +979,38 @@ netbsd32_from_devlistargs( | | | @@ -967,26 +979,38 @@ netbsd32_from_devlistargs( |
967 | | | 979 | |
968 | static inline void | | 980 | static inline void |
969 | netbsd32_from_devrescanargs( | | 981 | netbsd32_from_devrescanargs( |
970 | const struct devrescanargs *p, | | 982 | const struct devrescanargs *p, |
971 | struct netbsd32_devrescanargs *s32p, | | 983 | struct netbsd32_devrescanargs *s32p, |
972 | u_long cmd) | | 984 | u_long cmd) |
973 | { | | 985 | { |
974 | memcpy(s32p->busname, p->busname, sizeof(s32p->busname)); | | 986 | memcpy(s32p->busname, p->busname, sizeof(s32p->busname)); |
975 | memcpy(s32p->ifattr, p->ifattr, sizeof(s32p->ifattr)); | | 987 | memcpy(s32p->ifattr, p->ifattr, sizeof(s32p->ifattr)); |
976 | s32p->numlocators = p->numlocators; | | 988 | s32p->numlocators = p->numlocators; |
977 | NETBSD32PTR32(s32p->locators, p->locators); | | 989 | NETBSD32PTR32(s32p->locators, p->locators); |
978 | } | | 990 | } |
979 | | | 991 | |
| | | 992 | static inline void |
| | | 993 | netbsd32_from_dkwedge_list( |
| | | 994 | const struct dkwedge_list *p, |
| | | 995 | struct netbsd32_dkwedge_list *s32p, |
| | | 996 | u_long cmd) |
| | | 997 | { |
| | | 998 | s32p->dkwl_buf = p->dkwl_buf; |
| | | 999 | s32p->dkwl_bufsize = p->dkwl_bufsize; |
| | | 1000 | s32p->dkwl_nwedges = p->dkwl_nwedges; |
| | | 1001 | s32p->dkwl_ncopied = p->dkwl_ncopied; |
| | | 1002 | } |
| | | 1003 | |
980 | #ifdef NTP | | 1004 | #ifdef NTP |
981 | static int | | 1005 | static int |
982 | netbsd32_do_clockctl_ntp_adjtime(struct clockctl_ntp_adjtime *args) | | 1006 | netbsd32_do_clockctl_ntp_adjtime(struct clockctl_ntp_adjtime *args) |
983 | { | | 1007 | { |
984 | | | 1008 | |
985 | struct netbsd32_timex ntv32; | | 1009 | struct netbsd32_timex ntv32; |
986 | struct timex ntv; | | 1010 | struct timex ntv; |
987 | int error; | | 1011 | int error; |
988 | | | 1012 | |
989 | error = copyin(args->tp, &ntv32, sizeof(ntv32)); | | 1013 | error = copyin(args->tp, &ntv32, sizeof(ntv32)); |
990 | if (error) | | 1014 | if (error) |
991 | return (error); | | 1015 | return (error); |
992 | | | 1016 | |
| @@ -1423,26 +1447,29 @@ netbsd32_ioctl(struct lwp *l, const stru | | | @@ -1423,26 +1447,29 @@ netbsd32_ioctl(struct lwp *l, const stru |
1423 | IOCTL_STRUCT_CONV_TO(IOC_NPF_SAVE, plistref); | | 1447 | IOCTL_STRUCT_CONV_TO(IOC_NPF_SAVE, plistref); |
1424 | case IOC_NPF_RULE32: | | 1448 | case IOC_NPF_RULE32: |
1425 | IOCTL_STRUCT_CONV_TO(IOC_NPF_RULE, plistref); | | 1449 | IOCTL_STRUCT_CONV_TO(IOC_NPF_RULE, plistref); |
1426 | | | 1450 | |
1427 | case DRVRESCANBUS32: | | 1451 | case DRVRESCANBUS32: |
1428 | IOCTL_STRUCT_CONV_TO(DRVRESCANBUS, devrescanargs); | | 1452 | IOCTL_STRUCT_CONV_TO(DRVRESCANBUS, devrescanargs); |
1429 | case DRVLISTDEV32: | | 1453 | case DRVLISTDEV32: |
1430 | IOCTL_STRUCT_CONV_TO(DRVLISTDEV, devlistargs); | | 1454 | IOCTL_STRUCT_CONV_TO(DRVLISTDEV, devlistargs); |
1431 | case DRVCTLCOMMAND32: | | 1455 | case DRVCTLCOMMAND32: |
1432 | IOCTL_STRUCT_CONV_TO(DRVCTLCOMMAND, plistref); | | 1456 | IOCTL_STRUCT_CONV_TO(DRVCTLCOMMAND, plistref); |
1433 | case DRVGETEVENT32: | | 1457 | case DRVGETEVENT32: |
1434 | IOCTL_STRUCT_CONV_TO(DRVGETEVENT, plistref); | | 1458 | IOCTL_STRUCT_CONV_TO(DRVGETEVENT, plistref); |
1435 | | | 1459 | |
| | | 1460 | case DIOCLWEDGES32: |
| | | 1461 | IOCTL_STRUCT_CONV_TO(DIOCLWEDGES, dkwedge_list); |
| | | 1462 | |
1436 | default: | | 1463 | default: |
1437 | #ifdef NETBSD32_MD_IOCTL | | 1464 | #ifdef NETBSD32_MD_IOCTL |
1438 | error = netbsd32_md_ioctl(fp, com, data32, l); | | 1465 | error = netbsd32_md_ioctl(fp, com, data32, l); |
1439 | #else | | 1466 | #else |
1440 | error = (*fp->f_ops->fo_ioctl)(fp, com, data32); | | 1467 | error = (*fp->f_ops->fo_ioctl)(fp, com, data32); |
1441 | #endif | | 1468 | #endif |
1442 | break; | | 1469 | break; |
1443 | } | | 1470 | } |
1444 | | | 1471 | |
1445 | if (error == EPASSTHROUGH) | | 1472 | if (error == EPASSTHROUGH) |
1446 | error = ENOTTY; | | 1473 | error = ENOTTY; |
1447 | | | 1474 | |
1448 | /* | | 1475 | /* |