Compartilhar via


Implementing FSD_GetVolumeInfo

In Windows CE 5.0, we added a new FSD API: FSD_GetVolumeInfo. This API is used to populate the CE_VOLUME_INFO structure reported by the CeGetVolumeInfo SDK API. This function is intended to give applications insight into properties of the file system where they're storing data.

Documentation for this API has not yet made it to MSDN (at the time of this posting), and so I've put together a brief description of how this function should be implemented in an FSD.

BOOL
FSD_GetVolumeInfo (
DWORD dwVolume,
FSD_VOLUME_INFO *pInfo
};

Parameters:
dwVolume – [in] The volume context passed by the FSD to FSDMGR_RegisterVolume.
pInfo – [out] A structure describing file system specific information about the volume.

Return Values:
Return TRUE on success. FALSE if the cbSize member of the FSD_VOLUME_INFO structure is not as expected.

The FSD_VOLUME_INFO structure returned by FSD_GetVolumeInfo:

typedef struct _FSD_VOLUME_INFO {

    DWORD cbSize;
DWORD dwFSVersion ;
TCHAR szFSDDesc[MAX_FSD_DESCRIPTOR];
TCHAR szFSDSubType[MAX_FSD_DESCRIPTOR];
DWORD dwAttributes;
DWORD dwBlockSize;
DWORD dwFlags;

} FSD_VOLUME_INFO, *PFSD_VOLUME_INFO;

cbSize - [in] This should be set by the caller to sizeof (FSD_VOLUME_INFO) for versioning.
dwFSVersion - [out] Set to FSD_VERSION_0
szFSDDesc - [out] Currently ignored. You can set this to the name of the file system.
szFSDSubType - [out] Currently ignored. You can set this to a sub-name for the file system.
dwAttributes - [out] Bitmask containing FSD_ATTRIBUTE_ values described below.
dwBlockSIze - [out] Set to the optimal I/O buffer size for the file system. For FAT, this would be the cluster size.
dwFlags - [out] Bitmask containing FSD_FLAG_ values described below.

FSD Attributes:

FSD_ATTRIBUTE_READONLY - Add to FSD_VOLUME_INFO.dwAttributes when the volume is readonly.
FSD_ATTRIBUTE_XIP - Add to FSD_VOLUME_INFO.dwAttributes when the volume supports XIP from the file system.

FSD Flags:

FSD_FLAG_TRANSACTION_SAFE - Add to FSD_VOLUME_INFO.dwFlags when the volume supports transaction safe operations. This indicates that the file system meta-data will not become corrupt due to power loss.
FSD_FLAG_TRANSACT_WRITES - Add to FSD_VOLUME_INFO.dwFlags when the volume supports transaction safe WriteFile operations. This indicates that data written to the file system will not become corrupt due to power loss.
FSD_FLAG_WFSC_SUPPORTED - Add to FSD_VOLUME_INFO.dwFlags when the FSD supports the FSD_WriteFileGather and FSD_ReadFileScatter file I/O APIs.
FSD_FLAG_LOCKFILE_SUPPORTED - Add to FSD_VOLUME_INFO.dwFlags when the FSD supports the FSD_LockFileEx and FSD_UnlockFileEx range-locking APIs.
FSD_FLAG_NETWORK - Add to FSD_VOLUME_INFO.dwFlags when the FSD is a network file system.

And of course don't forget to the new export do your .def file or FSDMGR will not find it.

-Andrew