On Tue, Sep 08, 2015 at 04:18:11AM +0300, Dmitry V. Levin wrote:
[...]
> So the whole function should look smth like this:
>
> static int i915_getparam(struct tcb *tcp, const unsigned int code, long arg)
> {
> struct drm_i915_getparam param;
>
> if (entering(tcp)) {
> if (umove_or_printaddr(tcp, arg, ¶m))
> return RVAL_DECODED | 1;
> tprints(", {param=");
or rather
tprints(", ");
if (umove_or_printaddr(tcp, arg, ¶m))
return RVAL_DECODED | 1;
tprints("{param=");
> In this and other functions I slightly prefer
> if (umove_or_printaddr(tcp, arg, ¶m))
> return RVAL_DECODED | 1;
> over your variant because umove_or_printaddr() handles NULL address
> and !verbose(tcp) case better.
And the whole function will look as simple as this:
static int i915_setparam(struct tcb *tcp, const unsigned int code, long arg)
{
struct drm_i915_setparam param;
tprints(", ");
if (!umove_or_printaddr(tcp, arg, ¶m)) {
tprints("{param=");
printxval(drm_i915_setparams, param.param, "I915_PARAM_???");
tprintf(", value=%d}", param.value);
}
return RVAL_DECODED | 1;
}
Note the absence of entering(tcp) check because this DRM_IOW parser always
returns a value with RVAL_DECODED flag set.
--
ldv
pgpHBQCi3an_n.pgp
Description: PGP signature
------------------------------------------------------------------------------
_______________________________________________ Strace-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/strace-devel
