MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / DeleteVlan

Function DeleteVlan

NetworkPkg/Application/VConfig/VConfig.c:492–590  ·  view source on GitHub ↗

Remove a VLAN device. @param[in] ParamStr Parameter string from user input. **/

Source from the content-addressed store, hash-verified

490
491**/
492VOID
493DeleteVlan (
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);

Callers 1

VlanConfigMainFunction · 0.85

Calls 9

ShellPrintHiiExFunction · 0.85
AllocateCopyPoolFunction · 0.85
NicNameToHandleFunction · 0.85
OpenVlanConfigProtocolFunction · 0.85
StrToVlanIdFunction · 0.85
CloseVlanConfigProtocolFunction · 0.85
StrSizeFunction · 0.50
FreePoolFunction · 0.50
RemoveMethod · 0.45

Tested by

no test coverage detected