/*static char *SCCSID = "@(#)pr_cache.h	6.2 91/01/14";*/
/*	SCCSID = "@(#)pr_cache.h	6.2 91/01/14"
 *
 *	IBM/Microsoft Confidential
 *
 *	Copyright (c) IBM Corporation 1987, 1989
 *	Copyright (c) Microsoft Corporation 1987, 1989
 *
 *	All Rights Reserved
 *
 */

/*  NAME :  PR_CACHE.H
 *    
 *
 *  DESCRIPTION
 *    
 *      Prototype for cache functions.
 *
 *
 *  REVISION HISTORY (in reverse chronological order)
 *  -----------------------------------------------------------------------
 *
 *  3/07/95     Uri Stern           Defect 115129.  Error action during read should cause           
 *                                  abort-retry-fail(not destroy process).  We need to              
 *                                  change READ_SECTORS macro to use DOVOLIO_IFERROR for            
 *                                  FSH_DOVOLIO in ReadSector so that harderror does              
 *                                  not blow the process away.  @115129              
 *
 *  4/13/90     Brian Andrew        Prototype for 'CleanUpHdrs'.
 *
 *  4/12/90     Brian Andrew        Prototype for 'RemovePTSec'.
 *                                  Prototype for 'RemoveListSec'.
 *
 *  4/11/90     Brian Andrew        Prototype for 'FillBuf'.
 *                                  Prototype for 'AttachBuf'.
 *                                  Prototype for 'GetBufChain'.
 *                                  Prototype for 'AddBufChain'.
 *                                  Prototype for 'FindBuf'.
 *                                  Prototype for 'TestPreemptBuf'.
 *                                  Prototype for 'GetBuf'.
 *
 *  4/10/90     Brian Andrew        Prototype for 'FindExistBuf',
 *                                  'ResearchList' and 'PendWait'.
 *
 *  4/9/90      Brian Andrew        Prototype for new 'MultiSectors',
 *                                  'ReadSector' and 'PerformRead'.
 *
 *  4/9/90      Brian Andrew        Prototype for 'AddHdrs', 'BecomeReader',
 *                                  'DepartReader', 'BecomeWriter' and
 *                                  'DepartWriter'.
 *
 *
 *  TO DO
 *  -------------------------------------------------------------------------
 */

extern USHORT AddHdrs (PFIND_BUF_LOC pfblVars);

extern VOID BecomeReader (PLIST_SEM_BLK plsbSemBlk);

extern VOID DepartReader (PLIST_SEM_BLK plsbSemBlk);

extern VOID BecomeWriter (PLIST_SEM_BLK plsbSemBlk);

extern VOID DepartWriter (PLIST_SEM_BLK plsbSemBlk);

extern USHORT PerformRead (PFIND_BUF_LOC   pfblVars);

extern USHORT MultiSectors (PFIND_BUF_LOC pfblVars);

extern USHORT ReadSector (
					USHORT      hVPB,
					PPBUF       ppbBuf,       
					SECT_NUM    snStartSector,
					USHORT      csSectorCount);

extern BOOL FindExistBuf (PFIND_BUF_LOC pfblVars);

extern USHORT ResearchList (PFIND_BUF_LOC pfblVars);

extern BOOL PendWait (
				PFIND_BUF_LOC   pfblVars,
				PBUF_LIST       pblThisHdr);

extern VOID FillBuf (PFIND_BUF_LOC  pfblVars);

extern VOID AttachBuf (PFIND_BUF_LOC   pfbVars);

extern USHORT  GetBufChain (PFIND_BUF_LOC   pfblVars);

extern VOID AddBufChain (
					PBUF    pbFirstBuf,
					PBUF    pbLastBuf,
					BOOL    fBLOwns);

extern USHORT FindBuf (
					PVOL_DEP_DATA   pvddVolData,
					BOOL            fBLOwns,
					SECT_NUM        snStartSector, 
					USHORT          hVPB,          
					PPBUF           ppbThisBuf,    
					SECT_NUM        snLastSector  
				
#ifdef STATS_H
					,USHORT         usThisSecType
#endif
					);

extern BOOL TestPreemptBuf (
					PBUF    pbThisBuf,
					BOOL    fBLOwns);

extern USHORT GetBuf (PPBUF   ppbReturnBuf);

extern VOID RemovePTSec (PBUF    pbBuf);

extern VOID RemoveListSec (PBUF    pbBuf);

extern VOID CleanUpHdrs (PBUF_LIST   pblHdr, BOOL fBLOwns);



// Performs the Read Sectors operation by calling FSH_DOVOLIO 
// UJS @115129 Change FSH_DOVOLIO to use DOVOLIO_IFERROR 

#define READ_SECTORS(HVPB, pBUF, pSectors, StartSector)        \
        FSH_DOVOLIO (DOVOLIO_OP, DOVOLIO_IFERROR, HVPB,        \
                    (PCHAR) pBUF->sSector, (PUSHORT) pSectors, \
                    (ULONG) StartSector)

