Browse Source

ioctl: sort entries in ioctl_decode switch statement

* ioctl.c (ioctl_decode): Sort case branches in the switch statement.
Eugene Syromyatnikov 1 year ago
parent
commit
10695700db
1 changed files with 50 additions and 47 deletions
  1. 50
    47
      ioctl.c

+ 50
- 47
ioctl.c View File

@@ -246,36 +246,24 @@ ioctl_decode(struct tcb *tcp)
246 246
 	const kernel_ulong_t arg = tcp->u_arg[2];
247 247
 
248 248
 	switch (_IOC_TYPE(code)) {
249
-	case '$':
250
-		return perf_ioctl(tcp, code, arg);
251
-#if defined(ALPHA) || defined(POWERPC)
252
-	case 'f': {
253
-		int ret = file_ioctl(tcp, code, arg);
254
-		if (ret != RVAL_DECODED)
255
-			return ret;
256
-		ATTRIBUTE_FALLTHROUGH;
257
-	}
258
-	case 't':
259
-	case 'T':
260
-		return term_ioctl(tcp, code, arg);
261
-#else /* !ALPHA */
262
-	case 'f':
263
-		return file_ioctl(tcp, code, arg);
264
-	case 0x54:
265
-#endif /* !ALPHA */
266
-		return term_ioctl(tcp, code, arg);
267
-	case 0x89:
268
-		return sock_ioctl(tcp, code, arg);
269
-	case 'p':
270
-		return rtc_ioctl(tcp, code, arg);
271 249
 	case 0x03:
272 250
 		return hdio_ioctl(tcp, code, arg);
273 251
 	case 0x12:
274 252
 		return block_ioctl(tcp, code, arg);
275
-	case 'X':
276
-		return fs_x_ioctl(tcp, code, arg);
277
-	case 0x22:
253
+	case '"': /* 0x22 */
278 254
 		return scsi_ioctl(tcp, code, arg);
255
+	case '$': /* 0x24 */
256
+		return perf_ioctl(tcp, code, arg);
257
+#ifdef HAVE_STRUCT_PTP_SYS_OFFSET
258
+	case '=': /* 0x3d */
259
+		return ptp_ioctl(tcp, code, arg);
260
+#endif
261
+#ifdef HAVE_LINUX_INPUT_H
262
+	case 'E':
263
+		return evdev_ioctl(tcp, code, arg);
264
+#endif
265
+	case 'I':
266
+		return inotify_ioctl(tcp, code, arg);
279 267
 	case 'L':
280 268
 		return loop_ioctl(tcp, code, arg);
281 269
 #ifdef HAVE_STRUCT_MTD_WRITE_REQ
@@ -283,27 +271,54 @@ ioctl_decode(struct tcb *tcp)
283 271
 		return mtd_ioctl(tcp, code, arg);
284 272
 #endif
285 273
 #ifdef HAVE_STRUCT_UBI_ATTACH_REQ_MAX_BEB_PER1024
286
-	case 'o':
287 274
 	case 'O':
288 275
 		return ubi_ioctl(tcp, code, arg);
289 276
 #endif
277
+	case 'R':
278
+		return random_ioctl(tcp, code, arg);
279
+	case 'T':
280
+		return term_ioctl(tcp, code, arg);
290 281
 	case 'V':
291 282
 		return v4l2_ioctl(tcp, code, arg);
292
-#ifdef HAVE_STRUCT_PTP_SYS_OFFSET
293
-	case '=':
294
-		return ptp_ioctl(tcp, code, arg);
283
+	case 'W':
284
+		return watchdog_ioctl(tcp, code, arg);
285
+	case 'X':
286
+		return fs_x_ioctl(tcp, code, arg);
287
+	case 'f': {
288
+#if defined(ALPHA) || defined(POWERPC)
289
+		int ret = file_ioctl(tcp, code, arg);
290
+		if (ret != RVAL_DECODED)
291
+			return ret;
292
+		return term_ioctl(tcp, code, arg);
293
+#else /* !(ALPHA || POWERPC) */
294
+		return file_ioctl(tcp, code, arg);
295
+#endif /* (ALPHA || POWERPC) */
296
+	}
297
+#ifdef HAVE_STRUCT_UBI_ATTACH_REQ_MAX_BEB_PER1024
298
+	case 'o':
299
+		return ubi_ioctl(tcp, code, arg);
295 300
 #endif
296
-#ifdef HAVE_LINUX_INPUT_H
297
-	case 'E':
298
-		return evdev_ioctl(tcp, code, arg);
301
+	case 'p':
302
+		return rtc_ioctl(tcp, code, arg);
303
+#if defined(ALPHA) || defined(POWERPC)
304
+	case 't':
305
+		return term_ioctl(tcp, code, arg);
306
+#endif /* !ALPHA */
307
+	case 0x89:
308
+		return sock_ioctl(tcp, code, arg);
309
+#ifdef HAVE_LINUX_BTRFS_H
310
+	case 0x94:
311
+		return btrfs_ioctl(tcp, code, arg);
299 312
 #endif
300 313
 #ifdef HAVE_LINUX_USERFAULTFD_H
301 314
 	case 0xaa:
302 315
 		return uffdio_ioctl(tcp, code, arg);
303 316
 #endif
304
-#ifdef HAVE_LINUX_BTRFS_H
305
-	case 0x94:
306
-		return btrfs_ioctl(tcp, code, arg);
317
+	case 0xab:
318
+		return nbd_ioctl(tcp, code, arg);
319
+#ifdef HAVE_LINUX_KVM_H
320
+	case 0xae:
321
+		return kvm_ioctl(tcp, code, arg);
307 322
 #endif
308 323
 	case 0xb7:
309 324
 		return nsfs_ioctl(tcp, code, arg);
@@ -311,18 +326,6 @@ ioctl_decode(struct tcb *tcp)
311 326
 	case 0xfd:
312 327
 		return dm_ioctl(tcp, code, arg);
313 328
 #endif
314
-#ifdef HAVE_LINUX_KVM_H
315
-	case 0xae:
316
-		return kvm_ioctl(tcp, code, arg);
317
-#endif
318
-	case 'I':
319
-		return inotify_ioctl(tcp, code, arg);
320
-	case 0xab:
321
-		return nbd_ioctl(tcp, code, arg);
322
-	case 'R':
323
-		return random_ioctl(tcp, code, arg);
324
-	case 'W':
325
-		return watchdog_ioctl(tcp, code, arg);
326 329
 	default:
327 330
 		break;
328 331
 	}

Loading…
Cancel
Save