]> granicus.if.org Git - strace/commitdiff
Mpersify EVIOC* ioctl parser
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 27 May 2016 00:49:08 +0000 (00:49 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 28 May 2016 00:56:47 +0000 (00:56 +0000)
* defs.h (evdev_abs): New xlat prototype.
(evdev_ioctl): Remove.
* evdev.c: Do not include "xlat/evdev_abs.h".
Mpersify struct ff_effect and ioctl numbers.
(evdev_ioctl): Mpersify.
* NEWS: Mention this enhancement.

NEWS
defs.h
evdev.c

diff --git a/NEWS b/NEWS
index 7440afd3c04390bbb6211a3572e59e4ba3171bf3..31028e78ce1eb9124ba0e0a82c0f7885d897d394 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,7 +12,7 @@ Noteworthy changes in release 4.12 (????-??-??)
   * Implemented dumping of preadv, preadv2, pwritev, pwritev2, and vmsplice
     syscalls.
   * Implemented decoding of BTRFS_* and UFFDIO_* ioctl commands.
-  * Enhanced decoding of BLK*, RTC_*, and VIDIOC_* ioctl commands.
+  * Enhanced decoding of BLK*, EVIOC*, RTC_*, and VIDIOC_* ioctl commands.
   * Enhanced decoding of fstatfs, fstatfs64, get_mempolicy, getdents,
     getdents64, getgroups, getpriority, kill, mbind, migrate_pages, mknod,
     mknodat, personality, poll, ppoll, quotactl, rt_sigpending,
diff --git a/defs.h b/defs.h
index 0416b815c9bc98d03f510bf9b21faea1a88ccec9..b2a7f4d8222a20f67d6f7778847e9c322d2c7028 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -372,6 +372,7 @@ typedef uint8_t qualbits_t;
 extern const struct xlat addrfams[];
 extern const struct xlat at_flags[];
 extern const struct xlat dirent_types[];
+extern const struct xlat evdev_abs[];
 extern const struct xlat open_access_modes[];
 extern const struct xlat open_mode_flags[];
 extern const struct xlat resource_flags[];
@@ -659,7 +660,6 @@ struct strace_statfs;
 extern void print_struct_statfs(struct tcb *tcp, long);
 extern void print_struct_statfs64(struct tcb *tcp, long, unsigned long);
 
-extern int evdev_ioctl(struct tcb *, const unsigned int, long);
 extern int file_ioctl(struct tcb *, const unsigned int, long);
 extern int fs_x_ioctl(struct tcb *, const unsigned int, long);
 extern int hdio_ioctl(struct tcb *, const unsigned int, long);
diff --git a/evdev.c b/evdev.c
index 9a6c631b7a8ab07afee015125aa0ecfd1c54df8e..2e436d6e8a2910a30ea05e33a27b227f26feefc6 100644 (file)
--- a/evdev.c
+++ b/evdev.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2015 Etienne Gemsa <etienne.gemsa@lse.epita.fr>
- * Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 
 #ifdef HAVE_LINUX_INPUT_H
 
+#include DEF_MPERS_TYPE(struct_ff_effect)
+
 # include <linux/ioctl.h>
 # include <linux/input.h>
-# include "xlat/evdev_abs.h"
+
+typedef struct ff_effect struct_ff_effect;
+
+#endif /* HAVE_LINUX_BTRFS_H */
+
+#include MPERS_DEFS
+
+#ifdef HAVE_LINUX_INPUT_H
+
 # include "xlat/evdev_autorepeat.h"
 # include "xlat/evdev_ff_status.h"
 # include "xlat/evdev_ff_types.h"
 # endif
 
 static void
-decode_envelope(const struct ff_envelope *envelope)
+decode_envelope(void *const data)
 {
+       const struct ff_envelope *const envelope = data;
+
        tprintf(", envelope={attack_length=%" PRIu16
                ", attack_level=%" PRIu16
                ", fade_length=%" PRIu16
@@ -68,7 +80,7 @@ ff_effect_ioctl(struct tcb *tcp, long arg)
 {
        tprints(", ");
 
-       struct ff_effect ffe;
+       struct_ff_effect ffe;
 
        if (umove_or_printaddr(tcp, arg, &ffe))
                return 1;
@@ -497,8 +509,8 @@ evdev_write_ioctl(struct tcb *tcp, const unsigned int code, const long arg)
        return 0;
 }
 
-int
-evdev_ioctl(struct tcb *tcp, const unsigned int code, long arg)
+MPERS_PRINTER_DECL(int, evdev_ioctl, struct tcb *tcp,
+                  const unsigned int code, const long arg)
 {
        switch(_IOC_DIR(code)) {
                case _IOC_READ: