ReactOS  0.4.14-dev-854-gb9426a3
blkcache.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING.ARM in the top level directory
3  * PROJECT: ReactOS UEFI Boot Library
4  * FILE: boot/environ/lib/io/blkcache.c
5  * PURPOSE: Boot Library Block Cache Management Routines
6  * PROGRAMMER: Alex Ionescu (alex.ionescu@reactos.org)
7  */
8 
9 /* INCLUDES ******************************************************************/
10 
11 #include "bl.h"
12 
13 /* DATA VARIABLES ************************************************************/
14 
17 
18 /* FUNCTIONS *****************************************************************/
19 
22  VOID
23  )
24 {
25  //BcpPurgeCacheEntries();
26  //return BlpMmDeleteBlockAllocator(BcpBlockAllocatorHandle);
27  EfiPrintf(L"Destructor for block cache not yet implemented\r\n");
29 }
30 
31 BOOLEAN
33  _In_ PBL_HASH_ENTRY Entry1,
34  _In_ PBL_HASH_ENTRY Entry2
35  )
36 {
37  PULONG Value1, Value2;
38 
39  Value1 = Entry1->Value;
40  Value2 = Entry2->Value;
41  return Entry1->Size == Entry2->Size && Entry1->Flags == Entry2->Flags && *Value1 == *Value2 && Value1[1] == Value2[1] && Value1[2] == Value2[2];
42 }
43 
44 ULONG
48  )
49 {
50  ULONG i, j, ValueHash;
51  PUCHAR ValueBuffer;
52 
53  j = 0;
54  ValueHash = 0;
55  i = 0;
56 
57  ValueBuffer = Entry->Value;
58 
59  do
60  {
61  ValueHash += ValueBuffer[i++];
62  } while (i < 8);
63 
64  do
65  {
66  ValueHash += ValueBuffer[j++ + 8];
67  } while (j < 4);
68 
69  return ValueHash % TableSize;
70 }
71 
74  VOID
75  )
76 {
78 
80  if (!NT_SUCCESS(Status))
81  {
82  goto Quickie;
83  }
84 
86  if (BcpBlockAllocatorHandle == -1)
87  {
89  goto Quickie;
90  }
91 
93  if (Status >= 0)
94  {
95  return Status;
96  }
97 
98 Quickie:
99  EfiPrintf(L"Failure path not yet implemented\r\n");
100 #if 0
101  if (BcpHashTableId != -1)
102  {
103  BlHtDestroy(BcpHashTableId);
104  }
105  if (BcpBlockAllocatorHandle != -1)
106  {
108  }
109 #endif
110  return Status;
111 }
ULONG BcpBlockAllocatorHandle
Definition: blkcache.c:15
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
NTSTATUS BlHtCreate(_In_ ULONG Size, _In_ PBL_HASH_TABLE_HASH_FUNCTION HashFunction, _In_ PBL_HASH_TABLE_COMPARE_FUNCTION CompareFunction, _Out_ PULONG Id)
Definition: util.c:504
ULONG BcpHashTableId
Definition: blkcache.c:16
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS BlpMmDeleteBlockAllocator(_In_ ULONG BlockId)
Definition: blkalloc.c:88
NTSTATUS BlpMmCreateBlockAllocator(VOID)
Definition: blkalloc.c:213
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned char BOOLEAN
NTSTATUS BlpIoRegisterDestroyRoutine(_In_ PBL_IO_DESTROY_ROUTINE DestroyRoutine)
Definition: io.c:21
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
NTSTATUS BcpDestroy(VOID)
Definition: blkcache.c:21
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
static const WCHAR L[]
Definition: oid.c:1250
NTSTATUS BcInitialize(VOID)
Definition: blkcache.c:73
Definition: bl.h:1177
Status
Definition: gdiplustypes.h:24
ULONG BcpHashFunction(_In_ PBL_HASH_ENTRY Entry, _In_ ULONG TableSize)
Definition: blkcache.c:45
#define _In_
Definition: no_sal2.h:204
unsigned int * PULONG
Definition: retypes.h:1
VOID EfiPrintf(_In_ PWCHAR Format,...)
Definition: firmware.c:126
BOOLEAN BcpCompareKey(_In_ PBL_HASH_ENTRY Entry1, _In_ PBL_HASH_ENTRY Entry2)
Definition: blkcache.c:32
_Must_inspect_result_ typedef _Out_ PULONG TableSize
Definition: iotypes.h:3971
unsigned int ULONG
Definition: retypes.h:1
base of all file and directory entries
Definition: entries.h:82