vim +2198 drivers/scsi/sg.c
c99d01af2aa92f Douglas Gilbert 2021-02-19 1978
37b9d1e0017b2d Jörn Engel 2012-04-12 1979 static long
da0b8f731b3ccc Douglas Gilbert 2021-02-19 1980 sg_ioctl_common(struct file *filp, struct sg_device *sdp, struct sg_fd *sfp,
d320a9551e394c Arnd Bergmann 2019-03-15 1981 unsigned int cmd_in, void __user *p)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1982 {
c99d01af2aa92f Douglas Gilbert 2021-02-19 1983 bool read_only = O_RDWR != (filp->f_flags & O_ACCMODE);
c99d01af2aa92f Douglas Gilbert 2021-02-19 1984 int val;
c99d01af2aa92f Douglas Gilbert 2021-02-19 1985 int result = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1986 int __user *ip = p;
da0b8f731b3ccc Douglas Gilbert 2021-02-19 1987 struct sg_request *srp;
c99d01af2aa92f Douglas Gilbert 2021-02-19 1988 struct scsi_device *sdev;
763d5d3c1d381f Douglas Gilbert 2021-02-19 1989 unsigned long idx;
c99d01af2aa92f Douglas Gilbert 2021-02-19 1990 __maybe_unused const char *pmlp = ", pass to mid-level";
^1da177e4c3f41 Linus Torvalds 2005-04-16 1991
b0d532124dd2c2 Douglas Gilbert 2021-02-19 1992 SG_LOG(6, sfp, "%s: cmd=0x%x, O_NONBLOCK=%d\n", __func__, cmd_in,
b0d532124dd2c2 Douglas Gilbert 2021-02-19 1993 !!(filp->f_flags & O_NONBLOCK));
c99d01af2aa92f Douglas Gilbert 2021-02-19 1994 if (unlikely(SG_IS_DETACHING(sdp)))
c99d01af2aa92f Douglas Gilbert 2021-02-19 1995 return -ENODEV;
c99d01af2aa92f Douglas Gilbert 2021-02-19 1996 sdev = sdp->device;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1997
^1da177e4c3f41 Linus Torvalds 2005-04-16 1998 switch (cmd_in) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1999 case SG_IO:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2000 return sg_ctl_sg_io(filp, sdp, sfp, p);
bb2e50421582c8 Douglas Gilbert 2021-02-19 2001 case SG_IOSUBMIT:
bb2e50421582c8 Douglas Gilbert 2021-02-19 2002 SG_LOG(3, sfp, "%s: SG_IOSUBMIT\n", __func__);
bb2e50421582c8 Douglas Gilbert 2021-02-19 2003 return sg_ctl_iosubmit(filp, sfp, p);
ba044fa1d5f428 Douglas Gilbert 2021-02-19 2004 case SG_IOSUBMIT_V3:
ba044fa1d5f428 Douglas Gilbert 2021-02-19 2005 SG_LOG(3, sfp, "%s: SG_IOSUBMIT_V3\n", __func__);
ba044fa1d5f428 Douglas Gilbert 2021-02-19 2006 return sg_ctl_iosubmit_v3(filp, sfp, p);
bb2e50421582c8 Douglas Gilbert 2021-02-19 2007 case SG_IORECEIVE:
bb2e50421582c8 Douglas Gilbert 2021-02-19 2008 SG_LOG(3, sfp, "%s: SG_IORECEIVE\n", __func__);
bb2e50421582c8 Douglas Gilbert 2021-02-19 2009 return sg_ctl_ioreceive(filp, sfp, p);
ba044fa1d5f428 Douglas Gilbert 2021-02-19 2010 case SG_IORECEIVE_V3:
ba044fa1d5f428 Douglas Gilbert 2021-02-19 2011 SG_LOG(3, sfp, "%s: SG_IORECEIVE_V3\n", __func__);
ba044fa1d5f428 Douglas Gilbert 2021-02-19 2012 return sg_ctl_ioreceive_v3(filp, sfp, p);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2013 case SG_GET_SCSI_ID:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2014 return sg_ctl_scsi_id(sdev, sfp, p);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2015 case SG_SET_FORCE_PACK_ID:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2016 SG_LOG(3, sfp, "%s: SG_SET_FORCE_PACK_ID\n", __func__);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2017 result = get_user(val, ip);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2018 if (result)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2019 return result;
af1fc95db44560 Douglas Gilbert 2021-02-19 2020 assign_bit(SG_FFD_FORCE_PACKID, sfp->ffd_bm, !!val);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2021 return 0;
89c0e50330bd6d Douglas Gilbert 2021-02-19 2022 case SG_GET_PACK_ID: /* or tag of oldest "read"-able, -1 if none */
c99d01af2aa92f Douglas Gilbert 2021-02-19 2023 val = -1;
763d5d3c1d381f Douglas Gilbert 2021-02-19 2024 xa_for_each_marked(&sfp->srp_arr, idx, srp, SG_XA_RQ_AWAIT) {
763d5d3c1d381f Douglas Gilbert 2021-02-19 2025 if (!srp)
763d5d3c1d381f Douglas Gilbert 2021-02-19 2026 continue;
af1fc95db44560 Douglas Gilbert 2021-02-19 2027 val = srp->pack_id;
c99d01af2aa92f Douglas Gilbert 2021-02-19 2028 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2029 }
c99d01af2aa92f Douglas Gilbert 2021-02-19 2030 SG_LOG(3, sfp, "%s: SG_GET_PACK_ID=%d\n", __func__, val);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2031 return put_user(val, ip);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2032 case SG_GET_NUM_WAITING:
ed130bcd75fe26 Douglas Gilbert 2021-02-19 2033 val = atomic_read(&sfp->waiting);
ed130bcd75fe26 Douglas Gilbert 2021-02-19 2034 if (val)
ed130bcd75fe26 Douglas Gilbert 2021-02-19 2035 return put_user(val, ip);
ed130bcd75fe26 Douglas Gilbert 2021-02-19 2036 return put_user(atomic_read_acquire(&sfp->waiting), ip);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2037 case SG_GET_SG_TABLESIZE:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2038 SG_LOG(3, sfp, "%s: SG_GET_SG_TABLESIZE=%d\n", __func__,
c99d01af2aa92f Douglas Gilbert 2021-02-19 2039 sdp->max_sgat_sz);
48a7350dda38dc Douglas Gilbert 2021-02-19 2040 return put_user(sdp->max_sgat_sz, ip);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2041 case SG_SET_RESERVED_SIZE:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2042 result = get_user(val, ip);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2043 if (!result) {
c99d01af2aa92f Douglas Gilbert 2021-02-19 2044 if (val >= 0 && val <= (1024 * 1024 * 1024)) {
af1fc95db44560 Douglas Gilbert 2021-02-19 2045 mutex_lock(&sfp->f_mutex);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2046 result = sg_set_reserved_sz(sfp, val);
af1fc95db44560 Douglas Gilbert 2021-02-19 2047 mutex_unlock(&sfp->f_mutex);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2048 } else {
c99d01af2aa92f Douglas Gilbert 2021-02-19 2049 SG_LOG(3, sfp, "%s: invalid size\n", __func__);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2050 result = -EINVAL;
1bc0eb0446158c Hannes Reinecke 2017-04-07 2051 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2052 }
c99d01af2aa92f Douglas Gilbert 2021-02-19 2053 return result;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2054 case SG_GET_RESERVED_SIZE:
af1fc95db44560 Douglas Gilbert 2021-02-19 2055 mutex_lock(&sfp->f_mutex);
af1fc95db44560 Douglas Gilbert 2021-02-19 2056 val = min_t(int, sfp->rsv_srp->sgat_h.buflen,
af1fc95db44560 Douglas Gilbert 2021-02-19 2057 sdp->max_sgat_sz);
af1fc95db44560 Douglas Gilbert 2021-02-19 2058 mutex_unlock(&sfp->f_mutex);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2059 SG_LOG(3, sfp, "%s: SG_GET_RESERVED_SIZE=%d\n",
c99d01af2aa92f Douglas Gilbert 2021-02-19 2060 __func__, val);
af1fc95db44560 Douglas Gilbert 2021-02-19 2061 result = put_user(val, ip);
af1fc95db44560 Douglas Gilbert 2021-02-19 2062 return result;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2063 case SG_SET_COMMAND_Q:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2064 SG_LOG(3, sfp, "%s: SG_SET_COMMAND_Q\n", __func__);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2065 result = get_user(val, ip);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2066 if (result)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2067 return result;
af1fc95db44560 Douglas Gilbert 2021-02-19 2068 assign_bit(SG_FFD_CMD_Q, sfp->ffd_bm, !!val);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2069 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2070 case SG_GET_COMMAND_Q:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2071 SG_LOG(3, sfp, "%s: SG_GET_COMMAND_Q\n", __func__);
af1fc95db44560 Douglas Gilbert 2021-02-19 2072 return put_user(test_bit(SG_FFD_CMD_Q, sfp->ffd_bm), ip);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2073 case SG_SET_KEEP_ORPHAN:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2074 SG_LOG(3, sfp, "%s: SG_SET_KEEP_ORPHAN\n", __func__);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2075 result = get_user(val, ip);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2076 if (result)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2077 return result;
af1fc95db44560 Douglas Gilbert 2021-02-19 2078 assign_bit(SG_FFD_KEEP_ORPHAN, sfp->ffd_bm, !!val);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2079 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2080 case SG_GET_KEEP_ORPHAN:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2081 SG_LOG(3, sfp, "%s: SG_GET_KEEP_ORPHAN\n", __func__);
af1fc95db44560 Douglas Gilbert 2021-02-19 2082 return put_user(test_bit(SG_FFD_KEEP_ORPHAN, sfp->ffd_bm),
af1fc95db44560 Douglas Gilbert 2021-02-19 2083 ip);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2084 case SG_GET_VERSION_NUM:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2085 SG_LOG(3, sfp, "%s: SG_GET_VERSION_NUM\n", __func__);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2086 return put_user(sg_version_num, ip);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2087 case SG_GET_REQUEST_TABLE:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2088 return sg_ctl_req_tbl(sfp, p);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2089 case SG_SCSI_RESET:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2090 SG_LOG(3, sfp, "%s: SG_SCSI_RESET\n", __func__);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2091 break;
c99d01af2aa92f Douglas Gilbert 2021-02-19 2092 case SG_SET_TIMEOUT:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2093 SG_LOG(3, sfp, "%s: SG_SET_TIMEOUT\n", __func__);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2094 result = get_user(val, ip);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2095 if (result)
c99d01af2aa92f Douglas Gilbert 2021-02-19 2096 return result;
c99d01af2aa92f Douglas Gilbert 2021-02-19 2097 if (val < 0)
c99d01af2aa92f Douglas Gilbert 2021-02-19 2098 return -EIO;
c99d01af2aa92f Douglas Gilbert 2021-02-19 2099 if (val >= mult_frac((s64)INT_MAX, USER_HZ, HZ))
c99d01af2aa92f Douglas Gilbert 2021-02-19 2100 val = min_t(s64, mult_frac((s64)INT_MAX, USER_HZ, HZ),
c99d01af2aa92f Douglas Gilbert 2021-02-19 2101 INT_MAX);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2102 sfp->timeout_user = val;
c99d01af2aa92f Douglas Gilbert 2021-02-19 2103 sfp->timeout = mult_frac(val, HZ, USER_HZ);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2104 return 0;
c99d01af2aa92f Douglas Gilbert 2021-02-19 2105 case SG_GET_TIMEOUT: /* N.B. User receives timeout as return value */
c99d01af2aa92f Douglas Gilbert 2021-02-19 2106 /* strange ..., for backward compatibility */
c99d01af2aa92f Douglas Gilbert 2021-02-19 2107 SG_LOG(3, sfp, "%s: SG_GET_TIMEOUT\n", __func__);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2108 return sfp->timeout_user;
c99d01af2aa92f Douglas Gilbert 2021-02-19 2109 case SG_SET_FORCE_LOW_DMA:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2110 /*
c99d01af2aa92f Douglas Gilbert 2021-02-19 2111 * N.B. This ioctl never worked properly, but failed to
c99d01af2aa92f Douglas Gilbert 2021-02-19 2112 * return an error value. So returning '0' to keep
c99d01af2aa92f Douglas Gilbert 2021-02-19 2113 * compatibility with legacy applications.
c99d01af2aa92f Douglas Gilbert 2021-02-19 2114 */
c99d01af2aa92f Douglas Gilbert 2021-02-19 2115 SG_LOG(3, sfp, "%s: SG_SET_FORCE_LOW_DMA\n", __func__);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2116 return 0;
c99d01af2aa92f Douglas Gilbert 2021-02-19 2117 case SG_GET_LOW_DMA:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2118 SG_LOG(3, sfp, "%s: SG_GET_LOW_DMA\n", __func__);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2119 return put_user((int)sdev->host->unchecked_isa_dma, ip);
7ba0ec6097b45c Douglas Gilbert 2021-02-19 2120 case SG_NEXT_CMD_LEN: /* active only in v2 interface */
c99d01af2aa92f Douglas Gilbert 2021-02-19 2121 SG_LOG(3, sfp, "%s: SG_NEXT_CMD_LEN\n", __func__);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2122 result = get_user(val, ip);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2123 if (result)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2124 return result;
bf33f87dd04c37 peter chang 2017-02-15 2125 if (val > SG_MAX_CDB_SIZE)
bf33f87dd04c37 peter chang 2017-02-15 2126 return -ENOMEM;
c4aaf4c540d32a Douglas Gilbert 2021-02-19 2127 mutex_lock(&sfp->f_mutex);
c4aaf4c540d32a Douglas Gilbert 2021-02-19 2128 sfp->next_cmd_len = max_t(int, val, 0);
c4aaf4c540d32a Douglas Gilbert 2021-02-19 2129 mutex_unlock(&sfp->f_mutex);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2130 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2131 case SG_GET_ACCESS_COUNT:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2132 SG_LOG(3, sfp, "%s: SG_GET_ACCESS_COUNT\n", __func__);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2133 /* faked - we don't have a real access count anymore */
c99d01af2aa92f Douglas Gilbert 2021-02-19 2134 val = (sdev ? 1 : 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2135 return put_user(val, ip);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2136 case SG_EMULATED_HOST:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2137 SG_LOG(3, sfp, "%s: SG_EMULATED_HOST\n", __func__);
af1fc95db44560 Douglas Gilbert 2021-02-19 2138 if (unlikely(SG_IS_DETACHING(sdp)))
af1fc95db44560 Douglas Gilbert 2021-02-19 2139 return -ENODEV;
c99d01af2aa92f Douglas Gilbert 2021-02-19 2140 return put_user(sdev->host->hostt->emulated, ip);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2141 case SCSI_IOCTL_SEND_COMMAND:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2142 SG_LOG(3, sfp, "%s: SCSI_IOCTL_SEND_COMMAND\n", __func__);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2143 return sg_scsi_ioctl(sdev->request_queue, NULL, filp->f_mode,
c99d01af2aa92f Douglas Gilbert 2021-02-19 2144 p);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2145 case SG_SET_DEBUG:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2146 SG_LOG(3, sfp, "%s: SG_SET_DEBUG\n", __func__);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2147 result = get_user(val, ip);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2148 if (result)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2149 return result;
af1fc95db44560 Douglas Gilbert 2021-02-19 2150 assign_bit(SG_FDEV_LOG_SENSE, sdp->fdev_bm, !!val);
0a3245bc182560 Douglas Gilbert 2021-02-19 2151 if (val == 0) /* user can force recalculation */
0a3245bc182560 Douglas Gilbert 2021-02-19 2152 sg_calc_sgat_param(sdp);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2153 return 0;
44ec95425c1d9d Alan Stern 2007-02-20 2154 case BLKSECTGET:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2155 SG_LOG(3, sfp, "%s: BLKSECTGET\n", __func__);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2156 return put_user(max_sectors_bytes(sdev->request_queue), ip);
6da127ad0918f9 Christof Schmitt 2008-01-11 2157 case BLKTRACESETUP:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2158 SG_LOG(3, sfp, "%s: BLKTRACESETUP\n", __func__);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2159 return blk_trace_setup(sdev->request_queue,
6da127ad0918f9 Christof Schmitt 2008-01-11 2160 sdp->disk->disk_name,
76e3a19d0691bb Martin Peschke 2009-01-30 2161 MKDEV(SCSI_GENERIC_MAJOR, sdp->index),
7475c8ae1b7bfc Bart Van Assche 2017-08-25 2162 NULL, p);
6da127ad0918f9 Christof Schmitt 2008-01-11 2163 case BLKTRACESTART:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2164 SG_LOG(3, sfp, "%s: BLKTRACESTART\n", __func__);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2165 return blk_trace_startstop(sdev->request_queue, 1);
6da127ad0918f9 Christof Schmitt 2008-01-11 2166 case BLKTRACESTOP:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2167 SG_LOG(3, sfp, "%s: BLKTRACESTOP\n", __func__);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2168 return blk_trace_startstop(sdev->request_queue, 0);
6da127ad0918f9 Christof Schmitt 2008-01-11 2169 case BLKTRACETEARDOWN:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2170 SG_LOG(3, sfp, "%s: BLKTRACETEARDOWN\n", __func__);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2171 return blk_trace_remove(sdev->request_queue);
906d15fbd23c12 Christoph Hellwig 2014-10-11 2172 case SCSI_IOCTL_GET_IDLUN:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2173 SG_LOG(3, sfp, "%s: SCSI_IOCTL_GET_IDLUN %s\n", __func__,
c99d01af2aa92f Douglas Gilbert 2021-02-19 2174 pmlp);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2175 break;
906d15fbd23c12 Christoph Hellwig 2014-10-11 2176 case SCSI_IOCTL_GET_BUS_NUMBER:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2177 SG_LOG(3, sfp, "%s: SCSI_IOCTL_GET_BUS_NUMBER%s\n",
c99d01af2aa92f Douglas Gilbert 2021-02-19 2178 __func__, pmlp);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2179 break;
906d15fbd23c12 Christoph Hellwig 2014-10-11 2180 case SCSI_IOCTL_PROBE_HOST:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2181 SG_LOG(3, sfp, "%s: SCSI_IOCTL_PROBE_HOST%s",
c99d01af2aa92f Douglas Gilbert 2021-02-19 2182 __func__, pmlp);
c99d01af2aa92f Douglas Gilbert 2021-02-19 2183 break;
906d15fbd23c12 Christoph Hellwig 2014-10-11 2184 case SG_GET_TRANSFORM:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2185 SG_LOG(3, sfp, "%s: SG_GET_TRANSFORM%s\n", __func__, pmlp);
906d15fbd23c12 Christoph Hellwig 2014-10-11 2186 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2187 default:
c99d01af2aa92f Douglas Gilbert 2021-02-19 2188 SG_LOG(3, sfp, "%s: unrecognized ioctl [0x%x]%s\n",
c99d01af2aa92f Douglas Gilbert 2021-02-19 2189 __func__, cmd_in, pmlp);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2190 if (read_only)
c99d01af2aa92f Douglas Gilbert 2021-02-19 2191 return -EPERM; /* don't know, so take safer approach */
906d15fbd23c12 Christoph Hellwig 2014-10-11 2192 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2193 }
f24c409c880d71 Douglas Gilbert 2021-02-19 2194 result = sg_allow_if_err_recovery(sdp, filp->f_flags & O_NDELAY);
af1fc95db44560 Douglas Gilbert 2021-02-19 2195 if (unlikely(result))
906d15fbd23c12 Christoph Hellwig 2014-10-11 2196 return result;
d320a9551e394c Arnd Bergmann 2019-03-15 2197 return -ENOIOCTLCMD;
^1da177e4c3f41 Linus Torvalds 2005-04-16 @2198 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2199
:::::: The code at line 2198 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx