Mpersify struct sg_io_hdr

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.
This commit is contained in:
Дмитрий Левин 2017-01-08 00:26:36 +00:00
parent 768d7cb78f
commit d30a9bf779
2 changed files with 15 additions and 6 deletions

1
defs.h
View File

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

View File

@ -31,7 +31,17 @@
#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);