From 10350d5eb083bdf52c9888192581e06a66c17d6e Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Wed, 21 Dec 2016 03:03:09 +0000 Subject: [PATCH] Change type of ioctl 3rd argument from long to kernel_ureg_t * defs.h (DECL_IOCTL): Change arg type from long to kernel_ureg_t. * dm.c (dm_known_ioctl, dm_ioctl): Likewise. * file_ioctl.c (file_ioctl): Likewise. * fs_x_ioctl.c (fs_x_ioctl): Likewise. * ioctl.c (ioctl_decode): Likewise. * loop.c (decode_loop_info, decode_loop_info64): Change addr type from long to kernel_ureg_t. (loop_ioctl): Change arg type from long to kernel_ureg_t. * ptp.c (ptp_ioctl): Likewise. * scsi.c (print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req, print_sg_io_v4_res, scsi_ioctl): Likewise. * sock.c (print_ifreq, sock_ioctl): Likewise. (decode_ifconf): Change addr type from long to kernel_ureg_t. * term.c (decode_termios, decode_termio, decode_winsize, decode_ttysize, decode_modem_flags): Likewise. (term_ioctl): Change arg type from long to kernel_ureg_t. * ubi.c (ubi_ioctl): Likewise. * userfaultfd.c (uffdio_ioctl): Likewise. --- defs.h | 2 +- dm.c | 7 ++++--- file_ioctl.c | 3 ++- fs_x_ioctl.c | 3 ++- ioctl.c | 2 +- loop.c | 7 ++++--- ptp.c | 3 ++- scsi.c | 21 ++++++++++++--------- sock.c | 8 ++++---- term.c | 13 +++++++------ ubi.c | 3 ++- userfaultfd.c | 3 ++- 12 files changed, 43 insertions(+), 32 deletions(-) diff --git a/defs.h b/defs.h index 59dc3028..f44a9fb7 100644 --- a/defs.h +++ b/defs.h @@ -728,7 +728,7 @@ extern unsigned int qual_flags(const unsigned int); #define DECL_IOCTL(name) \ extern int \ -name ## _ioctl(struct tcb *, unsigned int request, long arg) +name ## _ioctl(struct tcb *, unsigned int request, kernel_ureg_t arg) DECL_IOCTL(dm); DECL_IOCTL(file); DECL_IOCTL(fs_x); diff --git a/dm.c b/dm.c index 8f911e6d..c4d3c140 100644 --- a/dm.c +++ b/dm.c @@ -396,7 +396,8 @@ dm_ioctl_has_params(const unsigned int code) } static int -dm_known_ioctl(struct tcb *tcp, const unsigned int code, long arg) +dm_known_ioctl(struct tcb *const tcp, const unsigned int code, + const kernel_ureg_t arg) { struct dm_ioctl *ioc = NULL; struct dm_ioctl *entering_ioc = NULL; @@ -516,7 +517,7 @@ dm_known_ioctl(struct tcb *tcp, const unsigned int code, long arg) } int -dm_ioctl(struct tcb *tcp, const unsigned int code, long arg) +dm_ioctl(struct tcb *const tcp, const unsigned int code, const kernel_ureg_t arg) { switch (code) { case DM_VERSION: @@ -544,7 +545,7 @@ dm_ioctl(struct tcb *tcp, const unsigned int code, long arg) # else /* !(DM_VERSION_MAJOR == 4) */ int -dm_ioctl(struct tcb *tcp, const unsigned int code, long arg) +dm_ioctl(struct tcb *const tcp, const unsigned int code, const kernel_ureg_t arg) { return 0; } diff --git a/file_ioctl.c b/file_ioctl.c index de810193..6f30a23d 100644 --- a/file_ioctl.c +++ b/file_ioctl.c @@ -123,7 +123,8 @@ print_fiemap_extent(struct tcb *tcp, void *elem_buf, size_t elem_size, void *dat #endif /* HAVE_LINUX_FIEMAP_H */ int -file_ioctl(struct tcb *tcp, const unsigned int code, const long arg) +file_ioctl(struct tcb *const tcp, const unsigned int code, + const kernel_ureg_t arg) { switch (code) { case FICLONE: /* W */ diff --git a/fs_x_ioctl.c b/fs_x_ioctl.c index 7403e6b0..619eaa91 100644 --- a/fs_x_ioctl.c +++ b/fs_x_ioctl.c @@ -30,7 +30,8 @@ #include int -fs_x_ioctl(struct tcb *tcp, const unsigned int code, const long arg) +fs_x_ioctl(struct tcb *const tcp, const unsigned int code, + const kernel_ureg_t arg) { switch (code) { #ifdef FITRIM diff --git a/ioctl.c b/ioctl.c index 126513fc..5f6b4595 100644 --- a/ioctl.c +++ b/ioctl.c @@ -227,7 +227,7 @@ static int ioctl_decode(struct tcb *tcp) { const unsigned int code = tcp->u_arg[1]; - const long arg = tcp->u_arg[2]; + const kernel_ureg_t arg = tcp->u_arg[2]; switch (_IOC_TYPE(code)) { #if defined(ALPHA) || defined(POWERPC) diff --git a/loop.c b/loop.c index 2de33c5f..a9d7659a 100644 --- a/loop.c +++ b/loop.c @@ -33,7 +33,7 @@ #include "xlat/loop_crypt_type_options.h" static void -decode_loop_info(struct tcb *tcp, const long addr) +decode_loop_info(struct tcb *const tcp, const kernel_ureg_t addr) { struct loop_info info; @@ -83,7 +83,7 @@ decode_loop_info(struct tcb *tcp, const long addr) } static void -decode_loop_info64(struct tcb *tcp, const long addr) +decode_loop_info64(struct tcb *const tcp, const kernel_ureg_t addr) { struct loop_info64 info64; @@ -140,7 +140,8 @@ decode_loop_info64(struct tcb *tcp, const long addr) } int -loop_ioctl(struct tcb *tcp, const unsigned int code, long arg) +loop_ioctl(struct tcb *const tcp, const unsigned int code, + const kernel_ureg_t arg) { if (!verbose(tcp)) return RVAL_DECODED; diff --git a/ptp.c b/ptp.c index 69880e14..83e0b17b 100644 --- a/ptp.c +++ b/ptp.c @@ -33,7 +33,8 @@ #include "xlat/ptp_flags_options.h" int -ptp_ioctl(struct tcb *tcp, const unsigned int code, const long arg) +ptp_ioctl(struct tcb *const tcp, const unsigned int code, + const kernel_ureg_t arg) { if (!verbose(tcp)) return RVAL_DECODED; diff --git a/scsi.c b/scsi.c index 482c5b8f..db59323d 100644 --- a/scsi.c +++ b/scsi.c @@ -61,7 +61,7 @@ print_sg_io_buffer(struct tcb *const tcp, const kernel_ureg_t addr, } static int -print_sg_io_v3_req(struct tcb *tcp, const long arg) +print_sg_io_v3_req(struct tcb *const tcp, const kernel_ureg_t arg) { struct sg_io_hdr sg_io; @@ -96,7 +96,7 @@ print_sg_io_v3_req(struct tcb *tcp, const long arg) } static void -print_sg_io_v3_res(struct tcb *tcp, const long arg) +print_sg_io_v3_res(struct tcb *const tcp, const kernel_ureg_t arg) { struct sg_io_hdr sg_io; @@ -135,7 +135,7 @@ print_sg_io_v3_res(struct tcb *tcp, const long arg) #ifdef HAVE_LINUX_BSG_H static int -print_sg_io_v4_req(struct tcb *tcp, const long arg) +print_sg_io_v4_req(struct tcb *const tcp, const kernel_ureg_t arg) { struct sg_io_v4 sg_io; @@ -173,7 +173,7 @@ print_sg_io_v4_req(struct tcb *tcp, const long arg) } static void -print_sg_io_v4_res(struct tcb *tcp, const long arg) +print_sg_io_v4_res(struct tcb *const tcp, const kernel_ureg_t arg) { struct sg_io_v4 sg_io; uint32_t din_len; @@ -211,21 +211,22 @@ print_sg_io_v4_res(struct tcb *tcp, const long arg) #else /* !HAVE_LINUX_BSG_H */ static int -print_sg_io_v4_req(struct tcb *tcp, const long arg) +print_sg_io_v4_req(struct tcb *const tcp, const kernel_ureg_t arg) { tprints("...}"); return RVAL_DECODED | 1; } static void -print_sg_io_v4_res(struct tcb *tcp, const long arg) +print_sg_io_v4_res(struct tcb *const tcp, const kernel_ureg_t arg) { } #endif static int -print_sg_io_req(struct tcb *tcp, uint32_t iid, const long arg) +print_sg_io_req(struct tcb *const tcp, const uint32_t iid, + const kernel_ureg_t arg) { tprintf("{'%c', ", iid); @@ -242,7 +243,8 @@ print_sg_io_req(struct tcb *tcp, uint32_t iid, const long arg) } static void -print_sg_io_res(struct tcb *tcp, uint32_t iid, const long arg) +print_sg_io_res(struct tcb *const tcp, const uint32_t iid, + const kernel_ureg_t arg) { switch (iid) { case 'S': @@ -255,7 +257,8 @@ print_sg_io_res(struct tcb *tcp, uint32_t iid, const long arg) } int -scsi_ioctl(struct tcb *tcp, const unsigned int code, const long arg) +scsi_ioctl(struct tcb *const tcp, const unsigned int code, + const kernel_ureg_t arg) { uint32_t iid; diff --git a/sock.c b/sock.c index 3e197ed0..dcc3e41e 100644 --- a/sock.c +++ b/sock.c @@ -50,8 +50,8 @@ print_ifname(const char *ifname) } static void -print_ifreq(struct tcb *tcp, const unsigned int code, const long arg, - const struct ifreq *ifr) +print_ifreq(struct tcb *const tcp, const unsigned int code, + const kernel_ureg_t arg, const struct ifreq *const ifr) { switch (code) { case SIOCSIFADDR: @@ -132,7 +132,7 @@ print_ifc_len(int len) } static int -decode_ifconf(struct tcb *tcp, const long addr) +decode_ifconf(struct tcb *const tcp, const kernel_ureg_t addr) { struct ifconf ifc; @@ -195,7 +195,7 @@ decode_ifconf(struct tcb *tcp, const long addr) } int -sock_ioctl(struct tcb *tcp, const unsigned int code, const long arg) +sock_ioctl(struct tcb *const tcp, const unsigned int code, const kernel_ureg_t arg) { struct ifreq ifr; diff --git a/term.c b/term.c index 2b0be68e..62a2efeb 100644 --- a/term.c +++ b/term.c @@ -38,7 +38,7 @@ #include "xlat/modem_flags.h" static void -decode_termios(struct tcb *tcp, const long addr) +decode_termios(struct tcb *const tcp, const kernel_ureg_t addr) { struct termios tios; int i; @@ -74,7 +74,7 @@ decode_termios(struct tcb *tcp, const long addr) } static void -decode_termio(struct tcb *tcp, const long addr) +decode_termio(struct tcb *const tcp, const kernel_ureg_t addr) { struct termio tio; int i; @@ -116,7 +116,7 @@ decode_termio(struct tcb *tcp, const long addr) } static void -decode_winsize(struct tcb *tcp, const long addr) +decode_winsize(struct tcb *const tcp, const kernel_ureg_t addr) { struct winsize ws; @@ -132,7 +132,7 @@ decode_winsize(struct tcb *tcp, const long addr) #ifdef TIOCGSIZE static void -decode_ttysize(struct tcb *tcp, const long addr) +decode_ttysize(struct tcb *const tcp, const kernel_ureg_t addr) { struct ttysize ts; @@ -148,7 +148,7 @@ decode_ttysize(struct tcb *tcp, const long addr) #endif static void -decode_modem_flags(struct tcb *tcp, const long addr) +decode_modem_flags(struct tcb *const tcp, const kernel_ureg_t addr) { int i; @@ -164,7 +164,8 @@ decode_modem_flags(struct tcb *tcp, const long addr) } int -term_ioctl(struct tcb *tcp, const unsigned int code, const long arg) +term_ioctl(struct tcb *const tcp, const unsigned int code, + const kernel_ureg_t arg) { switch (code) { /* struct termios */ diff --git a/ubi.c b/ubi.c index dfac0be0..4d46a3cd 100644 --- a/ubi.c +++ b/ubi.c @@ -40,7 +40,8 @@ #include "xlat/ubi_volume_props.h" int -ubi_ioctl(struct tcb *tcp, const unsigned int code, const long arg) +ubi_ioctl(struct tcb *const tcp, const unsigned int code, + const kernel_ureg_t arg) { if (!verbose(tcp)) return RVAL_DECODED; diff --git a/userfaultfd.c b/userfaultfd.c index 07094a10..4be01d14 100644 --- a/userfaultfd.c +++ b/userfaultfd.c @@ -55,7 +55,8 @@ tprintf_uffdio_range(const struct uffdio_range *range) } int -uffdio_ioctl(struct tcb *tcp, const unsigned int code, const long arg) +uffdio_ioctl(struct tcb *const tcp, const unsigned int code, + const kernel_ureg_t arg) { switch (code) { case UFFDIO_API: { -- 2.40.0