summaryrefslogtreecommitdiff
path: root/filesys/miniFilter/change/utility.h
blob: 1b6cd4d4172e77b490b0a13747e84e2306f293e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*++

Copyright (c) Microsoft Corporation.  All Rights Reserved

Module Name:

    utility.h

Abstract:

    Header file which contains the structures, type definitions,
    constants, global variables and function prototypes that are
    only visible within the kernel. The functions include
	generic table routines.

Environment:

    Kernel mode

--*/
#ifndef __UTILITY_H__
#define __UTILITY_H__

#define CG_MUTEX_TAG                         'tMgC'

FORCEINLINE
PFAST_MUTEX
CgAllocateMutex (
    VOID
    )
{
    //
    //  Fast mutex by its rule has to be in the non-paged pool
    //

    return ExAllocatePoolZero( NonPagedPoolNx,
                               sizeof( FAST_MUTEX ),
                               CG_MUTEX_TAG );
}

FORCEINLINE
VOID
CgFreeMutex (
    _In_ PFAST_MUTEX Mutex
    )
{

    ExFreePoolWithTag( Mutex,
                       CG_MUTEX_TAG );
}

#define LIST_FOR_EACH_SAFE(curr, n, head) \
        for (curr = (head)->Flink , n = curr->Flink ; curr != (head); \
             curr = n, n = curr->Flink )


#endif