From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MURuj-0002RJ-K5 for mharc-grub-devel@gnu.org; Fri, 24 Jul 2009 17:02:49 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MURuh-0002Kt-5q for grub-devel@gnu.org; Fri, 24 Jul 2009 17:02:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MURuc-00028J-Fe for grub-devel@gnu.org; Fri, 24 Jul 2009 17:02:46 -0400 Received: from [199.232.76.173] (port=34585 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MURub-00027l-Uo for grub-devel@gnu.org; Fri, 24 Jul 2009 17:02:41 -0400 Received: from mailout01.t-online.de ([194.25.134.80]:49506) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MURub-0007zT-9J for grub-devel@gnu.org; Fri, 24 Jul 2009 17:02:41 -0400 Received: from fwd10.aul.t-online.de by mailout01.t-online.de with smtp id 1MURuX-0001ME-00; Fri, 24 Jul 2009 23:02:37 +0200 Received: from [10.3.2.2] (Gn948iZQrhKGnm2YALlgnTytxE7iNnO6mbeCVNZSo3pbEWFiCH5T1Jpbtjl+xEiQwF@[217.235.231.97]) by fwd10.aul.t-online.de with esmtp id 1MURuK-1jrINU0; Fri, 24 Jul 2009 23:02:24 +0200 Message-ID: <4A6A2165.3070100@t-online.de> Date: Fri, 24 Jul 2009 23:02:29 +0200 From: Christian Franke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090403 SeaMonkey/1.1.16 MIME-Version: 1.0 To: The development of GRUB 2 References: <1248386224.2661.118.camel@mj> In-Reply-To: <1248386224.2661.118.camel@mj> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ID: Gn948iZQrhKGnm2YALlgnTytxE7iNnO6mbeCVNZSo3pbEWFiCH5T1Jpbtjl+xEiQwF X-TOI-MSGID: e16ccd43-f48b-4dd7-9918-b63c54989286 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: [BUGFIX] Don't use DT_DIR: It doesn't work on non-ext* filesystems X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jul 2009 21:02:47 -0000 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