Commit Graph

39 Commits

Author SHA1 Message Date
Eugene Syromyatnikov
dc3dfc68b4 Update copyright headers
Headers updated automatically with

    maint/update_copyright_headers.sh -c
2017-09-05 10:09:10 +02:00
d45d71be06 Imply RVAL_DECODED when RVAL_IOCTL_PARSED is returned on entering
Also, rename RVAL_IOCTL_PARSED to RVAL_IOCTL_DECODED as the latter
is a more suitable name.

* defs.h (RVAL_IOCTL_PARSED): Rename to RVAL_IOCTL_DECODED.
* ioctl.c (ioctl_decode): Update comment.
(SYS_FUNC(ioctl)): Replace RVAL_IOCTL_PARSED with RVAL_IOCTL_DECODED,
add convertation of RVAL_IOCTL_DECODED to RVAL_DECODED.
* block.c (block_ioctl): Replace RVAL_DECODED | RVAL_IOCTL_PARSED
with RVAL_IOCTL_DECODED on entering.  Replace RVAL_IOCTL_PARSED
with RVAL_IOCTL_DECODED on exiting.
* btrfs.c (btrfs_ioctl): Likewise.
* evdev.c: Likewise.
* file_ioctl.c: Likewise.
* fs_x_ioctl.c: Likewise.
* hdio.c: Likewise.
* loop.c: Likewise.
* mtd.c: Likewise.
* nsfs.c: Likewise.
* print_sg_req_info.c: Likewise.
* ptp.c: Likewise.
* rtc.c: Likewise.
* scsi.c: Likewise.
* sg_io_v3.c: Likewise.
* sg_io_v4.c: Likewise.
* sock.c: Likewise.
* term.c: Likewise.
* ubi.c: Likewise.
* userfaultfd.c: Likewise.
* dm.c (dm_known_ioctl): Return RVAL_IOCTL_DECODED on exiting and 0
on entering.  Replace RVAL_IOCTL_PARSED with RVAL_IOCTL_DECODED
on exiting.
* v4l2.c: Likewise.

Co-authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
2017-08-28 00:39:15 +00:00
Eugene Syromyatnikov
3ca301fff8 Replace return 1 ioctl sub-decoder hack with proper flag
* defs.h (RVAL_IOCTL_PARSED): Introduce new flag for ioctl sub-decoders
* to signalise that they have successfully printed argument.
* ioctl.c (SYS_FUNC(ioctl)): Check for RVAL_IOCTL_PARSED flag, remove
un-set it before returning the value.
* block.c: Use RVAL_IOCTL_PARSED instead of 1.
* btrfs.c: Likewise.
* dm.c: Likewise.
* evdev.c: Likewise.
* file_ioctl.c: Likewise.
* fs_x_ioctl.c: Likewise.
* hdio.c: Likewise.
* loop.c: Likewise.
* mtd.c: Likewise.
* nsfs.c: Likewise.
* print_sg_req_info.c: Likewise.
* ptp.c: Likewise.
* rtc.c: Likewise.
* scsi.c: Likewise.
* sg_io_v3.c: Likewise.
* sg_io_v4.c: Likewise.
* sock.c: Likewise.
* term.c: Likewise.
* ubi.c: Likewise.
* userfaultfd.c: Likewise.
* v4l2.c: Likewise.
2017-08-28 02:33:20 +02:00
184e94ba05 Fix a few spacing style issues
Reported by kernel's checkpatch.pl script.
2017-06-17 22:54:08 +00:00
89636759d7 Automatically replace PRI_kr[dux] with PRI_kl[dux]
Remove temporary macros created for transition from long
to kernel_ulong_t.

Automatically replace PRI_kr[dux] with PRI_kl[dux] using
$ git grep -l 'PRI_kr[dux]' | xargs sed -ri 's/PRI_kr([dux])/PRI_kl\1/g'

* defs.h (PRI_krd, PRI_kru, PRI_krx): Remove.  All users updated.
2016-12-26 10:43:34 +00:00
7fa3d78319 Automatically replace kernel_(scno|ureg)_t with kernel_ulong_t
Remove temporary types created for transition from long
to kernel_ulong_t.

Automatically replace kernel_scno_t and kernel_ureg_t with
kernel_ulong_t using
$ git grep -El 'kernel_(scno|ureg)_t' |
  xargs sed -ri 's/kernel_(scno|ureg)_t/kernel_ulong_t/g'

* kernel_types.h (kernel_scno_t, kernel_ureg_t): Remove.
All users updated.
2016-12-26 10:43:34 +00:00
1d5bb61c49 Print kernel_ureg_t and kernel_scno_t using dedicated format strings
Prepare for the change of kernel_ureg_t and kernel_scno_t from
unsigned long to kernel_ulong_t.

* defs.h (PRI_krd, PRI_kru, PRI_krx): New temporary macros.
All users updated.
2016-12-26 10:43:04 +00:00
9050affe7c Use ptr_to_kulong instead of explicit casts of pointers to kernel_ureg_t
Direct casts to kernel_ureg_t will not work after the change
of kernel_ureg_t from unsigned long to kernel_ulong_t.

* defs.h (ptr_to_kulong): New macro.
* block.c (print_blkpg_req): Use it instead of explicit casts
to kernel_ureg_t.
* btrfs.c (btrfs_ioctl): Likewise.
* evdev.c (ff_effect_ioctl): Likewise.
* mmsghdr.c (dumpiov_in_mmsghdr): Likewise.
* msghdr.c (print_struct_msghdr, dumpiov_in_msghdr): Likewise.
* mtd.c (decode_mtd_oob_buf): Likewise.
* printsiginfo.c (printsigval, print_si_info): Likewise.
* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res): Likewise.
* sigaltstack.c (print_stack_t): Likewise.
* sock.c (decode_ifconf): Likewise.
* sysctl.c (SYS_FUNC(sysctl)): Likewise.
* util.c (dumpiov_upto): Likewise.
* v4l2.c (print_v4l2_framebuffer, print_v4l2_ext_control,
print_v4l2_ext_controls): Likewise.
2016-12-26 01:59:08 +00:00
a940d1a60f printstr: rename to printstrn, add printstr as a thin wrapper
As about half of all printstr uses cases are invocations with the last
argument set to -1, create a dedicated function for this use case.

* defs.h (printstr): Rename to printstrn.  All callers updated.
(printstr): New static inline function.  All callers updated.
2016-12-25 11:32:45 +00:00
7f1742631f evdev: change type of ioctl 3rd argument from long to kernel_ureg_t
* evdev.c (ff_effect_ioctl, abs_ioctl, keycode_ioctl, keycode_V2_ioctl,
getid_ioctl, decode_bitset, mtslots_ioctl, repeat_ioctl, bit_ioctl,
evdev_read_ioctl, evdev_write_ioctl, evdev_ioctl): Change arg type
from long to kernel_ureg_t.
2016-12-25 11:32:44 +00:00
a06073fbbb evdev: cast tcp->u_rval to kernel_ureg_t instead of unsigned long
* evdev.c (decode_bitset): Cast tcp->u_rval to kernel_ureg_t
instead of unsigned long.
2016-12-21 23:35:28 +00:00
fa66f3f700 evdev: cast pointers to kernel_ureg_t instead of unsigned long
* evdev.c (ff_effect_ioctl): Cast ff_periodic_effect.custom_data
pointer to kernel_ureg_t instead of unsigned long.
2016-12-21 23:35:28 +00:00
7af5e6593f evdev.c: fix typo in comment 2016-08-15 21:08:56 +00:00
484326dbd8 Consistently use printaddr for printing addresses
* bjm.c (SYS_FUNC(init_module)): Use printaddr.
* clone.c (SYS_FUNC(clone)): Likewise.
* evdev.c (ff_effect_ioctl): Likewise.
* mtd.c (decode_mtd_oob_buf): Likewise.
* net.c (SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg), SYS_FUNC(getsockopt)):
Likewise.
* print_sigevent.c (print_sigevent): Likewise.
* printsiginfo.c (printsigval, print_si_info): Likewise.
* signal.c (decode_new_sigaction): Likewise.
* sysmips.c (SYS_FUNC(sysmips)): Likewise.
* util.c (printpathn, printstr, umoven_or_printaddr): Likewise.
* v4l2.c (print_v4l2_buffer, print_v4l2_framebuffer,
umoven_or_printaddr_ignore_syserror): Likewise.
* tests/net-icmp_filter.c (main): Update.

