Remove a VLAN device. @param[in] ParamStr Parameter string from user input. **/
| 490 | |
| 491 | **/ |
| 492 | VOID |
| 493 | DeleteVlan ( |
| 494 | IN CHAR16 *ParamStr |
| 495 | ) |
| 496 | { |
| 497 | CHAR16 *Name; |
| 498 | CHAR16 *VlanIdStr; |
| 499 | CHAR16 *StrPtr; |
| 500 | UINTN VlanId; |
| 501 | EFI_HANDLE Handle; |
| 502 | EFI_VLAN_CONFIG_PROTOCOL *VlanConfig; |
| 503 | EFI_STATUS Status; |
| 504 | UINT16 NumberOfVlan; |
| 505 | EFI_VLAN_FIND_DATA *VlanData; |
| 506 | |
| 507 | VlanConfig = NULL; |
| 508 | |
| 509 | if (ParamStr == NULL) { |
| 510 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_NO_IF), mHiiHandle); |
| 511 | return ; |
| 512 | } |
| 513 | |
| 514 | StrPtr = AllocateCopyPool (StrSize (ParamStr), ParamStr); |
| 515 | if (StrPtr == NULL) { |
| 516 | return ; |
| 517 | } |
| 518 | |
| 519 | Name = StrPtr; |
| 520 | VlanIdStr = NULL; |
| 521 | while (*StrPtr != 0) { |
| 522 | if (*StrPtr == L'.') { |
| 523 | *StrPtr = 0; |
| 524 | VlanIdStr = StrPtr + 1; |
| 525 | break; |
| 526 | } |
| 527 | |
| 528 | StrPtr++; |
| 529 | } |
| 530 | |
| 531 | Handle = NicNameToHandle (Name); |
| 532 | if (Handle == NULL) { |
| 533 | goto Exit; |
| 534 | } |
| 535 | |
| 536 | VlanConfig = OpenVlanConfigProtocol (Handle); |
| 537 | if (VlanConfig == NULL) { |
| 538 | goto Exit; |
| 539 | } |
| 540 | |
| 541 | // |
| 542 | // Check VLAN ID |
| 543 | // |
| 544 | if (VlanIdStr == NULL || *VlanIdStr == 0) { |
| 545 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_VCONFIG_NO_VID), mHiiHandle); |
| 546 | goto Exit; |
| 547 | } |
| 548 | |
| 549 | VlanId = StrToVlanId (VlanIdStr); |
no test coverage detected