mirror of
https://github.com/donnaskiez/ac.git
synced 2024-11-21 22:24:08 +01:00
comment
This commit is contained in:
parent
102165029d
commit
2f679357ed
1 changed files with 9 additions and 8 deletions
17
driver/map.c
17
driver/map.c
|
@ -64,7 +64,7 @@ RtlHashmapCreate(_In_ UINT32 BucketCount,
|
||||||
FORCEINLINE
|
FORCEINLINE
|
||||||
STATIC
|
STATIC
|
||||||
PRTL_HASHMAP_ENTRY
|
PRTL_HASHMAP_ENTRY
|
||||||
RtlHashmapFindUnusedEntry(_In_ PLIST_ENTRY Head)
|
RtlpHashmapFindUnusedEntry(_In_ PLIST_ENTRY Head)
|
||||||
{
|
{
|
||||||
PRTL_HASHMAP_ENTRY entry = NULL;
|
PRTL_HASHMAP_ENTRY entry = NULL;
|
||||||
PLIST_ENTRY list_entry = Head->Flink;
|
PLIST_ENTRY list_entry = Head->Flink;
|
||||||
|
@ -86,7 +86,7 @@ RtlHashmapFindUnusedEntry(_In_ PLIST_ENTRY Head)
|
||||||
FORCEINLINE
|
FORCEINLINE
|
||||||
STATIC
|
STATIC
|
||||||
PRTL_HASHMAP_ENTRY
|
PRTL_HASHMAP_ENTRY
|
||||||
RtlHashmapAllocateBucketEntry(_In_ PRTL_HASHMAP Hashmap)
|
RtlpHashmapAllocateBucketEntry(_In_ PRTL_HASHMAP Hashmap)
|
||||||
{
|
{
|
||||||
PRTL_HASHMAP_ENTRY entry = ExAllocateFromLookasideListEx(&Hashmap->pool);
|
PRTL_HASHMAP_ENTRY entry = ExAllocateFromLookasideListEx(&Hashmap->pool);
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ RtlHashmapAllocateBucketEntry(_In_ PRTL_HASHMAP Hashmap)
|
||||||
FORCEINLINE
|
FORCEINLINE
|
||||||
STATIC
|
STATIC
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
RtlHashmapIsIndexInRange(_In_ PRTL_HASHMAP Hashmap, _In_ UINT32 Index)
|
RtlpHashmapIsIndexInRange(_In_ PRTL_HASHMAP Hashmap, _In_ UINT32 Index)
|
||||||
{
|
{
|
||||||
return Index < Hashmap->bucket_count ? TRUE : FALSE;
|
return Index < Hashmap->bucket_count ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
@ -116,18 +116,18 @@ RtlHashmapEntryInsert(_In_ PRTL_HASHMAP Hashmap, _In_ UINT64 Key)
|
||||||
|
|
||||||
index = Hashmap->hash_function(Key);
|
index = Hashmap->hash_function(Key);
|
||||||
|
|
||||||
if (!RtlHashmapIsIndexInRange(Hashmap, index)) {
|
if (!RtlpHashmapIsIndexInRange(Hashmap, index)) {
|
||||||
DEBUG_ERROR("Key is not in range of buckets");
|
DEBUG_ERROR("Key is not in range of buckets");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
list_head = &(&Hashmap->buckets[index])->entry;
|
list_head = &(&Hashmap->buckets[index])->entry;
|
||||||
entry = RtlHashmapFindUnusedEntry(list_head);
|
entry = RtlpHashmapFindUnusedEntry(list_head);
|
||||||
|
|
||||||
if (entry)
|
if (entry)
|
||||||
return entry;
|
return entry;
|
||||||
|
|
||||||
new_entry = RtlHashmapAllocateBucketEntry(Hashmap);
|
new_entry = RtlpHashmapAllocateBucketEntry(Hashmap);
|
||||||
|
|
||||||
if (!new_entry) {
|
if (!new_entry) {
|
||||||
DEBUG_ERROR("Failed to allocate new entry");
|
DEBUG_ERROR("Failed to allocate new entry");
|
||||||
|
@ -153,7 +153,7 @@ RtlHashmapEntryLookup(_In_ PRTL_HASHMAP Hashmap,
|
||||||
|
|
||||||
index = Hashmap->hash_function(Key);
|
index = Hashmap->hash_function(Key);
|
||||||
|
|
||||||
if (!RtlHashmapIsIndexInRange(Hashmap, index)) {
|
if (!RtlpHashmapIsIndexInRange(Hashmap, index)) {
|
||||||
DEBUG_ERROR("Key is not in range of buckets");
|
DEBUG_ERROR("Key is not in range of buckets");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ RtlHashmapEntryDelete(_Inout_ PRTL_HASHMAP Hashmap,
|
||||||
|
|
||||||
index = Hashmap->hash_function(Key);
|
index = Hashmap->hash_function(Key);
|
||||||
|
|
||||||
if (!RtlHashmapIsIndexInRange(Hashmap, index)) {
|
if (!RtlpHashmapIsIndexInRange(Hashmap, index)) {
|
||||||
DEBUG_ERROR("Key is not in range of buckets");
|
DEBUG_ERROR("Key is not in range of buckets");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -218,6 +218,7 @@ RtlHashmapEntryDelete(_Inout_ PRTL_HASHMAP Hashmap,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* assumes lock is held */
|
||||||
VOID
|
VOID
|
||||||
RtlHashmapEnumerate(_In_ PRTL_HASHMAP Hashmap,
|
RtlHashmapEnumerate(_In_ PRTL_HASHMAP Hashmap,
|
||||||
_In_ ENUMERATE_HASHMAP EnumerationCallback,
|
_In_ ENUMERATE_HASHMAP EnumerationCallback,
|
||||||
|
|
Loading…
Reference in a new issue