+/**\r
+ The general callback for the DiskIo2 interfaces.\r
+ @param Event Event whose notification function is being invoked.\r
+ @param Context The pointer to the notification function's context,\r
+ which points to the PARTITION_ACCESS_TASK instance.\r
+**/\r
+VOID\r
+EFIAPI\r
+PartitionOnAccessComplete (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ PARTITION_ACCESS_TASK *Task;\r
+\r
+ Task = (PARTITION_ACCESS_TASK *) Context;\r
+\r
+ gBS->CloseEvent (Event);\r
+\r
+ Task->BlockIo2Token->TransactionStatus = Task->DiskIo2Token.TransactionStatus;\r
+ gBS->SignalEvent (Task->BlockIo2Token->Event);\r
+\r
+ FreePool (Task);\r
+}\r
+\r
+/**\r
+ Create a new PARTITION_ACCESS_TASK instance.\r
+\r
+ @param Token Pointer to the EFI_BLOCK_IO2_TOKEN.\r
+\r
+ @return Pointer to the created PARTITION_ACCESS_TASK instance or NULL upon failure.\r
+**/\r
+PARTITION_ACCESS_TASK *\r
+PartitionCreateAccessTask (\r
+ IN EFI_BLOCK_IO2_TOKEN *Token\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ PARTITION_ACCESS_TASK *Task;\r
+\r
+ Task = AllocatePool (sizeof (*Task));\r
+ if (Task == NULL) {\r
+ return NULL;\r
+ }\r
+\r
+ Status = gBS->CreateEvent (\r
+ EVT_NOTIFY_SIGNAL,\r
+ TPL_CALLBACK,\r
+ PartitionOnAccessComplete,\r
+ Task,\r
+ &Task->DiskIo2Token.Event\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ FreePool (Task);\r
+ return NULL;\r
+ }\r
+\r
+ Task->BlockIo2Token = Token;\r
+\r
+ return Task;\r
+}\r
+\r