diff -upr linux-3.0.0.orig/fs/fat/fat.h linux-3.0.0/fs/fat/fat.h --- linux-3.0.0.orig/fs/fat/fat.h 2011-07-22 05:17:23.000000000 +0300 +++ linux-3.0.0/fs/fat/fat.h 2012-04-09 09:23:12.706414716 +0300 @@ -47,6 +47,7 @@ struct fat_mount_options { tz_utc:1, /* Filesystem timestamps are in UTC */ rodir:1, /* allow ATTR_RO for directory */ discard:1; /* Issue discard requests on deletions */ + char *exe_extensions; /* List of extensions that are given executable flag when mounted with showexec */ }; #define FAT_HASH_BITS 8 diff -upr linux-3.0.0.orig/fs/fat/inode.c linux-3.0.0/fs/fat/inode.c --- linux-3.0.0.orig/fs/fat/inode.c 2011-07-22 05:17:23.000000000 +0300 +++ linux-3.0.0/fs/fat/inode.c 2012-04-09 21:08:02.605461703 +0300 @@ -36,7 +36,7 @@ static int fat_default_codepage = CONFIG_FAT_DEFAULT_CODEPAGE; static char fat_default_iocharset[] = CONFIG_FAT_DEFAULT_IOCHARSET; - +static char fat_default_exe_extensions[] = "EXECOMBAT"; static int fat_add_cluster(struct inode *inode) { @@ -324,9 +324,9 @@ struct inode *fat_iget(struct super_bloc return inode; } -static int is_exec(unsigned char *extension) +static int is_exec(unsigned char *extension, unsigned char *exe_extensions) { - unsigned char *exe_extensions = "EXECOMBAT", *walk; + unsigned char *walk; for (walk = exe_extensions; *walk; walk += 3) if (!strncmp(extension, walk, 3)) @@ -383,7 +383,7 @@ static int fat_fill_inode(struct inode * } else { /* not a directory */ inode->i_generation |= 1; inode->i_mode = fat_make_mode(sbi, de->attr, - ((sbi->options.showexec && !is_exec(de->name + 8)) + ((sbi->options.showexec && !is_exec(de->name + 8, sbi->options.exe_extensions)) ? S_IRUGO|S_IWUGO : S_IRWXUGO)); MSDOS_I(inode)->i_start = le16_to_cpu(de->start); if (sbi->fat_bits == 32) @@ -497,6 +497,9 @@ static void fat_put_super(struct super_b if (sbi->options.iocharset != fat_default_iocharset) kfree(sbi->options.iocharset); + + if (sbi->options.exe_extensions != fat_default_exe_extensions) + kfree(sbi->options.exe_extensions); sb->s_fs_info = NULL; kfree(sbi); @@ -855,6 +858,7 @@ static int fat_show_options(struct seq_f seq_puts(m, ",quiet"); if (opts->showexec) seq_puts(m, ",showexec"); + seq_printf(m, ",exe_extensions=%s", opts->exe_extensions); if (opts->sys_immutable) seq_puts(m, ",sys_immutable"); if (!isvfat) { @@ -897,7 +901,7 @@ enum { Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes, Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes, Opt_obsolate, Opt_flush, Opt_tz_utc, Opt_rodir, Opt_err_cont, - Opt_err_panic, Opt_err_ro, Opt_discard, Opt_err, + Opt_err_panic, Opt_err_ro, Opt_discard, Opt_err, Opt_exe_extensions }; static const match_table_t fat_tokens = { @@ -918,6 +922,7 @@ static const match_table_t fat_tokens = {Opt_nocase, "nocase"}, {Opt_quiet, "quiet"}, {Opt_showexec, "showexec"}, + {Opt_exe_extensions, "exe_extensions=%s"}, {Opt_debug, "debug"}, {Opt_immutable, "sys_immutable"}, {Opt_flush, "flush"}, @@ -983,7 +988,7 @@ static int parse_options(struct super_bl char *p; substring_t args[MAX_OPT_ARGS]; int option; - char *iocharset; + char *iocharset, *exe_extensions; opts->isvfat = is_vfat; @@ -993,6 +998,7 @@ static int parse_options(struct super_bl opts->allow_utime = -1; opts->codepage = fat_default_codepage; opts->iocharset = fat_default_iocharset; + opts->exe_extensions = fat_default_exe_extensions; if (is_vfat) { opts->shortname = VFAT_SFN_DISPLAY_WINNT|VFAT_SFN_CREATE_WIN95; opts->rodir = 0; @@ -1052,6 +1058,14 @@ static int parse_options(struct super_bl case Opt_showexec: opts->showexec = 1; break; + case Opt_exe_extensions: + if (opts->exe_extensions != fat_default_exe_extensions) + kfree(opts->exe_extensions); + exe_extensions = match_strdup(&args[0]); + if (!exe_extensions) + return -ENOMEM; + opts->exe_extensions = exe_extensions; + break; case Opt_debug: *debug = 1; break;