| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: linux_sg.c,v 1.13 2008/03/21 21:54:58 ad Exp $ */ | | 1 | /* $NetBSD: linux_sg.c,v 1.13.84.1 2017/11/30 13:44:31 martin Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2004 Soren S. Jorvang. All rights reserved. | | 4 | * Copyright (c) 2004 Soren S. Jorvang. All rights reserved. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions, and the following disclaimer. | | 10 | * notice, this list of conditions, and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * | | 14 | * |
| @@ -16,27 +16,27 @@ | | | @@ -16,27 +16,27 @@ |
16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
25 | * SUCH DAMAGE. | | 25 | * SUCH DAMAGE. |
26 | */ | | 26 | */ |
27 | | | 27 | |
28 | #include <sys/cdefs.h> | | 28 | #include <sys/cdefs.h> |
29 | __KERNEL_RCSID(0, "$NetBSD: linux_sg.c,v 1.13 2008/03/21 21:54:58 ad Exp $"); | | 29 | __KERNEL_RCSID(0, "$NetBSD: linux_sg.c,v 1.13.84.1 2017/11/30 13:44:31 martin Exp $"); |
30 | | | 30 | |
31 | #include <sys/param.h> | | 31 | #include <sys/param.h> |
32 | #include <sys/systm.h> | | 32 | #include <sys/systm.h> |
33 | #include <sys/ioctl.h> | | 33 | #include <sys/ioctl.h> |
34 | #include <sys/file.h> | | 34 | #include <sys/file.h> |
35 | #include <sys/filedesc.h> | | 35 | #include <sys/filedesc.h> |
36 | #include <sys/mount.h> | | 36 | #include <sys/mount.h> |
37 | #include <sys/proc.h> | | 37 | #include <sys/proc.h> |
38 | #include <sys/device.h> | | 38 | #include <sys/device.h> |
39 | | | 39 | |
40 | #include <sys/scsiio.h> | | 40 | #include <sys/scsiio.h> |
41 | #include <dev/scsipi/scsipi_all.h> | | 41 | #include <dev/scsipi/scsipi_all.h> |
42 | #include <dev/scsipi/scsiconf.h> | | 42 | #include <dev/scsipi/scsiconf.h> |
| @@ -78,27 +78,27 @@ linux_ioctl_sg(struct lwp *l, const stru | | | @@ -78,27 +78,27 @@ linux_ioctl_sg(struct lwp *l, const stru |
78 | int (*ioctlf)(file_t *, u_long, void *); | | 78 | int (*ioctlf)(file_t *, u_long, void *); |
79 | struct linux_sg_io_hdr lreq; | | 79 | struct linux_sg_io_hdr lreq; |
80 | struct scsireq req; | | 80 | struct scsireq req; |
81 | | | 81 | |
82 | if ((fp = fd_getfile(SCARG(uap, fd))) == NULL) | | 82 | if ((fp = fd_getfile(SCARG(uap, fd))) == NULL) |
83 | return EBADF; | | 83 | return EBADF; |
84 | | | 84 | |
85 | ioctlf = fp->f_ops->fo_ioctl; | | 85 | ioctlf = fp->f_ops->fo_ioctl; |
86 | | | 86 | |
87 | *retval = 0; | | 87 | *retval = 0; |
88 | DPRINTF(("Command = %lx\n", com)); | | 88 | DPRINTF(("Command = %lx\n", com)); |
89 | switch (com) { | | 89 | switch (com) { |
90 | case LINUX_SG_GET_VERSION_NUM: { | | 90 | case LINUX_SG_GET_VERSION_NUM: { |
91 | error = copyout(&version, SCARG(uap, data), | | 91 | error = copyout(&linux_sg_version, SCARG(uap, data), |
92 | sizeof(linux_sg_version)); | | 92 | sizeof(linux_sg_version)); |
93 | break; | | 93 | break; |
94 | } | | 94 | } |
95 | case LINUX_SG_IO: | | 95 | case LINUX_SG_IO: |
96 | error = copyin(SCARG(uap, data), &lreq, sizeof(lreq)); | | 96 | error = copyin(SCARG(uap, data), &lreq, sizeof(lreq)); |
97 | if (error) { | | 97 | if (error) { |
98 | DPRINTF(("failed to copy in request data %d\n", error)); | | 98 | DPRINTF(("failed to copy in request data %d\n", error)); |
99 | break; | | 99 | break; |
100 | } | | 100 | } |
101 | | | 101 | |
102 | #ifdef LINUX_SG_DEBUG | | 102 | #ifdef LINUX_SG_DEBUG |
103 | dump_sg_io(&lreq); | | 103 | dump_sg_io(&lreq); |
104 | #endif | | 104 | #endif |