Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygencache.h
Go to the documentation of this file.
00001 /* 00002 * FreeLoader 00003 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, write to the Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 */ 00019 00020 00021 #pragma once 00022 00024 // 00025 // This structure describes a cached block element. The disk is divided up into 00026 // cache blocks. For disks which LBA is not supported each block is the size of 00027 // one track. This will force the cache manager to make track sized reads, and 00028 // therefore maximizes throughput. For disks which support LBA the block size 00029 // is 64k because they have no cylinder, head, or sector boundaries. 00030 // 00032 typedef struct 00033 { 00034 LIST_ENTRY ListEntry; // Doubly linked list synchronization member 00035 00036 ULONG BlockNumber; // Track index for CHS, 64k block index for LBA 00037 BOOLEAN LockedInCache; // Indicates that this block is locked in cache memory 00038 ULONG AccessCount; // Access count for this block 00039 00040 PVOID BlockData; // Pointer to block data 00041 00042 } CACHE_BLOCK, *PCACHE_BLOCK; 00043 00045 // 00046 // This structure describes a cached drive. It contains the BIOS drive number 00047 // and indicates whether or not LBA is supported. If LBA is not supported then 00048 // the drive's geometry is described here. 00049 // 00051 typedef struct 00052 { 00053 UCHAR DriveNumber; 00054 ULONG BytesPerSector; 00055 00056 ULONG BlockSize; // Block size (in sectors) 00057 LIST_ENTRY CacheBlockHead; // Contains CACHE_BLOCK structures 00058 00059 } CACHE_DRIVE, *PCACHE_DRIVE; 00060 00061 00063 // 00064 // Internal data 00065 // 00067 extern CACHE_DRIVE CacheManagerDrive; 00068 extern BOOLEAN CacheManagerInitialized; 00069 extern ULONG CacheBlockCount; 00070 extern SIZE_T CacheSizeLimit; 00071 extern SIZE_T CacheSizeCurrent; 00072 00074 // 00075 // Internal functions 00076 // 00078 PCACHE_BLOCK CacheInternalGetBlockPointer(PCACHE_DRIVE CacheDrive, ULONG BlockNumber); // Returns a pointer to a CACHE_BLOCK structure given a block number 00079 PCACHE_BLOCK CacheInternalFindBlock(PCACHE_DRIVE CacheDrive, ULONG BlockNumber); // Searches the block list for a particular block 00080 PCACHE_BLOCK CacheInternalAddBlockToCache(PCACHE_DRIVE CacheDrive, ULONG BlockNumber); // Adds a block to the cache's block list 00081 BOOLEAN CacheInternalFreeBlock(PCACHE_DRIVE CacheDrive); // Removes a block from the cache's block list & frees the memory 00082 VOID CacheInternalCheckCacheSizeLimits(PCACHE_DRIVE CacheDrive); // Checks the cache size limits to see if we can add a new block, if not calls CacheInternalFreeBlock() 00083 VOID CacheInternalDumpBlockList(PCACHE_DRIVE CacheDrive); // Dumps the list of cached blocks to the debug output port 00084 VOID CacheInternalOptimizeBlockList(PCACHE_DRIVE CacheDrive, PCACHE_BLOCK CacheBlock); // Moves the specified block to the head of the list 00085 00086 00087 BOOLEAN CacheInitializeDrive(UCHAR DriveNumber); 00088 VOID CacheInvalidateCacheData(VOID); 00089 BOOLEAN CacheReadDiskSectors(UCHAR DiskNumber, ULONGLONG StartSector, ULONG SectorCount, PVOID Buffer); 00090 BOOLEAN CacheForceDiskSectorsIntoCache(UCHAR DiskNumber, ULONGLONG StartSector, ULONG SectorCount); 00091 BOOLEAN CacheReleaseMemory(ULONG MinimumAmountToRelease); Generated on Sun May 27 2012 04:19:14 for ReactOS by
1.7.6.1
|