ReactOS 0.4.15-dev-7942-gd23573b
cmmapvw.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/config/cmmapvw.c
5 * PURPOSE: Configuration Manager - Map-Viewed Hive Support
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9/* INCLUDES ******************************************************************/
10
11#include "ntoskrnl.h"
12#define NDEBUG
13#include "debug.h"
14
15/* GLOBALS *******************************************************************/
16
17/* FUNCTIONS *****************************************************************/
18
19VOID
22{
23 /* Initialize the list heads */
24 InitializeListHead(&Hive->LRUViewListHead);
25 InitializeListHead(&Hive->PinViewListHead);
26
27 /* Reset data */
28 Hive->MappedViews = 0;
29 Hive->PinnedViews = 0;
30 Hive->UseCount = 0;
31}
32
33VOID
36{
37 PCM_VIEW_OF_FILE CmView;
38 PLIST_ENTRY EntryList;
39
40 /* Do NOT destroy the views of read-only hives */
41 ASSERT(Hive->Hive.ReadOnly == FALSE);
42
43 /* Free all the views inside the Pinned View List */
44 while (!IsListEmpty(&Hive->PinViewListHead))
45 {
46 EntryList = RemoveHeadList(&Hive->PinViewListHead);
47
48 CmView = CONTAINING_RECORD(EntryList, CM_VIEW_OF_FILE, PinViewList);
49
50 /* FIXME: Unmap the view if it is mapped */
51
52 ExFreePool(CmView);
53
54 Hive->PinnedViews--;
55 }
56
57 /* The Pinned View List should be empty */
58 ASSERT(IsListEmpty(&Hive->PinViewListHead) == TRUE);
59 ASSERT(Hive->PinnedViews == 0);
60
61 /* Now, free all the views inside the LRU View List */
62 while (!IsListEmpty(&Hive->LRUViewListHead))
63 {
64 EntryList = RemoveHeadList(&Hive->LRUViewListHead);
65
66 CmView = CONTAINING_RECORD(EntryList, CM_VIEW_OF_FILE, LRUViewList);
67
68 /* FIXME: Unmap the view if it is mapped */
69
70 ExFreePool(CmView);
71
72 Hive->MappedViews--;
73 }
74
75 /* The LRU View List should be empty */
76 ASSERT(IsListEmpty(&Hive->LRUViewListHead) == TRUE);
77 ASSERT(Hive->MappedViews == 0);
78}
79
80/* EOF */
VOID NTAPI CmpDestroyHiveViewList(IN PCMHIVE Hive)
Definition: cmmapvw.c:35
VOID NTAPI CmpInitHiveViewList(IN PCMHIVE Hive)
Definition: cmmapvw.c:21
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define ASSERT(a)
Definition: mode.c:44
Definition: cmlib.h:316
Definition: typedefs.h:120
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260