Share via


FSDMGR_CreateCache (Windows Embedded CE 6.0)

1/6/2010

This function creates a new cache. It is called by File System Disk Manager for disk cache.

Syntax

DWORD  FSDMGR_CreateCache(
    HDSK pDsk,
    DWORD dwStart,
    DWORD dwEnd,
    DWORD dwCacheSize,
    DWORD dwBlockSize,
    DWORD dwCreateFlags
);

Parameters

  • hDsk
    [in] Handle to the disk to cache.
  • dwStart
    [in] Starting block number of the disk to cache.
  • dwEnd
    [in] Ending block number of the disk to cache.
  • dwCacheSize
    [in] Number of blocks the cache can hold.
  • dwBlockSize
    [in] The size of a block, in bytes. This value is typically equal to the sector size of the disk, although this is not required.

    The block size must be a power of 2 and less than the buffer size, which is set to 64 KB by default.

  • dwCreateFlags
    [in] The following table shows possible values.

    Value Description

    CACHE_FLAG_WARM

    Warms the cache.

    This preloads the cache starting with the dwStart value, until the cache is filled.

    CACHE_FLAG_WRITEBACK

    Enables write-back mode for the cache.

    If not specified, the default is write-through mode.

    Upon creation of the cache in write-back mode, a low priority thread is created, which commits dirty blocks.

Return Value

A cache ID value indicates success. This ID is used in the other Disk Cache Manager functions. INVALID_CACHE_ID indicates failure, probably due to an invalid parameter or a lack of memory.

Remarks

The buffers for the cache are allocated one at a time.

If the memory allocation for a specific buffer fails, the size of the successful buffers allocated becomes the cache size.

If no buffer can be allocated, the cache is of size zero, and all read and write requests go directly to the disk.

Requirements

Header fsdmgr.h
Library Fsdmgr.lib
Windows Embedded CE Windows CE 5.0 and later

See Also

Reference

FSDMGR Functions
FSD Functions