--- fat-epoc/trunk/fat-epoc-2.6.15.diff 2007/08/10 23:15:27 298 +++ fat-epoc/trunk/fat-epoc-2.6.15.diff 2007/11/09 12:29:00 311 @@ -1,72 +1,64 @@ -diff -up -r linux-2.6.15.orig/fs/fat/dir.c linux-2.6.15/fs/fat/dir.c ---- linux-2.6.15.orig/fs/fat/dir.c 2007-08-11 00:52:40.000000000 +0200 -+++ linux-2.6.15/fs/fat/dir.c 2007-08-11 00:48:35.000000000 +0200 -@@ -240,6 +240,7 @@ static int fat_parse_long(struct inode * - { +diff -r -u2 -p linux-2.6.15.vanilla/fs/fat/dir.c linux-2.6.15/fs/fat/dir.c +--- linux-2.6.15.vanilla/fs/fat/dir.c 2007-11-09 12:06:40.000000000 +0100 ++++ linux-2.6.15/fs/fat/dir.c 2007-11-09 13:14:08.000000000 +0100 +@@ -241,4 +241,5 @@ static int fat_parse_long(struct inode * struct msdos_dir_slot *ds; unsigned char id, slot, slots, alias_checksum; + int epoc = MSDOS_SB(dir->i_sb)->options.epoc; if (!*unicode) { - *unicode = (wchar_t *)__get_free_page(GFP_KERNEL); -@@ -286,6 +287,8 @@ parse_long: - } +@@ -287,4 +288,8 @@ parse_long: if ((*de)->name[0] == DELETED_FLAG) return PARSE_INVALID; -+ if (epoc && ((*de)->name[0] == EOD_FLAG)) ++ if (epoc && ((*de)->name[0] == EOD_FLAG)) { ++ while (fat_get_entry(dir, pos, bh, de) >= 0); + return PARSE_EOF; ++ } if ((*de)->attr == ATTR_EXT) goto parse_long; - if (IS_FREE((*de)->name) || ((*de)->attr & ATTR_VOLUME)) -@@ -319,6 +322,7 @@ int fat_search_long(struct inode *inode, - unsigned short opt_shortname = sbi->options.shortname; +@@ -320,4 +325,5 @@ int fat_search_long(struct inode *inode, loff_t cpos = 0; int chl, i, j, last_u, err; + int epoc = sbi->options.epoc; err = -ENOENT; - while(1) { -@@ -328,6 +332,9 @@ parse_record: - nr_slots = 0; +@@ -329,4 +335,8 @@ parse_record: if (de->name[0] == DELETED_FLAG) continue; -+ if (epoc && (de->name[0] == EOD_FLAG)) ++ if (epoc && (de->name[0] == EOD_FLAG)) { ++ while (fat_get_entry(inode, &cpos, &bh, &de) >= 0); + goto EODir; -+ ++ } if (de->attr != ATTR_EXT && (de->attr & ATTR_VOLUME)) continue; - if (de->attr != ATTR_EXT && IS_FREE(de->name)) -@@ -455,6 +462,8 @@ static int __fat_readdir(struct inode *i - int chi, chl, i, i2, j, last, last_u, dotoffset = 0; +@@ -456,4 +466,6 @@ static int __fat_readdir(struct inode *i loff_t cpos; int ret = 0; + int epoc = MSDOS_SB(sb)->options.epoc; + lock_kernel(); - -@@ -485,6 +494,8 @@ GetNew: - parse_record: +@@ -486,4 +498,8 @@ parse_record: long_slots = 0; /* Check for long filename entry */ -+ if (epoc && (de->name[0] == EOD_FLAG)) ++ if (epoc && (de->name[0] == EOD_FLAG)) { ++ while (fat_get_entry(inode, &cpos, &bh, &de) >= 0); + goto EODir; ++ } if (isvfat) { if (de->name[0] == DELETED_FLAG) - goto RecEnd; -@@ -752,7 +763,10 @@ static int fat_get_short_entry(struct in - struct buffer_head **bh, +@@ -753,5 +769,10 @@ static int fat_get_short_entry(struct in struct msdos_dir_entry **de) { + int epoc = MSDOS_SB(dir->i_sb)->options.epoc; while (fat_get_entry(dir, pos, bh, de) >= 0) { -+ if (epoc && ((*de)->name[0] == EOD_FLAG)) ++ if (epoc && ((*de)->name[0] == EOD_FLAG)) { ++ while (fat_get_entry(dir, pos, bh, de) >= 0); + return -ENOENT; ++ } /* free entry or long name entry or volume label */ if (!IS_FREE((*de)->name) && !((*de)->attr & ATTR_VOLUME)) - return 0; -@@ -1130,6 +1144,25 @@ error: - return err; +@@ -1131,4 +1152,23 @@ error: } +int fat_write_zero_entry(struct inode *dir, loff_t curr) @@ -90,18 +82,14 @@ + int fat_add_entries(struct inode *dir, void *slots, int nr_slots, struct fat_slot_info *sinfo) - { -@@ -1139,6 +1172,8 @@ int fat_add_entries(struct inode *dir, v - struct msdos_dir_entry *de; +@@ -1140,4 +1180,6 @@ int fat_add_entries(struct inode *dir, v int err, free_slots, i, nr_bhs; loff_t pos, i_pos; + int epoc = sbi->options.epoc; + int last_entry = 0; sinfo->nr_slots = nr_slots; - -@@ -1152,7 +1187,9 @@ int fat_add_entries(struct inode *dir, v - if (pos >= FAT_MAX_DIR_SIZE) +@@ -1153,5 +1195,7 @@ int fat_add_entries(struct inode *dir, v goto error; - if (IS_FREE(de->name)) { @@ -110,9 +98,7 @@ + if (last_entry || IS_FREE(de->name)) { if (prev != bh) { get_bh(bh); - bhs[nr_bhs] = prev = bh; -@@ -1182,6 +1219,17 @@ found: - err = 0; +@@ -1183,4 +1227,15 @@ found: pos -= free_slots * sizeof(*de); nr_slots -= free_slots; + @@ -128,56 +114,49 @@ + if (free_slots) { /* - * Second stage: filling the free entries with new entries. -diff -up -r linux-2.6.15.orig/fs/fat/inode.c linux-2.6.15/fs/fat/inode.c ---- linux-2.6.15.orig/fs/fat/inode.c 2007-08-11 00:52:40.000000000 +0200 -+++ linux-2.6.15/fs/fat/inode.c 2007-08-11 00:49:24.000000000 +0200 -@@ -775,6 +775,7 @@ enum { - Opt_charset, Opt_shortname_lower, Opt_shortname_win95, - Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes, +diff -r -u2 -p linux-2.6.15.vanilla/fs/fat/inode.c linux-2.6.15/fs/fat/inode.c +--- linux-2.6.15.vanilla/fs/fat/inode.c 2007-11-09 12:06:40.000000000 +0100 ++++ linux-2.6.15/fs/fat/inode.c 2007-11-09 13:17:33.000000000 +0100 +@@ -777,4 +777,5 @@ enum { Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes, -+ Opt_epoc, Opt_obsolate, Opt_err, ++ Opt_epoc, }; -@@ -796,6 +797,7 @@ static match_table_t fat_tokens = { - {Opt_showexec, "showexec"}, +@@ -797,4 +798,5 @@ static match_table_t fat_tokens = { {Opt_debug, "debug"}, {Opt_immutable, "sys_immutable"}, + {Opt_epoc, "epoc"}, {Opt_obsolate, "conv=binary"}, {Opt_obsolate, "conv=text"}, - {Opt_obsolate, "conv=auto"}, -@@ -948,6 +950,10 @@ static int parse_options(char *options, - return 0; +@@ -949,4 +951,7 @@ static int parse_options(char *options, opts->codepage = option; break; + case Opt_epoc: + opts->epoc = 1; + break; -+ /* msdos specific */ - case Opt_dots: -diff -up -r linux-2.6.15.orig/include/linux/msdos_fs.h linux-2.6.15/include/linux/msdos_fs.h ---- linux-2.6.15.orig/include/linux/msdos_fs.h 2007-08-11 00:52:45.000000000 +0200 -+++ linux-2.6.15/include/linux/msdos_fs.h 2007-08-11 00:49:24.000000000 +0200 -@@ -44,6 +44,7 @@ - #define CASE_LOWER_EXT 16 /* extension is lower case */ +@@ -1002,4 +1007,5 @@ static int parse_options(char *options, + break; + ++ + /* obsolete mount options */ + case Opt_obsolate: +diff -r -u2 -p linux-2.6.15.vanilla/include/linux/msdos_fs.h linux-2.6.15/include/linux/msdos_fs.h +--- linux-2.6.15.vanilla/include/linux/msdos_fs.h 2007-11-09 12:06:42.000000000 +0100 ++++ linux-2.6.15/include/linux/msdos_fs.h 2007-11-09 13:14:08.000000000 +0100 +@@ -45,4 +45,5 @@ #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */ +#define EOD_FLAG 0x00 /* marks end of directory when in name[0] for old fats */ #define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG) - /* valid file mode bits */ -@@ -203,7 +204,9 @@ struct fat_mount_options { - unicode_xlate:1, /* create escape sequences for unhandled Unicode */ +@@ -204,5 +205,6 @@ struct fat_mount_options { numtail:1, /* Does first alias have a numeric '~1' type tail? */ atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */ - nocase:1; /* Does this need case conversion? 0=need case conversion*/ + nocase:1, /* Does this need case conversion? 0=need case conversion*/ -+ epoc:1; /* Filename starting with 0x00 marks end of dir? */ -+ ++ epoc:1; /* Filename starting with 0x00 marks end of dir? */ }; - #define FAT_HASH_BITS 8