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

Function Ext2InsertMcb

Ext4Fsd/memory.c:1681–1739  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1679}
1680
1681VOID
1682Ext2InsertMcb (
1683 PEXT2_VCB Vcb,
1684 PEXT2_MCB Parent,
1685 PEXT2_MCB Child
1686)
1687{
1688 BOOLEAN LockAcquired = FALSE;
1689 PEXT2_MCB Mcb = NULL;
1690
1691 __try {
1692
1693 ExAcquireResourceExclusiveLite(
1694 &Vcb->McbLock,
1695 TRUE );
1696 LockAcquired = TRUE;
1697
1698 /* use it's target if it's a symlink */
1699 if (IsMcbSymLink(Parent)) {
1700 Parent = Parent->Target;
1701 ASSERT(!IsMcbSymLink(Parent));
1702 }
1703
1704 Mcb = Parent->Child;
1705 while (Mcb) {
1706 if (Mcb == Child) {
1707 break;
1708 }
1709 Mcb = Mcb->Next;
1710 }
1711
1712 if (Mcb) {
1713 /* already attached in the list */
1714 DEBUG(DL_ERR, ( "Ext2InsertMcb: Child Mcb is alreay attached.\n"));
1715 if (!IsFlagOn(Mcb->Flags, MCB_ENTRY_TREE)) {
1716 SetLongFlag(Child->Flags, MCB_ENTRY_TREE);
1717 DEBUG(DL_ERR, ( "Ext2InsertMcb: Child Mcb's flag isn't set.\n"));
1718 }
1719
1720 DbgBreak();
1721
1722 } else {
1723
1724 /* insert this Mcb into the head */
1725 Child->Next = Parent->Child;
1726 Parent->Child = Child;
1727 Child->Parent = Parent;
1728 Child->de->d_parent = Parent->de;
1729 Ext2ReferMcb(Parent);
1730 SetLongFlag(Child->Flags, MCB_ENTRY_TREE);
1731 }
1732
1733 } __finally {
1734
1735 if (LockAcquired) {
1736 ExReleaseResourceLite(&Vcb->McbLock);
1737 }
1738 }

Callers 2

Ext2SetRenameInfoFunction · 0.85
Ext2LookupFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected