Tue Mar 6 07:59:59 2018 UTC ()
Add DIOCLWEDGES


(mlelstv)
diff -r1.91 -r1.92 src/sys/compat/netbsd32/netbsd32_ioctl.c
diff -r1.58 -r1.59 src/sys/compat/netbsd32/netbsd32_ioctl.h

cvs diff -r1.91 -r1.92 src/sys/compat/netbsd32/netbsd32_ioctl.c (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_ioctl.c 2018/01/19 23:38:56 1.91
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c 2018/03/06 07:59:59 1.92
@@ -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
526static inline void 526static inline void
527netbsd32_to_devrescanargs( 527netbsd32_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
 538static inline void
 539netbsd32_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
543static inline void 555static inline void
544netbsd32_from_format_op(struct format_op *p, struct netbsd32_format_op *s32p, u_long cmd) 556netbsd32_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
968static inline void 980static inline void
969netbsd32_from_devrescanargs( 981netbsd32_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
 992static inline void
 993netbsd32_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
981static int 1005static int
982netbsd32_do_clockctl_ntp_adjtime(struct clockctl_ntp_adjtime *args) 1006netbsd32_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 /*

cvs diff -r1.58 -r1.59 src/sys/compat/netbsd32/netbsd32_ioctl.h (expand / switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_ioctl.h 2018/01/19 23:38:56 1.58
+++ src/sys/compat/netbsd32/netbsd32_ioctl.h 2018/03/06 07:59:59 1.59
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: netbsd32_ioctl.h,v 1.58 2018/01/19 23:38:56 macallan Exp $ */ 1/* $NetBSD: netbsd32_ioctl.h,v 1.59 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.
@@ -623,13 +623,25 @@ struct netbsd32_devlistargs { @@ -623,13 +623,25 @@ struct netbsd32_devlistargs {
623}; 623};
624 624
625struct netbsd32_devrescanargs { 625struct netbsd32_devrescanargs {
626 char busname[16]; 626 char busname[16];
627 char ifattr[16]; 627 char ifattr[16];
628 unsigned int numlocators; 628 unsigned int numlocators;
629 netbsd32_intp locators; 629 netbsd32_intp locators;
630}; 630};
631 631
632#define DRVRESCANBUS32 _IOW('D', 124, struct netbsd32_devrescanargs) 632#define DRVRESCANBUS32 _IOW('D', 124, struct netbsd32_devrescanargs)
633#define DRVCTLCOMMAND32 _IOWR('D', 125, struct netbsd32_plistref) 633#define DRVCTLCOMMAND32 _IOWR('D', 125, struct netbsd32_plistref)
634#define DRVLISTDEV32 _IOWR('D', 127, struct netbsd32_devlistargs) 634#define DRVLISTDEV32 _IOWR('D', 127, struct netbsd32_devlistargs)
635#define DRVGETEVENT32 _IOR('D', 128, struct netbsd32_plistref) 635#define DRVGETEVENT32 _IOR('D', 128, struct netbsd32_plistref)
 636
 637/* From sys/disk.h, sys/dkio.h */
 638
 639struct netbsd32_dkwedge_list {
 640 void *dkwl_buf; /* storage for dkwedge_info array */
 641 netbsd32_size_t dkwl_bufsize; /* size of that buffer */
 642 u_int dkwl_nwedges; /* total number of wedges */
 643 u_int dkwl_ncopied; /* number actually copied */
 644};
 645
 646#define DIOCLWEDGES32 _IOWR('d', 124, struct netbsd32_dkwedge_list)
 647