aboutsummaryrefslogtreecommitdiffstats
path: root/debian/patches/bugfix/m68k/134-atari-fat.diff
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/bugfix/m68k/134-atari-fat.diff')
-rw-r--r--debian/patches/bugfix/m68k/134-atari-fat.diff102
1 files changed, 102 insertions, 0 deletions
diff --git a/debian/patches/bugfix/m68k/134-atari-fat.diff b/debian/patches/bugfix/m68k/134-atari-fat.diff
new file mode 100644
index 000000000000..5ce087b90d85
--- /dev/null
+++ b/debian/patches/bugfix/m68k/134-atari-fat.diff
@@ -0,0 +1,102 @@
+To: linus, alan
+Cc: lkml
+Subject: [PATCH] Atari FAT updates
+
+From: Linux/m68k legacy
+
+Add support for the Atari-variant of the FAT filesystem
+
+---
+ fs/fat/inode.c | 46 +++++++++++++++++++++++++++++++++++++++++++---
+ 1 file changed, 43 insertions(+), 3 deletions(-)
+
+--- linux-m68k-2.6.21.orig/fs/fat/inode.c
++++ linux-m68k-2.6.21/fs/fat/inode.c
+@@ -17,6 +17,7 @@
+ #include <linux/smp_lock.h>
+ #include <linux/seq_file.h>
+ #include <linux/msdos_fs.h>
++#include <linux/major.h>
+ #include <linux/pagemap.h>
+ #include <linux/mpage.h>
+ #include <linux/buffer_head.h>
+@@ -852,7 +853,7 @@ enum {
+ Opt_check_n, Opt_check_r, Opt_check_s, Opt_uid, Opt_gid,
+ Opt_umask, Opt_dmask, Opt_fmask, Opt_codepage, Opt_nocase,
+ Opt_quiet, Opt_showexec, Opt_debug, Opt_immutable,
+- Opt_dots, Opt_nodots,
++ Opt_dots, Opt_nodots, Opt_atari_no, Opt_atari_yes,
+ Opt_charset, Opt_shortname_lower, Opt_shortname_win95,
+ 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,
+@@ -877,6 +878,9 @@ static match_table_t fat_tokens = {
+ {Opt_showexec, "showexec"},
+ {Opt_debug, "debug"},
+ {Opt_immutable, "sys_immutable"},
++ {Opt_atari_yes, "atari=yes"},
++ {Opt_atari_yes, "atari"},
++ {Opt_atari_no, "atari=no"},
+ {Opt_obsolate, "conv=binary"},
+ {Opt_obsolate, "conv=text"},
+ {Opt_obsolate, "conv=auto"},
+@@ -952,6 +956,13 @@ static int parse_options(char *options,
+ opts->utf8 = opts->unicode_xlate = 0;
+ opts->numtail = 1;
+ opts->nocase = 0;
++ opts->atari = 0;
++
++#ifdef CONFIG_ATARI
++ if(MACH_IS_ATARI)
++ /* make Atari GEMDOS format the default if machine is an Atari */
++ opts->atari = 1;
++#endif
+ *debug = 0;
+
+ if (!options)
+@@ -1000,6 +1011,12 @@ static int parse_options(char *options,
+ case Opt_immutable:
+ opts->sys_immutable = 1;
+ break;
++ case Opt_atari_yes:
++ opts->atari = 1;
++ break;
++ case Opt_atari_no:
++ opts->atari = 0;
++ break;
+ case Opt_uid:
+ if (match_int(&args[0], &option))
+ return 0;
+@@ -1336,8 +1353,31 @@ int fat_fill_super(struct super_block *s
+
+ total_clusters = (total_sectors - sbi->data_start) / sbi->sec_per_clus;
+
+- if (sbi->fat_bits != 32)
+- sbi->fat_bits = (total_clusters > MAX_FAT12) ? 16 : 12;
++ if (!sbi->options.atari) {
++ if (sbi->fat_bits != 32)
++ sbi->fat_bits = (total_clusters > MAX_FAT12) ? 16 : 12;
++ } else {
++ int sectors;
++ /* Atari GEMDOS partitions always have 16-bit fat */
++ if (sbi->fat_bits != 32)
++ sbi->fat_bits = 16;
++ /* If more clusters than fat entries in 16-bit fat, we assume
++ * it's a real MSDOS partition with 12-bit fat.
++ */
++ if (sbi->fat_bits != 32 && total_clusters+2 > sbi->
++ fat_length*SECTOR_SIZE*8/sbi->fat_bits)
++ sbi->fat_bits = 12;
++ /* if it's a floppy disk --> 12bit fat */
++ if (sbi->fat_bits != 32 && MAJOR(sb->s_dev) == FLOPPY_MAJOR)
++ sbi->fat_bits = 12;
++ /* if it's a ramdisk or loopback device and has one of the usual
++ * floppy sizes -> 12bit FAT */
++ sectors = total_sectors + sbi->data_start;
++ if (sbi->fat_bits != 32 && (MAJOR(sb->s_dev) == RAMDISK_MAJOR ||
++ MAJOR(sb->s_dev) == LOOP_MAJOR) &&
++ (sectors == 720 || sectors == 1440 || sectors == 2880))
++ sbi->fat_bits = 12;
++ }
+
+ /* check that FAT table does not overflow */
+ fat_clusters = sbi->fat_length * sb->s_blocksize * 8 / sbi->fat_bits;