--- fs/msdos/namei.c | 18 ++++++++++++------ include/linux/msdos_fs.h | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) --- a/fs/msdos/namei.c +++ b/fs/msdos/namei.c @@ -14,7 +14,12 @@ /* Characters that are undesirable in an MS-DOS file name */ static unsigned char bad_chars[] = "*?<>|\""; -static unsigned char bad_if_strict[] = "+=,; "; +static unsigned char bad_if_strict_pc[] = "+=,; "; +/* GEMDOS is less restrictive */ +static unsigned char bad_if_strict_atari[] = " "; + +#define bad_if_strict(opts) \ + ((opts)->atari ? bad_if_strict_atari : bad_if_strict_pc) /***** Formats an MS-DOS file name. Rejects invalid names. */ static int msdos_format_name(const unsigned char *name, int len, @@ -35,20 +40,21 @@ static int msdos_format_name(const unsig /* Get rid of dot - test for it elsewhere */ name++; len--; - } else + } else if (!opts->atari) return -EINVAL; } /* - * disallow names that _really_ start with a dot + * disallow names that _really_ start with a dot for MS-DOS, + * GEMDOS does not care */ - space = 1; + space = !opts->atari; c = 0; for (walk = res; len && walk - res < 8; walk++) { c = *name++; len--; if (opts->name_check != 'r' && strchr(bad_chars, c)) return -EINVAL; - if (opts->name_check == 's' && strchr(bad_if_strict, c)) + if (opts->name_check == 's' && strchr(bad_if_strict(opts), c)) return -EINVAL; if (c >= 'A' && c <= 'Z' && opts->name_check == 's') return -EINVAL; @@ -88,7 +94,7 @@ static int msdos_format_name(const unsig if (opts->name_check != 'r' && strchr(bad_chars, c)) return -EINVAL; if (opts->name_check == 's' && - strchr(bad_if_strict, c)) + strchr(bad_if_strict(opts), c)) return -EINVAL; if (c < ' ' || c == ':' || c == '\\') return -EINVAL; --- a/include/linux/msdos_fs.h +++ b/include/linux/msdos_fs.h @@ -201,6 +201,7 @@ struct fat_mount_options { utf8:1, /* Use of UTF-8 character set (Default) */ unicode_xlate:1, /* create escape sequences for unhandled Unicode */ numtail:1, /* Does first alias have a numeric '~1' type tail? */ + atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */ flush:1, /* write things quickly */ nocase:1, /* Does this need case conversion? 0=need case conversion*/ usefree:1, /* Use free_clusters for FAT32 */