]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Remove the SYNC_PROCESSOR structure
authorPaul Durrant <pdurrant@amazon.com>
Thu, 5 May 2022 17:29:17 +0000 (18:29 +0100)
committerPaul Durrant <pdurrant@amazon.com>
Fri, 6 May 2022 12:45:22 +0000 (13:45 +0100)
A previous commit left this structure with only a single remaining field:
the KDPC structure. This patch simply replaces the SYNC_PROCESSOR array in
SYNC_CONTEXT with a KDPC array. The now-unused 'Processor' pointer in
SyncWorker() is also cleaned up.

NOTE: There is a little re-formatting done in the definition of SYNC_CONEXT:
      The field names were excessively indented.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
src/xenbus/sync.c

index 17eed3c2fee7dc6835cb82bc8d76fda35bc1d04b..767a3c4a767eefef34dfb23878ede875c1d40759 100644 (file)
@@ -86,18 +86,14 @@ typedef enum _SYNC_REQUEST {
     SYNC_REQUEST_EXIT,
 } SYNC_REQUEST;
 
-typedef struct _SYNC_PROCESSOR {
-    KDPC            Dpc;
-} SYNC_PROCESSOR, *PSYNC_PROCESSOR;
-
 typedef struct  _SYNC_CONTEXT {
-    PVOID               Argument;
-    SYNC_CALLBACK       Early;
-    SYNC_CALLBACK       Late;
-    LONG                ProcessorCount;
-    SYNC_REQUEST        Request;
-    LONG                CompletionCount;
-    SYNC_PROCESSOR      Processor[1];
+    PVOID           Argument;
+    SYNC_CALLBACK   Early;
+    SYNC_CALLBACK   Late;
+    LONG            ProcessorCount;
+    SYNC_REQUEST    Request;
+    LONG            CompletionCount;
+    KDPC            Dpc[1];
 } SYNC_CONTEXT, *PSYNC_CONTEXT;
 
 static PSYNC_CONTEXT    SyncContext = (PVOID)__Section;
@@ -226,7 +222,6 @@ SyncWorker(
 {
     PSYNC_CONTEXT       Context = SyncContext;
     ULONG               Index;
-    PSYNC_PROCESSOR     Processor;
     PROCESSOR_NUMBER    ProcNumber;
     SYNC_REQUEST        Request;
 
@@ -239,8 +234,6 @@ SyncWorker(
 
     ASSERT(SyncOwner >= 0 && Index != (ULONG)SyncOwner);
 
-    Processor = &Context->Processor[Index];
-
     Trace("====> (%u:%u)\n", ProcNumber.Group, ProcNumber.Number);
     InterlockedIncrement(&Context->CompletionCount);
 
@@ -316,10 +309,10 @@ SyncCapture(
     Context->ProcessorCount = KeQueryActiveProcessorCountEx(ALL_PROCESSOR_GROUPS);
 
     for (Index = 0; Index < Context->ProcessorCount; Index++) {
-        PSYNC_PROCESSOR Processor = &Context->Processor[Index];
-        NTSTATUS        status;
+        PKDPC       Dpc = &Context->Dpc[Index];
+        NTSTATUS    status;
 
-        ASSERT3U((ULONG_PTR)(Processor + 1), <, (ULONG_PTR)__Section + PAGE_SIZE);
+        ASSERT3U((ULONG_PTR)(Dpc + 1), <, (ULONG_PTR)__Section + PAGE_SIZE);
 
         status = KeGetProcessorNumberFromIndex(Index, &ProcNumber);
         ASSERT(NT_SUCCESS(status));
@@ -328,9 +321,9 @@ SyncCapture(
             ProcNumber.Number == Number)
             continue;
 
-        KeInitializeDpc(&Processor->Dpc, SyncWorker, NULL);
-        KeSetTargetProcessorDpcEx(&Processor->Dpc, &ProcNumber);
-        KeInsertQueueDpc(&Processor->Dpc, NULL, NULL);
+        KeInitializeDpc(Dpc, SyncWorker, NULL);
+        KeSetTargetProcessorDpcEx(Dpc, &ProcNumber);
+        KeInsertQueueDpc(Dpc, NULL, NULL);
     }
 
     KeMemoryBarrier();