- Move ntdef.h from ddk to psdk
authorAmine Khaldi <amine.khaldi@reactos.org>
Wed, 3 Mar 2010 16:03:14 +0000 (16:03 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Wed, 3 Mar 2010 16:03:14 +0000 (16:03 +0000)
- Move EVENT_TYPE to ntdef.h
- Introduce pragma once to wdm.h
- Fix FAST_MUTEX
- FastMutex->Gate => FastMutex->Event
- Improve KeInitializeEvent
- Improve InitializeSListHead

svn path=/branches/header-work/; revision=45789

hal/halppc/generic/fmutex.c
include/ddk/wdm.h
include/ddk/winddk.h
include/psdk/ntdef.h [moved from include/ddk/ntdef.h with 99% similarity]
include/psdk/winbase.h
ntoskrnl/include/internal/ex.h
ntoskrnl/ke/eventobj.c
ntoskrnl/ke/wait.c

index 8ec41f4..134ca7a 100644 (file)
@@ -39,7 +39,7 @@ ExAcquireFastMutex(PFAST_MUTEX FastMutex)
     {
         /* Someone is still holding it, use slow path */
         FastMutex->Contention++;
-        KeWaitForSingleObject(&FastMutex->Gate,
+        KeWaitForSingleObject(&FastMutex->Event,
                               WrExecutive,
                               KernelMode,
                               FALSE,
@@ -65,7 +65,7 @@ ExReleaseFastMutex(PFAST_MUTEX FastMutex)
     if (InterlockedIncrement(&FastMutex->Count) <= 0)
     {
         /* Someone was waiting for it, signal the waiter */
-        KeSetEventBoostPriority(&FastMutex->Gate, IO_NO_INCREMENT);
+        KeSetEventBoostPriority(&FastMutex->Event, IO_NO_INCREMENT);
     }
 
     /* Lower IRQL back */
index 403e18a..fe58694 100644 (file)
@@ -1,5 +1,4 @@
-#ifndef _WDMDDK_
-#define _WDMDDK_
+#pragma once
 
 /* Helper macro to enable gcc's extension.  */
 #ifndef __GNU_EXTENSION
@@ -1476,11 +1475,14 @@ KeTestSpinLock(
 );
 #endif
 
-#if (NTDDI_VERSION >= NTDDI_WS03SP1)
+/* FIXME : #if (NTDDI_VERSION >= NTDDI_WS03SP1) */
 NTKERNELAPI
 BOOLEAN
 KeAreAllApcsDisabled(
   VOID);
+/* #endif (NTDDI_VERSION >= NTDDI_WS03SP1) */
+
+#if (NTDDI_VERSION >= NTDDI_WS03SP1)
 
 /* Guarded Mutex routines */
 
@@ -1550,18 +1552,6 @@ KeInitializeEvent(
   IN EVENT_TYPE  Type,
   IN BOOLEAN  State);
 
-FORCEINLINE
-VOID
-ExInitializeFastMutex(
-  OUT PFAST_MUTEX FastMutex)
-{
-  FastMutex->Count = FM_LOCK_BIT;
-  FastMutex->Owner = NULL;
-  FastMutex->Contention = 0;
-  KeInitializeEvent(&FastMutex->Event, SynchronizationEvent, FALSE);
-  return;
-}
-
 #if DBG
 
 #if (NTDDI_VERSION >= NTDDI_VISTA)
@@ -3853,13 +3843,12 @@ typedef struct _FILE_FULL_EA_INFORMATION {
   CHAR  EaName[1];
 } FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
 
-typedef struct _FAST_MUTEX
-{
-    LONG Count;
-    PKTHREAD Owner;
-    ULONG Contention;
-    KEVENT Gate;
-    ULONG OldIrql;
+typedef struct _FAST_MUTEX {
+  volatile LONG Count;
+  PKTHREAD Owner;
+  ULONG Contention;
+  KEVENT Event;
+  ULONG OldIrql;
 } FAST_MUTEX, *PFAST_MUTEX;
 
 typedef ULONG_PTR ERESOURCE_THREAD, *PERESOURCE_THREAD;
@@ -7320,6 +7309,18 @@ ExInterlockedPushEntrySList(
   (Item)->List.Flink = NULL; \
 }
 
+FORCEINLINE
+VOID
+ExInitializeFastMutex(
+  OUT PFAST_MUTEX FastMutex)
+{
+  FastMutex->Count = FM_LOCK_BIT;
+  FastMutex->Owner = NULL;
+  FastMutex->Contention = 0;
+  KeInitializeEvent(&FastMutex->Event, SynchronizationEvent, FALSE);
+  return;
+}
+
 #if (NTDDI_VERSION >= NTDDI_WIN2K)
 
 NTKERNELAPI
@@ -7924,5 +7925,3 @@ typedef VOID
 #ifdef __cplusplus
 }
 #endif
-
-#endif // _WDMDDK_
index df6665b..57fc7ce 100644 (file)
@@ -1224,11 +1224,6 @@ typedef BOOLEAN
     struct _RTL_RANGE *Range
 );
 
-typedef enum _EVENT_TYPE {
-  NotificationEvent,
-  SynchronizationEvent
-} EVENT_TYPE;
-
 typedef struct _CONFIGURATION_INFORMATION {
   ULONG  DiskCount;
   ULONG  FloppyCount;
similarity index 99%
rename from include/ddk/ntdef.h
rename to include/psdk/ntdef.h
index 72343ac..3ca3925 100644 (file)
@@ -87,6 +87,10 @@ typedef unsigned long POINTER_64; // FIXME! HACK!!!
 #endif
 #endif // NULL
 
+typedef enum _EVENT_TYPE {
+  NotificationEvent,
+  SynchronizationEvent
+} EVENT_TYPE;
 
 //
 // FIXME
index ca1549f..b7a5fd2 100644 (file)
@@ -1807,9 +1807,7 @@ BOOL WINAPI InitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION,DWORD);
 DWORD WINAPI SetCriticalSectionSpinCount(LPCRITICAL_SECTION,DWORD);
 BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR,DWORD);
 BOOL WINAPI InitializeSid (PSID,PSID_IDENTIFIER_AUTHORITY,BYTE);
-#if !defined(__WINDDK_H) && _WIN32_WINNT >= 0x0501
-VOID WINAPI InitializeSListHead(PSLIST_HEADER);
-#endif
+
 #if (_WIN32_WINNT >= 0x0600)
 VOID WINAPI InitializeSRWLock(PSRWLOCK);
 #endif
@@ -1881,7 +1879,15 @@ PSLIST_ENTRY WINAPI InterlockedPushEntrySList(PSLIST_HEADER,PSLIST_ENTRY);
 
 #endif // !(defined (_M_AMD64) || defined (_M_IA64))
 
-VOID WINAPI InitializeSListHead(PSLIST_HEADER);
+#if defined(_SLIST_HEADER_) && !defined(_NTOSP_)
+
+WINBASEAPI
+VOID
+WINAPI
+InitializeSListHead (
+  IN OUT PSLIST_HEADER ListHead);
+#endif
+
 USHORT WINAPI QueryDepthSList(PSLIST_HEADER);
 
 #ifdef _MSC_VER
index a8bf90d..d981389 100644 (file)
@@ -1251,7 +1251,7 @@ _ExReleaseFastMutexUnsafe(IN OUT PFAST_MUTEX FastMutex)
     if (InterlockedIncrement(&FastMutex->Count) <= 0)
     {
         /* Someone was waiting for it, signal the waiter */
-        KeSetEventBoostPriority(&FastMutex->Gate, NULL);
+        KeSetEventBoostPriority(&FastMutex->Event, NULL);
     }
 }
 
@@ -1292,7 +1292,7 @@ _ExReleaseFastMutex(IN OUT PFAST_MUTEX FastMutex)
     if (InterlockedIncrement(&FastMutex->Count) <= 0)
     {
         /* Someone was waiting for it, signal the waiter */
-        KeSetEventBoostPriority(&FastMutex->Gate, NULL);
+        KeSetEventBoostPriority(&FastMutex->Event, NULL);
     }
     
     /* Lower IRQL back */
index 2f798a1..b6457ce 100644 (file)
@@ -32,7 +32,7 @@ KeClearEvent(IN PKEVENT Event)
  */
 VOID
 NTAPI
-KeInitializeEvent(IN PKEVENT Event,
+KeInitializeEvent(OUT PKEVENT Event,
                   IN EVENT_TYPE Type,
                   IN BOOLEAN State)
 {
index 74c960c..a4737b0 100644 (file)
@@ -110,7 +110,7 @@ KiAcquireFastMutex(IN PFAST_MUTEX FastMutex)
     FastMutex->Contention++;
 
     /* Wait for the event */
-    KeWaitForSingleObject(&FastMutex->Gate,
+    KeWaitForSingleObject(&FastMutex->Event,
                           WrMutex,
                           KernelMode,
                           FALSE,