Based on patch by Eugene Syromyatnikov <evgsyr@gmail.com>.
2016-06-11 09:26:49 +00:00
43c8a5d0e8 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.
2016-05-28 00:56:47 +00:00
aa21c07f2e evdev.c: fix printing of unrecognized event type passed to EVIOCGBIT
* evdev.c (bit_ioctl): If event type is not unrecognized,
print the argument as an address.
2016-05-28 00:56:47 +00:00
47be9f2597 evdev.c: fix printing of EV_PWR's argument
* evdev.c (bit_ioctl): Fix printing of comma before EV_PWR's argument.
2016-05-28 00:56:47 +00:00
3f23c0c79f evdev.c: fix indentation
* evdev.c: Fix indentation of print formats.
2016-05-28 00:56:47 +00:00
10de2eb030 evdev.c: fix decoding of EVIOCGNAME, EVIOCGPHYS, and EVIOCGUNIQ
* evdev.c (evdev_read_ioctl): Fix printing of the string returned
in response to EVIOCGNAME, EVIOCGPHYS, and EVIOCGUNIQ requests.
2016-05-28 00:56:47 +00:00
b29569aa1d evdev.c: fix EVIOCGVERSION decoding
* evdev.c (evdev_read_ioctl): Print EVIOCGVERSION's argument
using #x format.
2016-05-28 00:56:47 +00:00
563f0cefb1 evdev.c: fix EVIOCGMTSLOTS decoding
* evdev.c (mtslots_ioctl): Use umove_or_printaddr.
2016-05-28 00:56:47 +00:00
14a810e6d8 evdev.c: fix bitset decoding
* evdev.c (decode_bitset): Use umove_or_printaddr.
2016-05-28 00:56:47 +00:00
e54f98a223 evdev.c: fix decoding of struct input_id
* evdev.c (getid_ioctl): Use umove_or_printaddr.
2016-05-28 00:56:47 +00:00
13f8e8fb4e evdev.c: fix decoding of struct input_keymap_entry
* evdev.c (keycode_V2_ioctl): Use umove_or_printaddr.
2016-05-28 00:56:47 +00:00
7954e2a711 evdev.c: fix decoding of EVIOCGKEYCODE/EVIOCSKEYCODE
* evdev.c (keycode_ioctl): Use umove_or_printaddr.
2016-05-28 00:56:47 +00:00
e167006908 evdev.c: fix decoding of struct input_absinfo
* evdev.c (abs_ioctl): Use umove_or_printaddr.
2016-05-28 00:56:46 +00:00
3a45eb3711 evdev.c: fix decoding of struct ff_effect
* evdev.c (ff_effect_ioctl): Use umove_or_printaddr.
Fix printing of struct ff_effect.u member names.
2016-05-28 00:37:06 +00:00
c758ed0f50 evdev.c: fix printing of struct ff_envelope.fade_level
* evdev.c (decode_envelope): Print struct ff_envelope.fade_level
using #x format.
2016-05-28 00:37:06 +00:00
9635df43b6 evdev.c: fix decoding of EVIOCGRAB and EVIOCREVOKE
* evdev.c (evdev_write_ioctl): Print argument of EVIOCGRAB
and EVIOCREVOKE as unsigned long.
2016-05-28 00:37:06 +00:00
0039424cb9 evdev.c: fix EVIOCRMFF decoding
* evdev.c (evdev_write_ioctl): Print EVIOCRMFF's argument as int.
2016-05-28 00:37:06 +00:00
53767d8ec5 evdev.c: move handling of EVIOCGBIT to a separate function
* evdev.c (evdev_read_ioctl): Move EVIOCGBIT handling to ...
(bit_ioctl): ... new function.
2016-05-28 00:37:05 +00:00
8a18f80a37 evdev.c: reorder ioctl command checks
Change the order of ioctl command cheks to match the kernel:
1st, check for fixed-number fixed-length commands,
2nd, check for fixed-number variable-length commands,
3rd, check for multi-number fixed-length commands,
4thm check for multi-number variable-length commands.

