All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Franke <Christian.Franke@t-online.de>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [BUGFIX] Don't use DT_DIR: It doesn't work on non-ext* filesystems
Date: Fri, 24 Jul 2009 23:02:29 +0200	[thread overview]
Message-ID: <4A6A2165.3070100@t-online.de> (raw)
In-Reply-To: <1248386224.2661.118.camel@mj>

Pavel Roskin wrote:
> On Thu, 2009-07-23 at 11:29 +0200, Vladimir 'phcoder' Serbinenko wrote:
>
>   
>> -#ifdef DT_DIR
>> -      info.dir = (de->d_type == DT_DIR);
>> -#else
>>        info.dir = !! is_dir (path, de->d_name);
>> -#endif
>>     
>
> Fine with me.  Finally a patch that reduces the number of preprocessor
> directives :-)
>
>   

:-)

Grub hostfs has no performance requirement like e.g. find. The 
optimization with d_type can simply be ignored - patch is OK.

The idea behind d_type is that it should only be set != DT_UNKNOWN if 
the type info is available for free or at low cost. It is safe for a 
filesystem implementation to return DT_UNKNOWN always.

A correct performance-aware solution would look like:

#ifdef DT_DIR
  if (de->d_type == DT_DIR)
    info.dir = 1;
  else if (de->type == DT_FILE)
    info.dir = 0;
  else
#endif
    info.dir = !! is_dir (path, de->d_name);

This was actually wrong in my original patch (svn 1353) that was 
necessary because of missing d_type on Cygwin - Sorry! Meantime I added 
d_type support to Cygwin itself and therefore learned how this is 
supposed to work :-)

-- 
Regards,
Christian Franke




  reply	other threads:[~2009-07-24 21:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-23  9:29 [BUGFIX] Don't use DT_DIR: It doesn't work on non-ext* filesystems Vladimir 'phcoder' Serbinenko
2009-07-23 21:57 ` Pavel Roskin
2009-07-24 21:02   ` Christian Franke [this message]
2009-07-24 21:49     ` Pavel Roskin
2009-07-24 22:02       ` Christian Franke
2009-07-25 16:23       ` Robert Millan

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=4A6A2165.3070100@t-online.de \
    --to=christian.franke@t-online.de \
    --cc=grub-devel@gnu.org \
    /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.