]> granicus.if.org Git - strace/commitdiff
Mpersify struct sg_io_hdr
authorDmitry V. Levin <ldv@altlinux.org>
Sun, 8 Jan 2017 00:26:36 +0000 (00:26 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 8 Jan 2017 01:05:50 +0000 (01:05 +0000)
struct sg_io_hdr contains pointers and therefore has to be mpersified.

* defs.h (decode_sg_io_v3): Remove prototype.
* sg_io_v3.c (struct_sg_io_hdr): Typedef to struct sg_io_hdr.
Mpersify it.
(decode_sg_io_v3): Wrap into MPERS_PRINTER_DECL.

defs.h
sg_io_v3.c

diff --git a/defs.h b/defs.h
index 7a874c911095af4300df62ec48411413b7c8d4c7..eae3987445333aaebd6f63523edd4b16095a296a 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -638,7 +638,6 @@ DECL_IOCTL(ubi);
 DECL_IOCTL(uffdio);
 #undef DECL_IOCTL
 
-extern int decode_sg_io_v3(struct tcb *, const kernel_ulong_t arg);
 extern int decode_sg_io_v4(struct tcb *, const kernel_ulong_t arg);
 
 extern int tv_nz(const struct timeval *);
index 47d847d4d58d22f75d047ade1069f50ef4d01e52..ec8a6ae01fdd317d3d9a2c63cc06b7670faac9cc 100644 (file)
 
 #ifdef HAVE_SCSI_SG_H
 
+#include DEF_MPERS_TYPE(struct_sg_io_hdr)
+
 # include <scsi/sg.h>
+
+typedef struct sg_io_hdr struct_sg_io_hdr;
+
+#endif /* HAVE_SCSI_SG_H */
+
+#include MPERS_DEFS
+
+#ifdef HAVE_SCSI_SG_H
 # include "xlat/sg_io_dxfer_direction.h"
 
 static void
@@ -44,9 +54,9 @@ print_sg_io_buffer(struct tcb *const tcp, const kernel_ulong_t addr,
 static int
 decode_request(struct tcb *const tcp, const kernel_ulong_t arg)
 {
-       struct sg_io_hdr sg_io;
+       struct_sg_io_hdr sg_io;
        static const size_t skip_iid =
-               offsetof(struct sg_io_hdr, dxfer_direction);
+               offsetof(struct_sg_io_hdr, dxfer_direction);
 
        tprints("{interface_id='S', ");
        if (umoven_or_printaddr(tcp, arg + skip_iid, sizeof(sg_io) - skip_iid,
@@ -84,7 +94,7 @@ decode_request(struct tcb *const tcp, const kernel_ulong_t arg)
 static int
 decode_response(struct tcb *const tcp, const kernel_ulong_t arg)
 {
-       struct sg_io_hdr sg_io;
+       struct_sg_io_hdr sg_io;
 
        if (umove(tcp, arg, &sg_io) < 0) {
                tprints(", ???");
@@ -142,8 +152,8 @@ decode_response(struct tcb *const tcp, const kernel_ulong_t arg)
 
 #endif
 
-int
-decode_sg_io_v3(struct tcb *const tcp, const kernel_ulong_t arg)
+MPERS_PRINTER_DECL(int, decode_sg_io_v3,
+                  struct tcb *const tcp, const kernel_ulong_t arg)
 {
        return entering(tcp) ? decode_request(tcp, arg)
                             : decode_response(tcp, arg);