* evdev.c (evdev_read_ioctl, evdev_write_ioctl): Reorder
ioctl command checks.
2016-05-28 00:37:05 +00:00
2114e08a87 evdev.c: decode all directions except _IOC_READ on entering syscall
* evdev.c (evdev_write_ioctl): Remove exiting check.
(evdev_read_ioctl): Move entering check ...
(evdev_ioctl): ... here.  Add RVAL_DECODED to return code in _IOC_WRITE
and default cases.
2016-05-28 00:37:05 +00:00
8d85c233d2 evdev.c: fix indentation of preprocessor directives
* evdev.c: Fix indentation of preprocessor directives.
Move inclusion of <linux/ioctl.h> into [HAVE_LINUX_INPUT_H].
2016-05-28 00:37:05 +00:00
b679508f6e Use printpair_int
* evdev.c (repeat_ioctl): Use printpair_int.
* net.c (do_pipe, sys_socketpair): Likewise.
2015-07-09 01:43:44 +00:00
Felix Janda
3460dc486d Include <linux/ioctl.h> for _IOC_* macros
Fix a compilation failure with musl libc.

* evdev.c: Include <linux/ioctl.h>.
* ioctl.c: Include <linux/ioctl.h> instead of <asm/ioctl.h>.
* ioctlsort.c: Likewise.

Reported-by: Dima Krasner <dima@dimakrasner.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2015-03-28 22:37:30 +00:00
7d8b41a4f7 evdev: decode keycode value in EVIOC[GS]KEYCODE_V2 commands
* evdev.c (keycode_V2_ioctl): Use evdev_keycode to print
input_keymap_entry.keycode.
2015-02-22 02:29:55 +00:00
19dadf9401 evdev: fix build with old kernel headers
* configure.ac: Check whether struct input_absinfo.resolution is defined
in <linux/input.h>.
* evdev.c (SYN_MAX): Add fallback definition.
(abs_ioctl): Wrap use of struct input_absinfo.resolution in #ifdef check.
(keycode_V2_ioctl, mtslots_ioctl, repeat_ioctl): Wrap in #ifdef checks.
(evdev_read_ioctl): Wrap in #ifdef checks the code that uses EV_SW,
EVIOCGREP, EVIOCGKEYCODE_V2, EVIOCGMTSLOTS, EVIOCGPROP, and EVIOCGSW.
(evdev_write_ioctl): Wrap in #ifdef checks the code that uses EVIOCSREP,
EVIOCSKEYCODE_V2, EVIOCSCLOCKID, and EVIOCREVOKE.
2015-02-22 02:29:55 +00:00
Etienne Gemsa
4f750b9ad1 Add decoding for evdev ioctls
This patch introduces decoding for evdev ioctls.  For EVIOCSFF the five
first members are decoded, the union is not.  The code was compiled and
tested on x86_64 with Linux 3.13.

* evdev.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (evdev_ioctl): New prototype.
* ioctl.c (ioctl_decode): Call evdev_ioctl for 'E' ioctl commands.
* xlat/evdev_autorepeat.in: New file.
* xlat/evdev_ff_status.in: New file.
* xlat/evdev_ff_types.in: New file.
* xlat/evdev_keycode.in: New file.
* xlat/evdev_leds.in: New file.
* xlat/evdev_misc.in: New file.
* xlat/evdev_mtslots.in: New file.
* xlat/evdev_prop.in: New file.
* xlat/evdev_relative_axes.in: New file.
* xlat/evdev_snd.in: New file.
* xlat/evdev_switch.in: New file.
* xlat/evdev_sync.in: New file.

Signed-off-by: Etienne Gemsa <etienne.gemsa@lse.epita.fr>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2015-02-22 02:29:54 +00:00