Re: [PATCH 3/13] FAT: IS_BADCHAR/IS_REPLACECHR/IS_SKIPCHAR cleanup

From: OGAWA Hirofumi
Date: Mon Jan 17 2005 - 20:08:45 EST


Al Viro <viro@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:

> Ugh... What's wrong with comparison to '*', '<', etc.? All values are
> below 0x80, so signedness of char doesn't matter and when they get
> promoted to int, they will give you the values you want...

Indeed. Thanks.

Please apply the following incremental patch.
--
OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>



[PATCH 14] FAT: Further IS_BADCHAR/IS_REPLACECHR/IS_SKIPCHAR cleanup

Signed-off-by: OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
---

fs/vfat/namei.c | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)

diff -puN fs/vfat/namei.c~fat_check-chars-cleanup2 fs/vfat/namei.c
--- linux-2.6.11-rc1/fs/vfat/namei.c~fat_check-chars-cleanup2 2005-01-18 09:50:45.000000000 +0900
+++ linux-2.6.11-rc1-hirofumi/fs/vfat/namei.c 2005-01-18 09:56:08.000000000 +0900
@@ -153,23 +153,20 @@ static struct dentry_operations vfat_den
static inline wchar_t vfat_bad_char(wchar_t w)
{
return (w < 0x0020)
- || (w == 0x002A) /* * */ || (w == 0x003F) /* ? */
- || (w == 0x003C) /* < */ || (w == 0x003E) /* > */
- || (w == 0x007C) /* | */ || (w == 0x0022) /* " */
- || (w == 0x003A) /* : */ || (w == 0x002F) /* / */
- || (w == 0x005C);/* \ */
+ || (w == '*') || (w == '?') || (w == '<') || (w == '>')
+ || (w == '|') || (w == '"') || (w == ':') || (w == '/')
+ || (w == '\\');
}

static inline wchar_t vfat_replace_char(wchar_t w)
{
- return (w == 0x005B) /* [ */ || (w == 0x005D) /* ] */
- || (w == 0x003B) /* ; */ || (w == 0x002C) /* , */
- || (w == 0x002B) /* + */ || (w == 0x003D);/* = */
+ return (w == '[') || (w == ']') || (w == ';') || (w == ',')
+ || (w == '+') || (w == '=');
}

static wchar_t vfat_skip_char(wchar_t w)
{
- return (w == 0x002E) /* . */ || (w == 0x0020);/* <space> */
+ return (w == '.') || (w == ' ');
}

static inline int vfat_is_used_badchars(const wchar_t *s, int len)
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/