Date: Mon, 12 Jul 1999 11:49:41 +0100 (GMT) From: Riley Williams <rhw@MemAlpha.CX> To: Linux Kernel <linux-kernel@vger.rutgers.edu> Subject: 2.3.10 - Patch for FAT filesystem Hi there. Yes, I'm well aware that there were some changes in the 2.3 kernels that broke (amongst others) the FAT filesystems. One of the complaints on this list has been that FAT will not be fixed because of the 'conv=text' and 'conv=auto' modes that mangle binary files read from suchlike partitions. However, I note that the meaning of the 'conv=auto' mode has been inverted such that a file is now interpreted as BINARY by default, and is only interpreted as TEXT if it has one of a range of specified extensions, and this deals with the bulk of that complaint. I would first like to submit the followinng patch, which removes some confusion regarding exactly how the 'conv=auto' option works. At least, it does for me - it took me several passes before I noticed that return tucked on the end of the if line rather than folded down like it is elsewhere. Note that the inclusion or otherwise of this patch does NOT affect the patch enclosed later in this missive, but this patch will only apply cleanly if it is applied BEFORE the following one is, as the latter patch causes this one to have the wrong insertion point. ===8<=== CUT ===>8=== --- linux-2.3.10/fs/fat/misc.c~ Fri May 14 07:18:20 1999 +++ linux-2.3.10/fs/fat/misc.c Sun Jul 11 23:28:12 1999 @@ -66,7 +66,8 @@ return 0; case 'a': for (walk = ascii_extensions; *walk; walk += 3) - if (!strncmp(extension,walk,3)) return 0; + if (!strncmp(extension,walk,3)) + return 0; return 1; /* default binary conversion */ default: printk("Invalid conversion mode - defaulting to " ===8<=== CUT ===>8=== Second, the following patch simply extends the list of extensions that will be interpreted as being text files, and explains what each one is. I have also taken the liberty of sorting the members of each category into ASCII order. Note that the "Textual image formats" listed herein are those declared as being such in the magic file for the `file` command. I don't have any images in any of those formats to check that claim against, but I also don't have any reason to believe such is false. ===8<=== CUT ===>8=== --- linux-2.3.10/fs/fat/misc.c~ Fri May 14 07:18:20 1999 +++ linux-2.3.10/fs/fat/misc.c Sun Jul 11 23:28:12 1999 @@ -21,16 +21,43 @@ #endif #define Printk(x) printk x -/* Well-known binary file extensions - of course there are many more */ +/* Well-known ASCII file extensions - of course there are many more */ static char ascii_extensions[] = - "TXT" "ME " "HTM" "1ST" "LOG" " " /* text files */ - "C " "H " "CPP" "LIS" "PAS" "FOR" /* programming languages */ - "F " "MAK" "INC" "BAS" /* programming languages */ - "BAT" "SH " /* program code :) */ - "INI" /* config files */ - "PBM" "PGM" "DXF" /* graphics */ - "TEX"; /* TeX */ + " " "1ST" "ASC" "INF" /* generic text files */ + "LOG" "ME " "TXT" /* generic text files */ + + "7PL" /* 7+ encoded files (Ham Radio) */ + "UU " "UUE" /* UUencoded files */ + + "FAQ" "HTI" "HTM" "SGM" /* web documents */ + + "DIF" "INC" "LIS" "LST" "MAK" "MAP" /* Compiler-related textfiles */ + + "ASM" "S " /* Assembler source code */ + "BAS" /* BASIC programming language */ + "C " "CPP" "H " /* C & C++ programming languages */ + "CBL" "COB" /* COBOL programming language */ + "FOR" /* FORTRAN programming language */ + "4TH" /* FORTH programming language */ + "PAS" /* PASCAL programming language */ + "PLG" /* PROLOG programming language */ + + "BAT" /* MS-DOS batch files */ + "DOS" /* Win9x DOS-mode batch files */ + + "SH " /* bash/sh scripting language */ + "CSH" /* csh/tcsh scripting language */ + "KSH" /* ksh scripting language */ + "TCL" "TK " /* TCL/TK scripting language */ + + "DXF" "FIG" "PBM" "PGM" "PPM" /* textual graphics formats */ + + "PS " /* Postscript print-to-file */ + + "CFG" "INI" /* configuration files */ + "LSM" /* Linux Software Map */ + "LTX" "TEX"; /* LaTeX or TeX */ /* ===8<=== CUT ===>8=== I am well aware that these patches on their own will not fix the FAT filesystem, but I'm willing to have a go at fixing that since I have good use for it, at least in its VFAT incarnation... Best wishes from Riley. +----------------------------------------------------------------------+ | There is something frustrating about the quality and speed of Linux | | development, ie., the quality is too high and the speed is too high, | | in other words, I can implement this XXXX feature, but I bet someone | | else has already done so and is just about to release their patch. | +----------------------------------------------------------------------+ * ftp://ftp.MemAlpha.cx/pub/rhw/Linux * http://www.MemAlpha.cx/kernel.versions.html - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/