This is a detailed summary of the work I've performed during GSoC.
- Wrote numerous functions which allow for NTFS write-support.
- Expanded ReactOS' NTFS driver with the ability to overwrite files and change a file's size.
- Identified and repaired several bugs related to reading files from NTFS.
- Fixed ReactOS' LargeMCB implementation, facilitating support for four file systems, NTFS included (See CORE-11002).
- Diagnosed and fixed a regression using log files (See CORE-11707).
The following improvements have been submitted to my GSoC branch:
Contributions to Trunk:
The following improvements have already been incorporated into ReactOS by my mentor, Pierre Schweitzer, as a result of my work:
During the course of this activity, I also wrote a considerable amount of code that was useful to me, but never intended to be committed. Only the minimal amount of time was spent writing these programs, so I wasn't distracted from writing driver code. As such, this bonus code has numerous errors: memory is often leaked; file handles are leaked; comments are missing, deceptive, or just plain wrong; things are done in an inconsistent manner; etc. For the most part, these programs can't be interacted with except at the level of their source code.
What's working / What can be used now
Every change mentioned under "Contributions to Trunk" has already found it's way into the ReactOS operating system. These changes can be used by simply running a livecd of the latest version of ReactOS and reading an NTFS volume. You can also use my tester; the read tests stress the parts of the driver that used to be broken.
Overwriting a file is mostly finished and works as an end-user would expect, with the caveats I'm aware of listed below. There's two ways to test: First, build my branch with the usual method. In a virtual machine, mount an NTFS volume in Windows, preferably Windows Server 2003. Create a text file on the volume. To test writing to resident files, you can leave this blank, to test writing to non-resident files, add at least 800 bytes of text then save the file.
Reboot into ReactOS (built with my GSoC branch). Open the file with Notepad.exe and change the contents. If testing resident files, make sure you add less than about 600 bytes of data (migrating resident attributes to non-resident isn't implemented at present). If testing non-resident files, there isn't such a restriction. Save the file. Reboot into Windows. You should be able to observe that your file has been updated from within ReactOS.
Alternate testing method: Use my automated tester, Disk_Test_1. The principle is the same. You need to copy the tester onto an NTFS drive from within Windows, and run the program once. Then, you can run the tester from within ReactOS.
What's left to be done
There's still considerable work to be done before the driver is ready for the end-user. Immediate goals include:
As suggested by Thomas Faber, write support should be disabled by default, and enabled via the registry. This will prevent end-users who misunderstand the experimental-nature of the driver from losing data.
For overwriting a file:
- Support changing a file's [allocation] size via IRP_MJ_SET_INFORMATION.
- Support migrating a resident file to non-resident, when it grows too large.
- Add support for creating $ATTRIBUTE_LIST (very rarely needed).
For creating a new file:
- Commit code to create a new file record (this is working but I didn't have the commit ready in time for the end of GSoC).
- The file must have an index entry added to the parent directory's index.
From there, creating directories, deleting and renaming files and directories would be next, making the driver fairly usable. However, before the driver can be considered "feature complete," considerable development is still needed beyond even this point. Off the top of my head and in no particular order: we need to make sure we support caching, compression, logging, async IO, memory mapped files, installing to and booting from NTFS, etc...
Thank you to my mentors, ReactOS, and Google for this wonderful opportunity!!
I definitely plan to keep contributing to ReactOS! As of right now, the last commit made to my branch by the GSoC deadline is r72424, and newer commits should be considered to be made after GSoC has ended.