All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Velikov <emil.l.velikov@gmail.com>
To: Jan Vesely <jan.vesely@rutgers.edu>
Cc: emil.l.velikov@gmail.com, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH libdrm 1/9] tests/dristat: don't include C files
Date: Thu, 26 Mar 2015 14:59:27 +0000	[thread overview]
Message-ID: <55141ECF.3040704@gmail.com> (raw)
In-Reply-To: <1427148626.3547.28.camel@rutgers.edu>

On 23/03/15 22:10, Jan Vesely wrote:
> On Sun, 2015-03-22 at 22:03 +0000, Emil Velikov wrote:
>> Remove the hack of including C files, by reworking the only requirement
>> drmOpenMinor() to an open(buf...). After all we do know the exact name
>> of the device we're going to open, so might as well use it. Replace
>> hard-coded 16 with DRM_MAX_MINOR while we're here.
>>
>> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
>> ---
>>  tests/dristat.c | 11 ++++++-----
>>  1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/tests/dristat.c b/tests/dristat.c
>> index cca4b03..cc23e16 100644
>> --- a/tests/dristat.c
>> +++ b/tests/dristat.c
>> @@ -31,13 +31,14 @@
>>  # include <config.h>
>>  #endif
>>  
>> +#include <ctype.h>
>> +#include <fcntl.h>
>>  #include <stdio.h>
>>  #include <stdlib.h>
>> +#include <string.h>
>> +#include <sys/stat.h>
>>  #include <unistd.h>
>>  #include "xf86drm.h"
>> -#include "xf86drmRandom.c"
>> -#include "xf86drmHash.c"
>> -#include "xf86drm.c"
>>  
>>  #define DRM_VERSION 0x00000001
>>  #define DRM_MEMORY  0x00000002
>> @@ -267,9 +268,9 @@ int main(int argc, char **argv)
>>  	    return 1;
>>  	}
>>  
>> -    for (i = 0; i < 16; i++) if (!minor || i == minor) {
>> +    for (i = 0; i < DRM_MAX_MINOR; i++) if (!minor || i == minor) {
>>  	sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, i);
>> -	fd = drmOpenMinor(i, 1, DRM_NODE_PRIMARY);
>> +	fd = open(buf, O_RDWR, 0);
> 
> What about the "create" (second) argument? The original code creates the
> node if it does not exist (on non-UDEV systems), or waits some time for
> udev to create it.
> Not sure how this is relevant for the test.
> 
Hmm brain triggered this as "create = 0", as I was going through. Fwiw I
would opt for nuking this custom hack, and stick with open().

If one needs to wait for udev or manually create the nod then they have
bigger ship to fry. All of that should be resolved before anyone has the
change to run the program.

Let's give it some time for people to voice their opinions on the topic.
Could be that something more elaborate is happing if create is set.


-Emil

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2015-03-26 14:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-22 22:03 [PATCH libdrm 0/9] Rework remaining tests Emil Velikov
2015-03-22 22:03 ` [PATCH libdrm 1/9] tests/dristat: don't include C files Emil Velikov
2015-03-23 22:10   ` Jan Vesely
2015-03-26 14:59     ` Emil Velikov [this message]
2015-03-22 22:03 ` [PATCH libdrm 2/9] tests/hash: extract test out of xf86drmHash.c Emil Velikov
2015-03-23 22:27   ` Jan Vesely
2015-03-22 22:03 ` [PATCH libdrm 3/9] tests/hash: misc compilation fixes Emil Velikov
2015-03-23 22:42   ` Jan Vesely
2015-03-22 22:03 ` [PATCH libdrm 4/9] tests/hash: style fixes Emil Velikov
2015-03-23 22:46   ` Jan Vesely
2015-03-22 22:03 ` [PATCH libdrm 5/9] tests/hash: return non-zero on failure Emil Velikov
2015-03-23 23:08   ` Jan Vesely
2015-03-22 22:03 ` [PATCH libdrm 6/9] tests/random: extract test out of xf86drmRandom.c Emil Velikov
2015-03-24 22:10   ` Jan Vesely
2015-03-22 22:03 ` [PATCH libdrm 7/9] tests/random: return non-zero on test failure Emil Velikov
2015-03-24 22:12   ` Jan Vesely
2015-03-22 22:03 ` [PATCH libdrm 8/9] drm: replace HASH_DEBUG with DEBUG Emil Velikov
2015-03-24  0:01   ` Jan Vesely
2015-03-22 22:03 ` [PATCH libdrm 9/9] drm: use correct printf modifiers Emil Velikov
2015-03-24  0:04   ` Jan Vesely
2015-03-24 23:20 ` [PATCH libdrm 0/9] Rework remaining tests Jan Vesely
2015-03-26 15:14   ` Emil Velikov

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=55141ECF.3040704@gmail.com \
    --to=emil.l.velikov@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jan.vesely@rutgers.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.