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
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel