MCPcopy Create free account
hub / github.com/bobranten/Ext4Fsd / Ext2RemoveMcb

Function Ext2RemoveMcb

Ext4Fsd/memory.c:1741–1803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1739}
1740
1741BOOLEAN
1742Ext2RemoveMcb (
1743 PEXT2_VCB Vcb,
1744 PEXT2_MCB Mcb
1745)
1746{
1747 PEXT2_MCB TmpMcb = NULL;
1748 BOOLEAN LockAcquired = FALSE;
1749 BOOLEAN bLinked = FALSE;
1750
1751 __try {
1752
1753 ExAcquireResourceExclusiveLite(&Vcb->McbLock, TRUE);
1754 LockAcquired = TRUE;
1755
1756 if (Mcb->Parent) {
1757
1758 if (Mcb->Parent->Child == Mcb) {
1759 Mcb->Parent->Child = Mcb->Next;
1760 bLinked = TRUE;
1761 } else {
1762 TmpMcb = Mcb->Parent->Child;
1763
1764 while (TmpMcb && TmpMcb->Next != Mcb) {
1765 TmpMcb = TmpMcb->Next;
1766 }
1767
1768 if (TmpMcb) {
1769 TmpMcb->Next = Mcb->Next;
1770 bLinked = TRUE;
1771 } else {
1772 /* we got errors: link broken */
1773 }
1774 }
1775
1776 if (bLinked) {
1777 if (IsFlagOn(Mcb->Flags, MCB_ENTRY_TREE)) {
1778 DEBUG(DL_RES, ("Mcb %p %wZ removed from Mcb %p %wZ\n", Mcb,
1779 &Mcb->FullName, Mcb->Parent, &Mcb->Parent->FullName));
1780 Ext2DerefMcb(Mcb->Parent);
1781 ClearLongFlag(Mcb->Flags, MCB_ENTRY_TREE);
1782 } else {
1783 DbgBreak();
1784 }
1785 } else {
1786 if (IsFlagOn(Mcb->Flags, MCB_ENTRY_TREE)) {
1787 ClearLongFlag(Mcb->Flags, MCB_ENTRY_TREE);
1788 }
1789 DbgBreak();
1790 }
1791 Mcb->Parent = NULL;
1792 Mcb->de->d_parent = NULL;
1793 }
1794
1795 } __finally {
1796
1797 if (LockAcquired) {
1798 ExReleaseResourceLite(&Vcb->McbLock);

Callers 4

Ext2SetRenameInfoFunction · 0.85
Ext2DeleteFileFunction · 0.85
Ext2UnlinkFcbFunction · 0.85
Ext2FirstUnusedMcbFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected