Registry Configuration for an FSD

File system drivers can be loaded in two different ways: loaded in response to a disk being attached to the system (discovered during boot or after media insertion), and auto-loaded during the boot sequence.

Auto-Loaded File Systems
 
Auto-loaded file systems are monolithic file systems that do not use on an underlying disk driver to read and write sectors. A good example of an auto-loaded file system is a network file system driver, which would rely on network protocols rather than on a disk to for I/O. Another example might be a monolithic flash file system where flash I/O routines are statically built into the FSD.

The installation of auto-loaded file systems during the boot sequence is driven by registry keys. An auto-load registry key would look like this:

[HKEY_LOCAL_MACHINE\System\StorageManager\AutoLoad\MyAutoLoadFSD]
"Dll"="MyAutoLoadFSD.DLL"
"Util"="MyAutoLoadFSDUtility.DLL"
"Order"=dword:0
"BootPhase"=dword:1
"LoadFlags"=dword:1
"Paging"=dword:1

The following table explains each of the values shown above:

Value Name

Required?

Description

Dll

Yes

Provides the name of the FSD Dll to be loaded.

Util

No

Describes the name of a utility/helper Dll that provides format, scan, and/or defragment functions for the file system.

Order

No

Specifies the order in which the FSD should be loaded relative to other auto-load file systems in the same boot phase. Lower order numbers will cause the FSD to load earlier. If this value is not specified, the FSD will be loaded last.

BootPhase

No

Set to either 0, 1 or 2, this value tells the storage manager the boot phase in which to load the driver. If no boot phase is specified, the driver will be loaded during boot phase 1.

LoadFlags

No

Currently set to either 0 or 1. If set to 1, the FSD will be loaded synchronously. If set to 0, the FSD will be loaded asynchronously. FSDs loaded during boot phases 0 or 1 must be loaded synchronously.

Paging

No

Specifies whether or not the FSD should support demand-paging for memory mapped files. By default, paging will be supported if this value is not specified in the registry.

Additional file system specific registry values should be placed under this same key. These values can be read by the FSD using the FSDMGR_ registry helper functions (described above).
 
Partition-Backed File Systems

File system drivers that are instantiated in response to a storage device being mounted load in response to the type of the partition being mounted. The partition type is a single byte value that is specified when the partition is created. The mapping between a partition type byte and a file system is provided in the registry under the PartitionTable key. The following is the default partition table provided by Microsoft in common.reg:

[HKEY_LOCAL_MACHINE\System\StorageManager\PartitionTable]
"01"="FATFS"
"04"="FATFS"
"06"="FATFS"
"07"="NTFS"
"0B"="FATFS"
"0C"="FATFS"
"0E"="FATFS"
"0F"="FATFS"
"20"="BOOT"
"21"="BINFS"
"22"="RAWFS"
"23"="RAWFS"
"25"="IMGFS"
"26"="BINARY"

The partition table associates a byte value partition type with a file system string. For example, byte value 0x04 is mapped to the file system string “FATFS.” The settings for this partition, then, are located under the registry sub-key with the name “FATFS”:

[HKEY_LOCAL_MACHINE\System\StorageManager\FATFS]
"Dll"="FATFSD.DLL"
"Util"="FATUTIL.DLL"
"Paging"=dword:1

An OEM may add or modify the partition table provided in common.reg to accommodate new file systems. For example:

[HKEY_LOCAL_MACHINE\System\StorageManager\PartitionTable]
"93"="MYFSD"

A file system key would also be necessary in order to map the new file system to an appropriate Dll and settings:

[HKEY_LOCAL_MACHINE\System\StorageManager\MYFSD]
"Dll"="MyFSD.DLL"
"Util"="MyFSDUtil.DLL"
"Paging"=dword:1

Additionally, the partition table and file system settings can be overridden on a per-profile basis. Typically, storage/block drivers report a storage profile name to the storage manager (via the IOCTL_DISK_DEVICE_INFO control code) when a storage device is loaded. This profile string can be used to map specific file system and/or partition table settings to a particular storage device or class of storage device.

For example, if a storage driver reports is profile name as “Sample” the following registry key will override the base settings for the “MYFSD” file system:

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\Sample\MYFSD]
"Paging"=dword:0

Values that are not explicitly overridden for the profile will be loaded from the base key, in this case HKLM\System\StorageManager\MYFSD. The same applies for file system specific settings read using the FSDMGR_ registry helper functions; these functions will always check both the profile file system key and base file system key for the value.

In some cases, it may be desirable to modify the default partition table for a certain storage profile. This can be done by adding a profile-specific partition table to the registry:

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\Sample\PartitionTable]
"04"="MYFSD"

The above example overrides the default value for partition type 0x04 from FATFS to MYFSD. This modification only applies to storage devices reporting a profile name of “Sample.”

-Andrew