From: Eugene Syromyatnikov Date: Mon, 19 Dec 2016 00:15:27 +0000 (+0300) Subject: loop: mpersify struct loop_info and loop_ioctl function X-Git-Tag: v4.16~124 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f0026a38189d3febd7ee090232fa07409b9048c9;p=strace loop: mpersify struct loop_info and loop_ioctl function struct loop_info contains fields of type long, so it definitely should have been mpersified. * defs.h (loop_ioctl): Remove prototype. * loop.c (struct_loop_info): New typedef. Include DEF_MPERS_TYPE(struct_loop_info) and MPERS_DEFS. (decode_loop_info): Replace struct loop_info with struct_loop_info. Cast lo_inode, lo_init[0], and lo_init[1] to kernel_ulong_t and print them using appropriate format specifiers. (loop_ioctl): Wrap into MPERS_PRINTER_DECL. Co-authored-by: Dmitry V. Levin --- diff --git a/defs.h b/defs.h index 1e056068..3ecab0bf 100644 --- a/defs.h +++ b/defs.h @@ -670,7 +670,6 @@ name ## _ioctl(struct tcb *, unsigned int request, kernel_ulong_t arg) DECL_IOCTL(dm); DECL_IOCTL(file); DECL_IOCTL(fs_x); -DECL_IOCTL(loop); DECL_IOCTL(ptp); DECL_IOCTL(scsi); DECL_IOCTL(sock); diff --git a/loop.c b/loop.c index 29233919..ebb518bc 100644 --- a/loop.c +++ b/loop.c @@ -29,13 +29,19 @@ #include #include +typedef struct loop_info struct_loop_info; + +#include DEF_MPERS_TYPE(struct_loop_info) + +#include MPERS_DEFS + #include "xlat/loop_flags_options.h" #include "xlat/loop_crypt_type_options.h" static void decode_loop_info(struct tcb *const tcp, const kernel_ulong_t addr) { - struct loop_info info; + struct_loop_info info; tprints(", "); if (umove_or_printaddr(tcp, addr, &info)) @@ -46,7 +52,7 @@ decode_loop_info(struct tcb *const tcp, const kernel_ulong_t addr) if (!abbrev(tcp)) { tprints(", lo_device="); print_dev_t(info.lo_device); - tprintf(", lo_inode=%lu", info.lo_inode); + tprintf(", lo_inode=%" PRI_klu, (kernel_ulong_t) info.lo_inode); tprints(", lo_rdevice="); print_dev_t(info.lo_rdevice); } @@ -74,9 +80,10 @@ decode_loop_info(struct tcb *const tcp, const kernel_ulong_t addr) } if (!abbrev(tcp)) - tprintf(", lo_init=[%#lx, %#lx]" + tprintf(", lo_init=[%#" PRI_klx ", %#" PRI_klx "]" ", reserved=[%#x, %#x, %#x, %#x]}", - info.lo_init[0], info.lo_init[1], + (kernel_ulong_t) info.lo_init[0], + (kernel_ulong_t) info.lo_init[1], info.reserved[0], info.reserved[1], info.reserved[2], info.reserved[3]); else @@ -141,9 +148,9 @@ decode_loop_info64(struct tcb *const tcp, const kernel_ulong_t addr) tprints(", ...}"); } -int -loop_ioctl(struct tcb *const tcp, const unsigned int code, - const kernel_ulong_t arg) +MPERS_PRINTER_DECL(int, loop_ioctl, + struct tcb *tcp, const unsigned int code, + const kernel_ulong_t arg) { if (!verbose(tcp)) return RVAL_DECODED;