MS-DOS FS, ALPHA test version 11 ================================ ***** This is an ALPHA test version. It might contain bugs that ***** ***** will make an MS-DOS FS unusable. Use it only on copies of ***** ***** your disks. Never work on original data with it ! ***** FILES ===== README This file. CHANGES Change history. Makefile Makefile for fromdos and rename. dosfs.patch Patch from alpha.8 to alpha.11 dosfs.tar MS-DOS FS for the 0.99pl7 kernel. fromdos.c CRLF->NL / NL->CRLF converter. test.pl Regression test script in Perl. rename.c Interface to the rename system call. Used by test.pl smount.c Very simple mount program. fsperf.c File system performance test. INSTALLATION ============ This update of the MS-DOS FS can only be added to a 0.99pl7 kernel. You can either overwrite the old sources by extracting dosfs.tar or patch the sources from dosfs.patch. Patching is preferred, but many people find it more convenient to replace the sources from a TAR archive. Kernel versions later than 0.99pl7 may or may not work with this source/patch. Please use 0.10 for 0.99pl6 kernels. Step 1: Kernel Update the kernel sources if needed and delete all old *.o files that may be in fs/msdos. Then run make and boot the resulting image. Step 2: Basic utilities Run make to compile smount.c, fromdos.c, fsperf.c. Move the resulting executables to an appropriate place and create a link from 'todos' to 'fromdos'. Now you're ready to use the MS-DOS FS. If you have Perl, you should run the regression test now. (See below.) MOUNTING ======== An MS-DOS FS is mounted by specifying the FS type "msdos" with the -t option: mount -t msdos /dev/whatever /wherever The following mount options are recognized: conv=binary|text|auto (default is "binary") check=relaxed|normal|strict (default is "normal") uid= (default is current euid) gid= (default is current egid) umask= (default is current umask) debug (default is off) fat= (default is auto-detection) The MS-DOS FS can perform CRLF<-->NL (MS-DOS text format to UNIX text format) conversion in the kernel. The following conversion modes are available: binary no translation is performed. text CRLF<-->NL translation is performed on all files. auto CRLF<-->NL translation is performed on all files that don't have a "well-known binary" extension. The list of known extensions can be found at the beginning of fs/msdos/misc.c The conversion mode is chosen with the conv= mount option, e.g. mount -t msdos -o conv=auto ... Programs that do computed lseeks won't like in-kernel text conversion. For FS' mounted in binary mode, a conversion tool (fromdos/todos) is provided. The kernel displays format information at mount time. Please include a verbatim copy of those numbers in your bug report if the FS should refuse to mount a valid MS-DOS disk. When translating a name to MS-DOS conventions, three different levels of pickyness can be chosen: relaxed Upper and lower case are accepted and equivalent, long name parts are truncated (e.g. verlongname.foobar becomes verylong.foo), leading and embedded spaces are accepted in each name part (name and extension). normal Like "relaxed", but many special characters (*, ?, <, spaces, etc.) are rejected. strict Like "normal", but names may not contain long parts and special characters that are sometimes used on Linux, but are not accepted by MS-DOS are rejected. (+, =, spaces, etc.) The check is chosen by specifying the check= mount option, e.g. mount -t msdos -o check=strict ... Default is "normal". The options uid=..., gid=... and umask=... determine the ownership and permissions of files. All files are implicitly chowned to the specified uid/gid and the bits in umask are removed from file permissions before they become visible to user programs. The root of the value of umask defaults to octal. The fat option overrides the automatic FAT type detection. Only the values 12 and 16 are accepted. The MS-DOS FS prints a version string and a list of file system para- meters if the option debug is set or if the parameters appear to be inconsistent. If the MS-DOS FS detects an inconsistency, it reports an error and sets the file system read-only. The file system can be made writeable again by remounting it, e.g. mount -o remount,rw /dev/foo /bar If the MS-DOS FS and your mount program don't agree on mount option processing, smount should be used in order to pass mount options. It's a very simple interface to the mount system call, that doesn't know about /etc/fstab and doesn't update /etc/mtab. REGRESSION TEST =============== A regression test script is included that can be used to verify basic file system operation. It currently only analyzes the static behaviour of the FS. No attempt is made to detect race conditions. To perform the regression test, do the following: Step 1: rename utility Because at least some versions of Perl on Linux implement rename by using link and unlink, a separate C program is used as an interface to the rename system call. Run make rename to build it. The rename executable must be in the directory from which test.pl is started. Step 2: Test location Insert an empty MS-DOS floppy disk into /dev/fd0 or /dev/fd1. If you don't have an empty MS-DOS floppy, you can create one with fdformat and mformat. Mount the floppy as MS-DOS FS, e.g. mount -t msdos /dev/fd0 /fd Step 3: Running the script Run test.pl with the mount point and the name check mode as arguments, e.g. ./test.pl /fd normal The regression test only works on an MS-DOS FS, because it tests special behaviour of that FS type. Step 4: Checking what's left The test should not leave any directories or files on the test disk. The number of free blocks that is reported by df should also be the same as before the test. Finally, you should be able to umount the MS-DOS disk. If any of the above fails, please don't hesitate to report it to almesber@bernina.ethz.ch Contribution of new tests that verify yet untested parts of the code or tests that exhibit bugs will be thankfully accepted. ACCESS PERMISSIONS ================== All files in an MS-DOS FS are owned by the real uid/real gid that are in effect for the mount system call. File modes are 0777 (0666 if the file system is mounted noexec) minus the current umask at mount time. Read-only and hidden attributes are translated into appropriate mode settings. If file modes are changed, an attempt is made to find sensible attributes based on the mode bits of the owner. FROMDOS/TODOS ============= fromdos removes all CRs from a file and truncates it at the first ^Z. todos converts NLs to CRLFs. Both tools are either invoked as filters, e.g. fromdos