]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/MnpDxe/MnpConfig.c
Removes MacString Rt attribute in Ip4Config/Mnp driver.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / MnpDxe / MnpConfig.c
index 7e475cd133d8aeb60ba2a27b4346bc0a65ef632d..046d4dfddccbc24b0f330389d7c16dec5075cb85 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Implementation of Managed Network Protocol private services.\r
 \r
-Copyright (c) 2005 - 2010, Intel Corporation.<BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
 of the BSD License which accompanies this distribution.  The full\r
 text of the license may be found at<BR>\r
@@ -45,7 +45,6 @@ EFI_MANAGED_NETWORK_CONFIG_DATA mMnpDefaultConfigData = {
   FALSE\r
 };\r
 \r
-\r
 /**\r
   Add Count of net buffers to MnpDeviceData->FreeNbufQue. The length of the net\r
   buffer is specified by MnpDeviceData->BufferLength.\r
@@ -686,6 +685,31 @@ MnpDestroyServiceData (
   return Status;\r
 }\r
 \r
+/**\r
+  Callback function which provided by user to remove one node in NetDestroyLinkList process.\r
+  \r
+  @param[in]    Entry           The entry to be removed.\r
+  @param[in]    Context         Pointer to the callback context corresponds to the Context in NetDestroyLinkList.\r
+\r
+  @retval EFI_SUCCESS           The entry has been removed successfully.\r
+  @retval Others                Fail to remove the entry.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+MnpDestoryChildEntry (\r
+  IN LIST_ENTRY         *Entry,\r
+  IN VOID               *Context\r
+  )\r
+{\r
+  MNP_INSTANCE_DATA             *Instance;\r
+  EFI_SERVICE_BINDING_PROTOCOL  *ServiceBinding;\r
+\r
+  ServiceBinding = (EFI_SERVICE_BINDING_PROTOCOL *) Context;\r
+  Instance = CR (Entry, MNP_INSTANCE_DATA, InstEntry, MNP_INSTANCE_DATA_SIGNATURE);\r
+  return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);\r
+}\r
+\r
 /**\r
   Destroy all child of the MNP service data.\r
 \r
@@ -700,26 +724,20 @@ MnpDestroyServiceChild (
   IN OUT MNP_SERVICE_DATA    *MnpServiceData\r
   )\r
 {\r
-  EFI_STATUS                    Status;\r
-  MNP_INSTANCE_DATA             *Instance;\r
-  EFI_SERVICE_BINDING_PROTOCOL  *ServiceBinding;\r
-\r
-  ServiceBinding = &MnpServiceData->ServiceBinding;\r
-  while (!IsListEmpty (&MnpServiceData->ChildrenList)) {\r
-    //\r
-    // Don't use NetListRemoveHead here, the remove opreration will be done\r
-    // in ServiceBindingDestroyChild.\r
-    //\r
-    Instance = NET_LIST_HEAD (\r
-                 &MnpServiceData->ChildrenList,\r
-                 MNP_INSTANCE_DATA,\r
-                 InstEntry\r
-                 );\r
-\r
-    Status = ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);\r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
-    }\r
+  LIST_ENTRY                         *List;\r
+  EFI_STATUS                         Status;\r
+  UINTN                              ListLength;\r
+  \r
+  List = &MnpServiceData->ChildrenList;\r
+  \r
+  Status = NetDestroyLinkList (\r
+             List,\r
+             MnpDestoryChildEntry,\r
+             &MnpServiceData->ServiceBinding,\r
+             &ListLength\r
+             );\r
+  if (EFI_ERROR (Status) || ListLength != 0) {\r
+    return EFI_DEVICE_ERROR;\r
   }\r
 \r
   return EFI_SUCCESS;\r