*----------------* * MountX Project * *----------------* Version: 1.0a1 Authors: Benjamin Herrenschmidt (bh40@calva.net) If you plan to MODIFY or use the SOURCE CODE of MountX, please read the "ReadMe Dev" file. Note also that some portions of this doc may not be up-to-date... ·· WARNING !!! ·· This is alpha quality software and is distributed for testing purposes only. It might crash your machine and play other kind of bad tricks but it shouldn't, or at least didn't to me at the time I released this version ;-) Note that this version also contains a lot of debugging code and was absolutely not optimised for performances. This will, of course, change in the future. The source code of a MacOS compilable version of the ext2 library is available on, my web-page. (CodeWarrior Pro 4) http://calvaweb.calvacom.fr/bh40 This version was NOT tested against anything but & little endian LinuxPPC R4 & MkLinux DR3 file systems built from Apple's RedHat 5 installer. So be careful. I hope it will also work with old big endian ones since I think that the new e2fslib handles both correctly, don't it ? Note also that I've not tested the new mkfs very much. (you can play with it with floppies or image files). I still do have to convert apple's bad block list into ext2 badblocks... What is MountX ? ---------------- MountX allows your macintosh to mount MkLinux & linux-pmac ext2fs volumes on the MacOS desktop. It does it's magic by implementing an external file system following Apple's File System Manager API. The File System Manager is always available with system 7.5 and later. Since version 1.0d10, MountX checks for MacOS 8 and uses it to manage automatically the Desktop Database. That means that I didn't implement this support myself and I don't plan to do so. This also means that MountX has and will probably still have for some time some serious limitations with MacOS < 8.0 MountX uses the e2fsprogs, which is distributed under the GNU General Public Licence. I am currently using version 1.14. It should work with both Little and Big endian file systems. SCSI disks notes & "Ext2" Gestalt selector: ------------------------------------------- Current version of MountX only provides a File System. There is no specific disk driver so MountX can only mount volumes for which a driver posts a _PBMount call. This is always the case with floppies. This won't work with MkLinux partitions with the A/UX type (Apple_UNIX_SVR2) with usual SCSI drivers. Note: Latest (> 2.5) version of FWB HDT actually can mount MkLinux partitions without the trick explained in the next paragraph if you have at least one other MacOS partition on the same drive (and you have MountX installed of course). It looks like once it has sucessfully mounted it once, it will mount it again, so keep trying ... Update: With 1.0a1, MountX makes use of Apple's File Exchange API to ask the disk driver to create the appropriate drive queue entries for ext2 partitions. That means that if your disk driver supports those calls (Apple's driver does, of course), then your ext2 partition should now mount without any special trick. Note however that this check is currently only done at startup. There's a way to ask MountX to re-check but there's no application that makes use of this yet, and MountX won't re-check automatically when a new disk is inserted. That means that you may still experience trouble with removable drives. I plan to fix that too once I have a removable device to test with. If you have a driver that won't do it, you'll have to fake the driver and set your partition types to "Apple_HFS". This might cause you annoying messages when MountX is not installed. That's why I've defined an "Ext2" Gestalt selector for disk driver writers to be able to know if ext2 partitions are supported and if they should post mounts or not. See the enclosed file GestaltExt2.h for more infos on this selector. Note that the "LinuxDisks" utility, provided by Michel Pollet, has an option for editing the partition type. HFS-Interface notes: -------------------- What current version supports: - Mounting & Unmounting of volumes (of course) - Browsing it's catalog. Finder infos, file types/creator, etc... are not supported yet, we map all files to type TEXT creator CWIE (CodeWarrior IDE) but this can be changed using the MountX_Config application. You cannot modify the catalog, move files, delete files, etc... All those are still for the future... We also have the option to map file types/creators using Internet Config mappings. (This option is now ON by default) - Open/Close files (data forks only, resource forks are not supported yet) - Read from files The implemented HFS calls are: (This list may not be up-to-date, check the source code !) - PBOpenWD/PBCloseWD/PBGetWDInfo not fully tested, might still cause problems - PBGetFCBInfo seems to be ok - PBGetCatInfo should work correctly now - PBGetFInfo/PBHGetFInfo shoud work correctly - PBLockRange/PBUnlockRange fake implementation, just return noErr. GetVolParams says that we don't support range-locking and that's true. We just fake those two calls in order to make some applications like CodeWarrior happy because they always try to PBLockRange the files they open and they fail if PBLockRange returns an error. - PBOpen/PBOpenDF/PBOpenRF/PBHOpen/etc... all versions are implemented except the "Deny" version. Resource forks are opened as 0 byte-length fake files, but this will change. Permissions are NOT checked correctly, files are always read-only. Since version d10, we have minimal support for writing to files if you disable the "software protect" bit with MountX_Config. - PBClose works ok. - PBMakeFSSpec should be ok. I don't let FSM handle it for me since it's slower. - PBHGetVolParms returns that we support almost nothing ;-) but works - PBRead/PBWrite read seems to be ok, write is minimally implemented. Be VERY careful if you plan to write to MountX volumes with this version, fsck your disks after that ! - PBGetFPos/PBSetFPos/PBGetEOF seems to work just fine. - PBMountVol/PBUnmountVol works ok except sometimes, MountX doesn't recognise a re-mounted volume and gives it a new "number" (when there is no name) - PBFlushVol/PBFlushFile should be ok - PBGetVol/PBSetVol not fully tested, might cause problems when used with pathnames &| working directories. Someone have an old applic using a lot of those WDs to test ? - PBEject/PBOffline Took sample code "as is", added my flush routines. I should re-read what Inside Mac says about the "Ejected" and "Offline" states. (corrected a bug here when receiving an Eject with vcb==NULL after unmount). Note that I also provide some kind of "fake" implementation of some HFS calls in order to be compatible with the most possible applications. That's all folks ! (for the moment...) Release Notes: -------------- 10/04/97 - 1.0d1 First internal version sent to MP. Uses ext2fsprogs 1.0.4 17/04/97 - 1.0d2 Second internal version sent to MP and some other people. - Minimal file support: PBRead/PBOpen/PBClose/PBGetEOF/PBGetFPos/PBSetFPos are mostly working. Not all variations of PBOpen are implemented and resource fork are currently simulated as empty files when opened read-only in order to mimmic the behaviour of HFS (I should double-check this). Having several access-path to the same file can cause problems if one of them is in writing mode. There is currently no cross-updating of the FCBs related to a same file. But in fact, writing is not yet implemented. Fake range locking is implemented (does nothing) but it makes CodeWarrior happy when opening files on MountX disks. (CW always tries to PBLockRng even if PBGetVolParams says no. But it might be a bug in my implementation of GetVolParams). Files were tested using Stuffit Expander to expand a stuffit archive stored on a MountX volume, finder copy, codewarrior and SimpleText. - Correction of a bug which could try to use ext2lib with bad inode numbers when fsRtParID was involved. This could cause crashes or bad behaviours for applications who "walked" up a chain from child to father until root. Previous version never stopped on a fnfErr and could cause deadlocks. - Added the "Ext2" gestalt selector for disk drivers who might want to know if ext2 partitions are supported or not. The "GestaltExt2.h" file is to be bundled with MountX. - We now return an hacky approximation for the physical size of a file. I'll add better implementation later. - New icons :-) - Minimal configuration support. MountX now configures itself from a resource of type "CFIG", ID 0, which is loaded at startup. This resource can be edited with the MountX_Configure application. Currently, only the default type and default creator fields are used. Internet Config support is currently beeing worked on and if enabled, MountX will load the full map from name->type/creator translation. However, this map is not yet used, so you should leave this option disabled now. 19/04/97 - 1.0d3 Third internal version sent to MP and some other people. - Mkfs should run correctly now. There were bugs in the iomanager. I've added a lot of traces to mkfs. BTW. It seems that the ext2 lib sometimes crashes when the disk is corrupted or when it really contains bad datas. By the way, I implemented a (correct ?) handling of the sectorSize. Mkfs should now work with drives having a sectorSize != 512. - Big updates to this file - Better management of some of the VCB flags like the "busy" bit and the total and available sizes. - Better handling of the permission field on OpenFork and of some FCB fields. Revert to the pre-1.0d2 behaviour with resources: PBOpenRF returns fnfErr; - Implemented PBFlushFile (useless since files cannot be modified yet, but the code is here...) In fact, I did some background work in order to prepare for writing code (busy bit, more FCB checks, better flushes, etc...) - Implemented PBEject/PBOffline (not fully tested). - Made some corrections on volume mounting/unmounting code, should now work when more than 1 volume is mounted. - Removed sprinf.c, updated sprinf version inside custom_ansi.c to MSL2.1.1, added a bigger buffer for printf LF->CR conversion. I still should move all the printf stuff out of custom_ansi and use a better "putc" replacement (I'm currently doing an strlen on almost every char addition to in output string). mkfs sometimes crashed in show_status (a lot of printf's), maybe this would be better now. - Corrected a bug which could cause strange behaviour when unmounting a volume. - Modified load/unload functions of HFS component. They now dispose the handle instead of just marking it purgeable. This is less efficient but prevents returning inside a resource which static datas already having strange values. Maybe I should do the same with DICI code... Added check of return value of init_custom_ansi and allocated the custom ANSI pointer with NewPtrSysClear instead of NewPtr... Also added set the zone to SysZone() during the whole load & unload operations. - Same modification to DICI code, and I keep it locked now because I have some globals containing pointers to other globals. I should try to change this ASAP in order to be able to keep unlocked again. - Finder didn't like some of my GetVolParams attributes and refused to allow erasing of ext2 disks. This is now corrected. - Replaced the useless dialog when formatting by a new one that let you choose format options (options for mkfs). Currently only supports changing the bloc size but this will of course be extended. - Corrected some bugs with PBRead implementation. Should now work when reading past the eof (it just reads until eof and returns eofErr instead of deadlocking). Some problems were also happening when copying files with the Finder with SpeedDoubler faster copy option. 28/04/97 - 1.0d4 First "public" version - Removed some debugging stuffs - Added a time bomb to avoid having prototypes versions going everywhere 29/04/97 - 1.0d5 Second "public" version ;-) - Fixed some problems with re-mounting a disk. (It could appear several times on the desktop). I was not correctly detecting that I was receiving several PBMountVol on the same volume. - Definitely set the "Hard lock" bit to 1 all the time in the VCB and return vLckdErr on PBSetCatInfo, PBSetFileInfo (instead of paramErr) and on any file-opening call with permissions set to write. MacOS 8 finder leaves very much better with those fixes... 02/05/97 - 1.0d6 Third "public" version (alpha 1 is soon ... !) ;-) - Re-reverted the behaviour of PBOpenRF. It should behave like HFS: when called on a file with no resource fork, it simulates a fake empty resource fork and returns noErr. Resource forks support (thru AppleDouble probably) are planed for sometimes in the future... - Corrected some bugs here and there, mainly on pathname parsing or with MakeFSSpec. - Several volumes with the same name can cause unexpected behaviours from various MacOS applications, se we now try to implement a unique name mechanisme. (A counter is appended after the name). In the future, I plan to implement a real volume name stored in a special file, along with other MacOS specific stuffs... - Implement internet config type/creator mapping. - Removed MacsBug calls (except maybe one or two in very critical situations, I should check...). In fact they can be re-enabled via the CFIG resource (and the Configure utility that I forgot to bundle with previous releases). - Removed a lot of internal traces. They are not visible but MountX continuously generates lots of ASCII traces. This slows everything down. Some "Big" traces, especially when doing i/os on files, have been commented out in this release. - Implement the "dot files are invisible" function which allows, if the prefs bit is set, to mark files with a name beginning with a period ('.') to be marked as having the "Invisible" finder bit. - The Configuration application can now have access to the config of the running MountX. It can load it's config from it and save to it. Note that all config change take effect immediately (but applications are not notified of eventual change of some Finder infos of the files) except for Internet Config mapping which is currently loaded once, when MountX is loaded. - Corrected a bug in e2fsprogs which could cause problems when several ext2 volumes where opened and used at the same time. I should check if the bug is still present in version > 1.0.4 of e2fsprogs. (I'll soon update to 1.0.6 or 1.0.9) - SymLinks are now shown as special files with MountX creator and the "symL" type. (There is an ugly icon for them in MountX, you'll probably have to rebuild your desktop or use Save A BNDL on MountX to see it). Those files are "fake" empty files. This is to avoid errors from the finder when copying a folder containing SymLinks. In the future, desktop manager calls for getting comments will return the symlink and I will probably make a little applet which will get launched when clicking the symlink and which will try to resolve it. It will probably be possible to create symlinks by using the same trick in the future. 02/05/97 - 1.0d7 This time, I have e2fs 1.0.9 + patch from Paul Mackeras ! - Compiles now with an updated e2fs 1.0.9 ported to CodeWarrior. I still could do some optimisations, I know, like using lhbrx and lwbrx for swapping etc... compiled with inlining turned on and with e2fs lib compiled with optimisations enabled (but not MountX). Should run with little endian file systems. I don't have modified mkfs yet, so this is the old mkfs running with the new lib. All I've tested is to mount old "Big Endian" file systems, so give me your feedback if you have a "Little Endian" one ! Ah yes ! I still to correct the problem with the inode-cache declared as static and causing problems when running several file systems at the same time. The same problem occurs also with expand_dir_proc() in expanddir.c - Activated the inode cache. Seems to be ok... I've also removed more traces. - With the new e2lib, we win the volume name ! If it's empty, the old "MountX n" is used. I'll also try to implement use of uuid for remount-checking. - Updated Mkfs to new lib. You can now set a volume name and the creator OS. Also fixed some bugs with error handling inside mkfs code (implemented a fake exit() using setjmp/longjmp). - Switched the "hard lock" bit to "soft lock" bit. The hard lock now reflects the state of the underlying device. - A strange compiler-related problem was corrected which could prevent MountX for beeing presented is a list a choices for a formatting. - Added a config option to allow mounting disks without the "read-only" bit. This allows, for example, formatting. But don't try this with MacOS 8b1 ! 18/05/97 - 1.0d8 - Corrected implementation of PBFlush, PBMount & PBUnmount using new ext2 functions. - MountX was having some memory problems with large disks. I've increased the size of the memory pool (which is allocated the first time an ext2 volume is mounted). You should also be able to change it yourself, the sizes are stored in a "STR#" resource. I'm thinking about a better memory management scheme with a pool per file system and a poolsize calculated from the filesystem - MountX should no more crash when rebooting with ext2 volumes mounted. - MountX should now refuse to PBUnmount a volume with an open file on it. (busy). It will however always honor PBHUnmount (low level, system reserved). - Fixed a bug where MountX could write beyond the end of the buffer provided by the caller of a PBRead. - Fixed another nasty bug in PBRead who was not correctly setting the file mark, so several PBRead with ioPosMode == fsAtMark would return garbage datas. - Ugh ! PBSetFPos was broken... Fixed. - There is still a bug in this version when trying to Unbinhez a file directly with Stuffit Expander from an ext2 disk. (It works with two other files, in .sit and .gz formats). This seems to be related to the "EOLN" mode of PBRead not beeing implemented yet. 23/07/97 - 1.0d9 - Updated to ext2fsprogs 1.10-1A from Paul Mackerras which corrects many issues related to big endian file systems. Some bugs I corrected myself in previous versions are new fixed in the release of the library (statics in inode cache & friends). ??/02/98 - 1.0d10 - First released source code, contained some mistakes (badly resurected from a disk crash, sorry). 23/02/98 - 1.0d11 - Some more fixes: PBRead had weird behaviour in LEOF mode, worked around 1 or 2 bugs in Apple's FS API, etc... (Thanks Thomas) - Added flags so MacOS now handles the desktop manager database for me on MacOS 8 - Corrected a conflict which could sometimes prevent other filesystems from mounting a volume when there was at least 1 MountX volume already mounted. - Updated to ext2fs lib 1.10-1B with patches from Paul Mackerras (linux-pmac) and a path from mine (source code available soon) - Fixed a bug in the low-level i/o manager that could cause use of a wrong pointer in some cases. Cleaned-up the i/o manager transfer code (I was really tired when I wrote it...) - Fixed another bug which could cause weird behaviour with filesystems initialized with a size different than 1024. - Performance improvements (activated more optims in the compiler ;-) 22/04/98 - 1.0d12 - Fixed some stuffs in MountVol request to check for existing online volume on the same drive. - Rewritten part of the HFS dispatch with some code for doing the "checks" before calling the actual routines. Also removed unused parameters for the handling routines. (The prototype of all DoXXX function was changed) - Cleanup the source code here or there & added more comments. Translated some comments that where in French ;-) - Moved all the non-distributable source (mainly tracing stuffs) to a separate lib for which I release only the binary. This will change as soon as I finish a free implementation of this trace mecanism. - Updated to C version of ShowINIT code, now named ShowInitIcon.c - Fixed a bug in the configure appliaction which prevented it from loading/saving to/from the application version of MountX (installer app) - Directories whose name begins with a "." are now correctly marked as invisible when the "dot files are invisible" option is ON. 22/04/98 - 1.0d13 - Same version, removed a nasty DebugStr in the disk initialization code ??/??/98 - 1.0d14 - Fixed conversion of dates between linux and MacOS - Fixed stuffs in disk initialization. - HFS & DICI now have a debug and a release target. The release target is built without traces and with more optimisations. - Finally implemented my own traces mechanism. The project for building the custom ANSI is now available and you can rebuild it yourself. Note however that it relies on some of the sources (very few) of MSL that are bundeled with CodeWarrior. - Projects are now updated to CodeWarrior Pro3. - Updated port of ext2 lib 1.12 and implemented some of it's new features to improve behaviour of some parts of MountX. - Replaced the pre-loading of the physical block list of a file by the use of the new ext2 bmap routines. MountX should no longer exhaust it's internal memory pool. This also fixes and old problem that could happen with large files. 13/06/99 - 1.0a1 - Updated to ext2fs-progs 1.14 - Added mount code based on File Exchange API. MountX should now mount ext2 partitions at startup a lot more often than it used to provided that you have a disk driver that supports Apple's File Exchange API. - Minor fixes here or there. Notes: ------ Thanks to Pete Gontier from Apple's DTS for sending me SampleDOS sample code and to Jim Luther for all the FSM stuffs. Thanks to Thomas Tempelmann for tips & tricks about FSs on MacOS, to Christiaan Welvaart for the error files parser (the only piece of Java code on my hard disk ;-) Thanks very much to Quinn the Eskimo, from Apple DTS too, for useful advices, sample codes, and his overall excellent work at DTS. Thanks also to all Apple & non-Apple people who helped me in this project. This file is maintained by Benjamin Herrenschmidt (bh40@calva.net)