/** @file\r
Implementation of Managed Network Protocol private services.\r
\r
-Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\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
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
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
+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
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