Re: [PATCH] fat: Refactor shortname parsing
On Fri, 2012-08-03 at 17:58 +0200, Jan Engelhardt wrote: > On Friday 2012-08-03 17:06, OGAWA Hirofumi wrote: > >>>+static inline unsigned char fat_tolower(unsigned char c) > >>>+{ > >>>+ return ((c >= 'A') && (c <= 'Z')) ? c+32 : c; > >>>+} > >>>+ > >> > >> The kernel already has a tolower() function, can that not be used? > > > >tolower() is not exactly same, right? e.g. tolower(0xc0). Otherwise, > >tolower() is fine. > > Yes, but you can still > > return (c >= 'A' && c <= 'Z') ? tolower(c) : c; But now it's less efficient because tolower() does an unnecessary lookup to see if it's supposed to change the value. _tolower() wouldn't have that issue, but it's marked "Do not use in your code". Steven J. Magnani "I claim this network for MARS! www.digidescorp.com Earthling, return my space modulator!" #include -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] fat: Refactor shortname parsing
On Friday 2012-08-03 17:06, OGAWA Hirofumi wrote: >>>+static inline unsigned char fat_tolower(unsigned char c) >>>+{ >>>+return ((c >= 'A') && (c <= 'Z')) ? c+32 : c; >>>+} >>>+ >> >> The kernel already has a tolower() function, can that not be used? > >tolower() is not exactly same, right? e.g. tolower(0xc0). Otherwise, >tolower() is fine. Yes, but you can still return (c >= 'A' && c <= 'Z') ? tolower(c) : c; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] fat: Refactor shortname parsing
Jan Engelhardt writes: > On Tuesday 2012-07-03 13:14, Steven J. Magnani wrote: > >>Nearly identical shortname parsing is performed in fat_search_long() >>and __fat_readdir(). Extract this code into a function that may be >>called by both. >> >>v2: Attempt to clarify difference between vfat and msdos parsing. >>Remove decision-making from fat_tolower() for clarity. >> >>Signed-off-by: Steven J. Magnani >>--- >>diff -uprN linux-3.5-rc4/fs/fat/dir.c new/fs/fat/dir.c >>--- linux-3.5-rc4/fs/fat/dir.c2012-06-29 11:20:12.766348728 -0500 >>+++ new/fs/fat/dir.c 2012-07-03 06:10:36.066283411 -0500 >>@@ -35,6 +35,11 @@ >> #define FAT_MAX_UNI_CHARS((MSDOS_SLOTS - 1) * 13 + 1) >> #define FAT_MAX_UNI_SIZE (FAT_MAX_UNI_CHARS * sizeof(wchar_t)) >> >>+static inline unsigned char fat_tolower(unsigned char c) >>+{ >>+ return ((c >= 'A') && (c <= 'Z')) ? c+32 : c; >>+} >>+ > > The kernel already has a tolower() function, can that not be used? tolower() is not exactly same, right? e.g. tolower(0xc0). Otherwise, tolower() is fine. -- OGAWA Hirofumi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] fat: Refactor shortname parsing
On Tuesday 2012-07-03 13:14, Steven J. Magnani wrote: >Nearly identical shortname parsing is performed in fat_search_long() >and __fat_readdir(). Extract this code into a function that may be >called by both. > >v2: Attempt to clarify difference between vfat and msdos parsing. >Remove decision-making from fat_tolower() for clarity. > >Signed-off-by: Steven J. Magnani >--- >diff -uprN linux-3.5-rc4/fs/fat/dir.c new/fs/fat/dir.c >--- linux-3.5-rc4/fs/fat/dir.c 2012-06-29 11:20:12.766348728 -0500 >+++ new/fs/fat/dir.c 2012-07-03 06:10:36.066283411 -0500 >@@ -35,6 +35,11 @@ > #define FAT_MAX_UNI_CHARS ((MSDOS_SLOTS - 1) * 13 + 1) > #define FAT_MAX_UNI_SIZE (FAT_MAX_UNI_CHARS * sizeof(wchar_t)) > >+static inline unsigned char fat_tolower(unsigned char c) >+{ >+ return ((c >= 'A') && (c <= 'Z')) ? c+32 : c; >+} >+ The kernel already has a tolower() function, can that not be used? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/