Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2009, 2010 Jeff Mahoney <jeffm@suse.com> |
Dmitry V. Levin | 37d1b3d | 2016-05-26 10:43:51 +0000 | [diff] [blame] | 3 | * Copyright (c) 2011-2016 Dmitry V. Levin <ldv@altlinux.org> |
Elliott Hughes | 28e98bc | 2018-06-14 16:59:04 -0700 | [diff] [blame] | 4 | * Copyright (c) 2011-2018 The strace developers. |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 5 | * All rights reserved. |
| 6 | * |
| 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | * modification, are permitted provided that the following conditions |
| 9 | * are met: |
| 10 | * 1. Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | * documentation and/or other materials provided with the distribution. |
| 15 | * 3. The name of the author may not be used to endorse or promote products |
| 16 | * derived from this software without specific prior written permission. |
| 17 | * |
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | */ |
| 29 | |
| 30 | #include "defs.h" |
Dmitry V. Levin | 37d1b3d | 2016-05-26 10:43:51 +0000 | [diff] [blame] | 31 | |
| 32 | #include DEF_MPERS_TYPE(struct_blk_user_trace_setup) |
| 33 | #include DEF_MPERS_TYPE(struct_blkpg_ioctl_arg) |
| 34 | #include DEF_MPERS_TYPE(struct_blkpg_partition) |
| 35 | |
Elliott Hughes | d35df49 | 2017-02-15 15:19:05 -0800 | [diff] [blame] | 36 | #include <linux/ioctl.h> |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 37 | #include <linux/fs.h> |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 38 | |
Elliott Hughes | d35df49 | 2017-02-15 15:19:05 -0800 | [diff] [blame] | 39 | typedef struct { |
| 40 | int op; |
| 41 | int flags; |
| 42 | int datalen; |
| 43 | void *data; |
| 44 | } struct_blkpg_ioctl_arg; |
| 45 | |
| 46 | #define BLKPG_DEVNAMELTH 64 |
| 47 | #define BLKPG_VOLNAMELTH 64 |
| 48 | typedef struct { |
| 49 | int64_t start; /* starting offset in bytes */ |
| 50 | int64_t length; /* length in bytes */ |
| 51 | int pno; /* partition number */ |
| 52 | char devname[BLKPG_DEVNAMELTH]; /* partition name, like sda5 or c0d1p2, |
| 53 | to be used in kernel messages */ |
| 54 | char volname[BLKPG_VOLNAMELTH]; /* volume label */ |
| 55 | } struct_blkpg_partition; |
| 56 | |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 57 | #define BLKTRACE_BDEV_SIZE 32 |
Dmitry V. Levin | 37d1b3d | 2016-05-26 10:43:51 +0000 | [diff] [blame] | 58 | typedef struct blk_user_trace_setup { |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 59 | char name[BLKTRACE_BDEV_SIZE]; /* output */ |
| 60 | uint16_t act_mask; /* input */ |
| 61 | uint32_t buf_size; /* input */ |
| 62 | uint32_t buf_nr; /* input */ |
| 63 | uint64_t start_lba; |
| 64 | uint64_t end_lba; |
| 65 | uint32_t pid; |
Dmitry V. Levin | 37d1b3d | 2016-05-26 10:43:51 +0000 | [diff] [blame] | 66 | } struct_blk_user_trace_setup; |
| 67 | |
Dmitry V. Levin | 37d1b3d | 2016-05-26 10:43:51 +0000 | [diff] [blame] | 68 | #include MPERS_DEFS |
| 69 | |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 70 | #include "print_fields.h" |
| 71 | |
Elliott Hughes | d35df49 | 2017-02-15 15:19:05 -0800 | [diff] [blame] | 72 | #ifndef BLKPG |
Elliott Hughes | dc75b01 | 2017-07-05 13:54:44 -0700 | [diff] [blame] | 73 | # define BLKPG _IO(0x12, 105) |
Elliott Hughes | d35df49 | 2017-02-15 15:19:05 -0800 | [diff] [blame] | 74 | #endif |
| 75 | |
Dmitry V. Levin | 37d1b3d | 2016-05-26 10:43:51 +0000 | [diff] [blame] | 76 | /* |
| 77 | * ioctl numbers <= 114 are present in Linux 2.4. The following ones have been |
| 78 | * added since then and headers containing them may not be available on every |
| 79 | * system. |
| 80 | */ |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 81 | |
| 82 | #ifndef BLKTRACESETUP |
Dmitry V. Levin | 37d1b3d | 2016-05-26 10:43:51 +0000 | [diff] [blame] | 83 | # define BLKTRACESETUP _IOWR(0x12, 115, struct_blk_user_trace_setup) |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 84 | #endif |
| 85 | #ifndef BLKTRACESTART |
Elliott Hughes | dc75b01 | 2017-07-05 13:54:44 -0700 | [diff] [blame] | 86 | # define BLKTRACESTART _IO(0x12, 116) |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 87 | #endif |
Dmitry V. Levin | 4cee0af | 2011-04-07 19:58:10 +0000 | [diff] [blame] | 88 | #ifndef BLKTRACESTOP |
Elliott Hughes | dc75b01 | 2017-07-05 13:54:44 -0700 | [diff] [blame] | 89 | # define BLKTRACESTOP _IO(0x12, 117) |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 90 | #endif |
| 91 | #ifndef BLKTRACETEARDOWN |
Elliott Hughes | dc75b01 | 2017-07-05 13:54:44 -0700 | [diff] [blame] | 92 | # define BLKTRACETEARDOWN _IO(0x12, 118) |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 93 | #endif |
| 94 | #ifndef BLKDISCARD |
Elliott Hughes | dc75b01 | 2017-07-05 13:54:44 -0700 | [diff] [blame] | 95 | # define BLKDISCARD _IO(0x12, 119) |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 96 | #endif |
| 97 | #ifndef BLKIOMIN |
Elliott Hughes | dc75b01 | 2017-07-05 13:54:44 -0700 | [diff] [blame] | 98 | # define BLKIOMIN _IO(0x12, 120) |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 99 | #endif |
| 100 | #ifndef BLKIOOPT |
Elliott Hughes | dc75b01 | 2017-07-05 13:54:44 -0700 | [diff] [blame] | 101 | # define BLKIOOPT _IO(0x12, 121) |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 102 | #endif |
| 103 | #ifndef BLKALIGNOFF |
Elliott Hughes | dc75b01 | 2017-07-05 13:54:44 -0700 | [diff] [blame] | 104 | # define BLKALIGNOFF _IO(0x12, 122) |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 105 | #endif |
| 106 | #ifndef BLKPBSZGET |
Elliott Hughes | dc75b01 | 2017-07-05 13:54:44 -0700 | [diff] [blame] | 107 | # define BLKPBSZGET _IO(0x12, 123) |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 108 | #endif |
| 109 | #ifndef BLKDISCARDZEROES |
Elliott Hughes | dc75b01 | 2017-07-05 13:54:44 -0700 | [diff] [blame] | 110 | # define BLKDISCARDZEROES _IO(0x12, 124) |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 111 | #endif |
| 112 | #ifndef BLKSECDISCARD |
Elliott Hughes | dc75b01 | 2017-07-05 13:54:44 -0700 | [diff] [blame] | 113 | # define BLKSECDISCARD _IO(0x12, 125) |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 114 | #endif |
| 115 | #ifndef BLKROTATIONAL |
Elliott Hughes | dc75b01 | 2017-07-05 13:54:44 -0700 | [diff] [blame] | 116 | # define BLKROTATIONAL _IO(0x12, 126) |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 117 | #endif |
| 118 | #ifndef BLKZEROOUT |
Elliott Hughes | dc75b01 | 2017-07-05 13:54:44 -0700 | [diff] [blame] | 119 | # define BLKZEROOUT _IO(0x12, 127) |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 120 | #endif |
| 121 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 122 | #include "xlat/blkpg_ops.h" |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 123 | |
| 124 | static void |
Dmitry V. Levin | 37d1b3d | 2016-05-26 10:43:51 +0000 | [diff] [blame] | 125 | print_blkpg_req(struct tcb *tcp, const struct_blkpg_ioctl_arg *blkpg) |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 126 | { |
Dmitry V. Levin | 37d1b3d | 2016-05-26 10:43:51 +0000 | [diff] [blame] | 127 | struct_blkpg_partition p; |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 128 | |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 129 | PRINT_FIELD_XVAL("{", *blkpg, op, blkpg_ops, "BLKPG_???"); |
| 130 | PRINT_FIELD_D(", ", *blkpg, flags); |
| 131 | PRINT_FIELD_D(", ", *blkpg, datalen); |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 132 | |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 133 | tprints(", data="); |
Elliott Hughes | d35df49 | 2017-02-15 15:19:05 -0800 | [diff] [blame] | 134 | if (!umove_or_printaddr(tcp, ptr_to_kulong(blkpg->data), &p)) { |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 135 | PRINT_FIELD_D("{", p, start); |
| 136 | PRINT_FIELD_D(", ", p, length); |
| 137 | PRINT_FIELD_D(", ", p, pno); |
| 138 | PRINT_FIELD_CSTRING(", ", p, devname); |
| 139 | PRINT_FIELD_CSTRING(", ", p, volname); |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 140 | tprints("}"); |
Dmitry V. Levin | 0a87058 | 2015-01-25 01:04:01 +0000 | [diff] [blame] | 141 | } |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 142 | tprints("}"); |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 143 | } |
| 144 | |
Elliott Hughes | d35df49 | 2017-02-15 15:19:05 -0800 | [diff] [blame] | 145 | MPERS_PRINTER_DECL(int, block_ioctl, struct tcb *const tcp, |
| 146 | const unsigned int code, const kernel_ulong_t arg) |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 147 | { |
| 148 | switch (code) { |
Dmitry V. Levin | be284ca | 2011-01-16 23:07:51 +0000 | [diff] [blame] | 149 | /* take arg as a value, not as a pointer */ |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 150 | case BLKRASET: |
| 151 | case BLKFRASET: |
Elliott Hughes | d35df49 | 2017-02-15 15:19:05 -0800 | [diff] [blame] | 152 | tprintf(", %" PRI_klu, arg); |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 153 | break; |
| 154 | |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 155 | /* return an unsigned short */ |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 156 | case BLKSECTGET: |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 157 | case BLKROTATIONAL: |
| 158 | if (entering(tcp)) |
| 159 | return 0; |
| 160 | tprints(", "); |
| 161 | printnum_short(tcp, arg, "%hu"); |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 162 | break; |
| 163 | |
Dmitry V. Levin | be284ca | 2011-01-16 23:07:51 +0000 | [diff] [blame] | 164 | /* return a signed int */ |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 165 | case BLKROGET: |
| 166 | case BLKBSZGET: |
| 167 | case BLKSSZGET: |
| 168 | case BLKALIGNOFF: |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 169 | if (entering(tcp)) |
| 170 | return 0; |
Elliott Hughes | 28e98bc | 2018-06-14 16:59:04 -0700 | [diff] [blame] | 171 | ATTRIBUTE_FALLTHROUGH; |
Dmitry V. Levin | 0c9087c | 2016-05-26 12:36:56 +0000 | [diff] [blame] | 172 | /* take a signed int */ |
| 173 | case BLKROSET: |
| 174 | case BLKBSZSET: |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 175 | tprints(", "); |
| 176 | printnum_int(tcp, arg, "%d"); |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 177 | break; |
| 178 | |
Dmitry V. Levin | be284ca | 2011-01-16 23:07:51 +0000 | [diff] [blame] | 179 | /* return an unsigned int */ |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 180 | case BLKPBSZGET: |
| 181 | case BLKIOMIN: |
| 182 | case BLKIOOPT: |
| 183 | case BLKDISCARDZEROES: |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 184 | if (entering(tcp)) |
| 185 | return 0; |
| 186 | tprints(", "); |
| 187 | printnum_int(tcp, arg, "%u"); |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 188 | break; |
| 189 | |
Dmitry V. Levin | be284ca | 2011-01-16 23:07:51 +0000 | [diff] [blame] | 190 | /* return a signed long */ |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 191 | case BLKRAGET: |
| 192 | case BLKFRAGET: |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 193 | if (entering(tcp)) |
| 194 | return 0; |
| 195 | tprints(", "); |
Dmitry V. Levin | 2479ef0 | 2015-08-18 14:58:27 +0000 | [diff] [blame] | 196 | printnum_slong(tcp, arg); |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 197 | break; |
| 198 | |
Dmitry V. Levin | be284ca | 2011-01-16 23:07:51 +0000 | [diff] [blame] | 199 | /* returns an unsigned long */ |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 200 | case BLKGETSIZE: |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 201 | if (entering(tcp)) |
| 202 | return 0; |
| 203 | tprints(", "); |
Dmitry V. Levin | 2479ef0 | 2015-08-18 14:58:27 +0000 | [diff] [blame] | 204 | printnum_ulong(tcp, arg); |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 205 | break; |
| 206 | |
Dmitry V. Levin | 25caa31 | 2011-08-16 21:36:16 +0000 | [diff] [blame] | 207 | #ifdef HAVE_BLKGETSIZE64 |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 208 | /* returns an uint64_t */ |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 209 | case BLKGETSIZE64: |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 210 | if (entering(tcp)) |
| 211 | return 0; |
| 212 | tprints(", "); |
| 213 | printnum_int64(tcp, arg, "%" PRIu64); |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 214 | break; |
Denys Vlasenko | 5bd67c8 | 2011-08-15 11:36:09 +0200 | [diff] [blame] | 215 | #endif |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 216 | |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 217 | /* takes a pair of uint64_t */ |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 218 | case BLKDISCARD: |
| 219 | case BLKSECDISCARD: |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 220 | case BLKZEROOUT: |
| 221 | tprints(", "); |
Dmitry V. Levin | 46d25c2 | 2016-05-26 12:33:21 +0000 | [diff] [blame] | 222 | printpair_int64(tcp, arg, "%" PRIu64); |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 223 | break; |
| 224 | |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 225 | /* More complex types */ |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 226 | case BLKPG: { |
Dmitry V. Levin | 37d1b3d | 2016-05-26 10:43:51 +0000 | [diff] [blame] | 227 | struct_blkpg_ioctl_arg blkpg; |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 228 | |
| 229 | tprints(", "); |
| 230 | if (!umove_or_printaddr(tcp, arg, &blkpg)) |
| 231 | print_blkpg_req(tcp, &blkpg); |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 232 | break; |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 233 | } |
Dmitry V. Levin | be284ca | 2011-01-16 23:07:51 +0000 | [diff] [blame] | 234 | |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 235 | case BLKTRACESETUP: |
| 236 | if (entering(tcp)) { |
Dmitry V. Levin | 37d1b3d | 2016-05-26 10:43:51 +0000 | [diff] [blame] | 237 | struct_blk_user_trace_setup buts; |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 238 | |
| 239 | tprints(", "); |
| 240 | if (umove_or_printaddr(tcp, arg, &buts)) |
| 241 | break; |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 242 | PRINT_FIELD_U("{", buts, act_mask); |
| 243 | PRINT_FIELD_U(", ", buts, buf_size); |
| 244 | PRINT_FIELD_U(", ", buts, buf_nr); |
| 245 | PRINT_FIELD_U(", ", buts, start_lba); |
| 246 | PRINT_FIELD_U(", ", buts, end_lba); |
| 247 | PRINT_FIELD_U(", ", buts, pid); |
| 248 | return 0; |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 249 | } else { |
Dmitry V. Levin | 37d1b3d | 2016-05-26 10:43:51 +0000 | [diff] [blame] | 250 | struct_blk_user_trace_setup buts; |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 251 | |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 252 | if (!syserror(tcp) && !umove(tcp, arg, &buts)) |
| 253 | PRINT_FIELD_CSTRING(", ", buts, name); |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 254 | tprints("}"); |
| 255 | break; |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 256 | } |
Dmitry V. Levin | be284ca | 2011-01-16 23:07:51 +0000 | [diff] [blame] | 257 | |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 258 | /* No arguments */ |
| 259 | case BLKRRPART: |
| 260 | case BLKFLSBUF: |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 261 | case BLKTRACESTART: |
| 262 | case BLKTRACESTOP: |
| 263 | case BLKTRACETEARDOWN: |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 264 | break; |
Dmitry V. Levin | a0beac1 | 2015-07-05 15:15:03 +0300 | [diff] [blame] | 265 | default: |
| 266 | return RVAL_DECODED; |
| 267 | } |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 268 | |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 269 | return RVAL_IOCTL_DECODED; |
Dmitry V. Levin | 4ef6db4 | 2011-01-15 20:15:31 +0000 | [diff] [blame] | 270 | } |