From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Patrik Jakobsson <patrik.jakobsson@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, strace-devel@lists.sourceforge.net
Subject: Re: [PATCH v4 3/5] drm: Add dispatcher and driver identification for DRM
Date: Tue, 8 Sep 2015 03:36:25 +0300 [thread overview]
Message-ID: <20150908003624.GA17781@altlinux.org> (raw)
In-Reply-To: <1440420170-13337-4-git-send-email-patrik.jakobsson@linux.intel.com>
[-- Attachment #1.1: Type: text/plain, Size: 2648 bytes --]
On Mon, Aug 24, 2015 at 02:42:48PM +0200, Patrik Jakobsson wrote:
> * Makefile.am: Add compilation of drm.c.
> * defs.h: Add extern declaration of drm_ioctl when drm headers are found.
> * drm.c: New file.
> * ioctl.c (ioctl_decode): Dispatch drm ioctls when drm headers are found.
* defs.h (drm_decode_number, drm_ioctl): New prototypes.
* drm.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* ioctl.c (ioctl_decode_command_number, ioctl_decode)
[HAVE_DRM_H || HAVE_DRM_DRM_H]: Dispatch drm ioctls.
> --- a/defs.h
> +++ b/defs.h
> @@ -612,6 +612,9 @@ extern const char *sprint_open_modes(int);
> extern void print_seccomp_filter(struct tcb *tcp, unsigned long);
>
> extern int block_ioctl(struct tcb *, const unsigned int, long);
> +#if defined(HAVE_DRM_H) || defined(HAVE_DRM_DRM_H)
> +extern int drm_ioctl(struct tcb *, const unsigned int, long);
> +#endif
I think function these prototypes could be added unconditionally.
Note that v3 version of this patch also declared drm_decode_number().
> --- /dev/null
> +++ b/drm.c
[...]
> +#include "defs.h"
> +
> +#if defined(HAVE_DRM_H) || defined(HAVE_DRM_DRM_H)
> +
> +#ifdef HAVE_DRM_H
> +#include <drm.h>
> +#else
> +#include <drm/drm.h>
> +#endif
> +
> +#include <sys/param.h>
Let's include <sys/param.h> before drm stuff.
> +#define DRM_MAX_NAME_LEN 128
> +
> +inline int drm_is_priv(const unsigned int num)
> +{
> + return (_IOC_NR(num) >= DRM_COMMAND_BASE &&
> + _IOC_NR(num) < DRM_COMMAND_END);
> +}
This function has to be static, and like other static functions,
it has to be added along with its first user, otherwise the project
won't build with --enable-gcc-Werror.
> +static char *drm_get_driver_name(struct tcb *tcp)
> +{
> + char path[PATH_MAX];
> + char link[PATH_MAX];
> + int ret;
> +
> + if (getfdpath(tcp, tcp->u_arg[0], path, PATH_MAX - 1) < 0)
> + return NULL;
> +
> + snprintf(link, PATH_MAX, "/sys/class/drm/%s/device/driver",
> + basename(path));
if (snprintf(link, sizeof(link), ...) >= sizeof(link))
return NULL;
> +static void drm_free_priv(void *data)
> +{
> + free(data);
> +}
Do we really need a wrapper for free(3)?
> --- a/ioctl.c
> +++ b/ioctl.c
> @@ -248,6 +248,10 @@ ioctl_decode(struct tcb *tcp)
> case 0x22:
> return scsi_ioctl(tcp, code, arg);
> #endif
> +#if defined(HAVE_DRM_H) || defined(HAVE_DRM_DRM_H)
> + case 'd':
> + return drm_ioctl(tcp, code, arg);
> +#endif
> case 'L':
> return loop_ioctl(tcp, code, arg);
> case 'M':
v3 version also patched ioctl_decode_command_number()
to call drm_decode_number().
--
ldv
[-- Attachment #1.2: Type: application/pgp-signature, Size: 181 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-09-08 0:36 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-24 12:42 [PATCH v4 0/5] drm: Add decoding for DRM/KMS and i915 ioctls Patrik Jakobsson
2015-08-24 12:42 ` [PATCH v4 1/5] drm: Add config for detecting libdrm Patrik Jakobsson
2015-08-25 21:09 ` Mike Frysinger
2015-08-24 12:42 ` [PATCH v4 2/5] drm: Add private data field to trace control block Patrik Jakobsson
[not found] ` <1440420170-13337-3-git-send-email-patrik.jakobsson-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-08-25 21:12 ` Mike Frysinger
2015-08-26 13:26 ` Patrik Jakobsson
2015-08-31 12:37 ` Patrik Jakobsson
[not found] ` <20150831123707.GA22376-mbq0NjRWzOqzCX88HRwER2kA0OJWJZs2VpNB7YpNyf8@public.gmane.org>
2015-09-07 16:51 ` [Intel-gfx] " Dmitry V. Levin
2015-09-07 18:23 ` Patrik Jakobsson
[not found] ` <CAMeQTsZWUPtGUkfVdvhu4bzjQOQ-WvqQ=xOQJzNOw+kOZLGExw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-11-24 5:46 ` [Intel-gfx] " Dmitry V. Levin
2015-11-26 13:40 ` Patrik Jakobsson
2016-07-20 14:50 ` [Intel-gfx] " Dmitry V. Levin
2016-07-20 16:11 ` Patrik Jakobsson
2015-08-24 12:42 ` [PATCH v4 3/5] drm: Add dispatcher and driver identification for DRM Patrik Jakobsson
2015-09-08 0:36 ` Dmitry V. Levin [this message]
2015-09-11 10:57 ` Patrik Jakobsson
2015-11-24 5:53 ` Dmitry V. Levin
2015-08-24 12:42 ` [PATCH v4 4/5] drm: Add decoding of i915 ioctls Patrik Jakobsson
2015-09-08 1:18 ` Dmitry V. Levin
2015-09-08 1:30 ` Dmitry V. Levin
2015-09-09 11:52 ` Dmitry V. Levin
2015-09-11 11:31 ` Patrik Jakobsson
2015-09-11 12:04 ` Dmitry V. Levin
2015-08-24 12:42 ` [PATCH v4 5/5] drm: Add decoding of DRM and KMS ioctls Patrik Jakobsson
2015-09-08 22:50 ` Dmitry V. Levin
2015-09-11 11:39 ` Patrik Jakobsson
2015-09-11 12:10 ` Dmitry V. Levin
[not found] ` <20150911121005.GB6177-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
2015-09-11 12:20 ` Patrik Jakobsson
2015-09-11 12:36 ` Dmitry V. Levin
2015-09-07 8:47 ` [PATCH v4 0/5] drm: Add decoding for DRM/KMS and i915 ioctls Gabriel Laskar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150908003624.GA17781@altlinux.org \
--to=ldv@altlinux.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=patrik.jakobsson@linux.intel.com \
--cc=strace-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox