Mpersify EVIOC* ioctl parser

* 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.
This commit is contained in:
Дмитрий Левин 2016-05-27 00:49:08 +00:00
parent aa21c07f2e
commit 43c8a5d0e8
3 changed files with 20 additions and 8 deletions

2
NEWS
View File

@ -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,

2
defs.h
View File

@ -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);

24
evdev.c
View File

@ -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
@ -30,9 +30,19 @@
#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"
@ -51,8 +61,10 @@
# 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: