From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Dmitry V. Levin" Subject: Re: [PATCH v4 4/5] drm: Add decoding of i915 ioctls Date: Tue, 8 Sep 2015 04:30:52 +0300 Message-ID: <20150908013052.GC17781@altlinux.org> References: <1440420170-13337-1-git-send-email-patrik.jakobsson@linux.intel.com> <1440420170-13337-5-git-send-email-patrik.jakobsson@linux.intel.com> <20150908011811.GB17781@altlinux.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1120211296==" Return-path: Received: from pegasus3.altlinux.org (pegasus3.altlinux.org [194.107.17.103]) by gabe.freedesktop.org (Postfix) with ESMTP id EA5C66E565 for ; Mon, 7 Sep 2015 18:30:53 -0700 (PDT) In-Reply-To: <20150908011811.GB17781@altlinux.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Patrik Jakobsson Cc: intel-gfx@lists.freedesktop.org, strace-devel@lists.sourceforge.net List-Id: intel-gfx@lists.freedesktop.org --===============1120211296== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UPT3ojh+0CqEDtpF" Content-Disposition: inline --UPT3ojh+0CqEDtpF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 08, 2015 at 04:18:11AM +0300, Dmitry V. Levin wrote: [...] > So the whole function should look smth like this: >=20 > static int i915_getparam(struct tcb *tcp, const unsigned int code, long a= rg) > { > struct drm_i915_getparam param; >=20 > if (entering(tcp)) { > if (umove_or_printaddr(tcp, arg, ¶m)) > return RVAL_DECODED | 1; > tprints(", {param=3D"); or rather tprints(", "); if (umove_or_printaddr(tcp, arg, ¶m)) return RVAL_DECODED | 1; tprints("{param=3D"); > 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=3D"); printxval(drm_i915_setparams, param.param, "I915_PARAM_???"); tprintf(", value=3D%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. --=20 ldv --UPT3ojh+0CqEDtpF Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlXuOkwACgkQfKvmrJ41Nh7LHACgomVjbrsY+lWr8+Lba/pGtf7g 3XAAn3HvwLb3Fk2kmBHQ3HpBdgrAKR0P =VMSD -----END PGP SIGNATURE----- --UPT3ojh+0CqEDtpF-- --===============1120211296== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9pbnRlbC1nZngK --===============1120211296==--