X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f From: Martin Str|mberg Message-Id: <200201100509.GAA25876@father.ludd.luth.se> Subject: Re: LFN32 optimizations [was: Re: Proposed lstat.c patch for Win2000/XP device bit fix In-Reply-To: <10201100202.AA16147@clio.rice.edu> from Charles Sandmann at "Jan 9, 2002 08:02:37 pm" To: djgpp-workers AT delorie DOT com Date: Thu, 10 Jan 2002 06:09:54 +0100 (MET) X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk According to Charles Sandmann: > Seemingly working example. I would suggest moving _is_ff_LFN() macro to > dir.h and using it in access.c also. > > *** lstat.c_ Tue Dec 11 21:28:06 2001 > --- lstat2.c Wed Jan 9 19:59:22 2002 > *************** int __findfirst(const char *, struct ffb > *** 128,133 **** > --- 128,135 ---- > int __findnext(struct ffblk *); > > #define ALL_FILES (FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_DIREC|FA_ARCH) > + #define _is_ff_LFN(ff_blk) ( *(long *)(&(ff_blk.lfn_magic[0])) == \ > + 'L'+('F'<<8)+('N'<<16)+('3'<<24) && *(short *)(&(ff_blk.lfn_magic[4])) == '2' ) I see now. I swapped the bytes in the short. May I suugest two things: Make the last part "*(short *)(&(ff_blk.lfn_magic[4])) == '2'+(0<<8)" so we check the nul explicitly for the expressiveness. Perhaps this macro should be called "_is_ff_LFN32", in case we would need a _is_ff_LFN macro sometime. Then I wonder why you're looking for LFN32 and not LFN? Is it only on FAT32 this bug exists? Right, MartinS