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

Function DTDeleteProperty

Library/DeviceTreeLib/DeviceTreeLib.c:578–628  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

576///
577
578UINT32
579DTDeleteProperty (
580 IN CHAR8 *NodeName,
581 IN CHAR8 *DeletePropertyName
582 )
583{
584 DTEntry Node;
585 DTPropertyIterator PropIter;
586 DTProperty *Property;
587 CHAR8 *DeletePosition;
588 CHAR8 *DeviceTreeEnd;
589 UINT32 DeleteLength;
590
591 PropIter = &mOpaquePropIter;
592 DeletePosition = NULL;
593 DeviceTreeEnd = (CHAR8 *) mDTRootNode + *mDTLength;
594 DeleteLength = 0;
595
596 if (!EFI_ERROR(DTLookupEntry (NULL, NodeName, &Node))) {
597 if (!EFI_ERROR(DTCreatePropertyIterator (Node, PropIter))) {
598 while (!EFI_ERROR(DTIterateProperties (PropIter, &DeletePosition))) {
599 if (AsciiStrStr (DeletePosition, DeletePropertyName) != NULL) {
600 Property = (DTProperty *)DeletePosition;
601 DeleteLength = sizeof (DTProperty) + ALIGN_VALUE (Property->Length, sizeof (UINT32));
602
603 //
604 // Adjust Device Tree Length.
605 //
606 if (mDTLength != NULL) {
607 *mDTLength -= DeleteLength;
608 }
609
610 //
611 // Delete Property.
612 //
613 CopyMem(DeletePosition, DeletePosition + DeleteLength, DeviceTreeEnd - DeletePosition);
614 ZeroMem (DeviceTreeEnd - DeleteLength, DeleteLength);
615
616 //
617 // Decrement Nodes Properties Count.
618 //
619 Node->NumProperties--;
620
621 break;
622 }
623 }
624 }
625 }
626
627 return DeleteLength;
628}
629
630// DTInsertProperty
631///

Callers

nothing calls this directly

Calls 5

DTLookupEntryFunction · 0.70
DTCreatePropertyIteratorFunction · 0.70
DTIteratePropertiesFunction · 0.70
CopyMemFunction · 0.50
ZeroMemFunction · 0.50

Tested by

no test coverage detected