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

Function Ext2ScanDir

Ext4Fsd/create.c:565–636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

563
564
565NTSTATUS
566Ext2ScanDir (
567 IN PEXT2_IRP_CONTEXT IrpContext,
568 IN PEXT2_VCB Vcb,
569 IN PEXT2_MCB Parent,
570 IN PUNICODE_STRING FileName,
571 OUT PULONG Inode,
572 OUT struct dentry **dentry
573)
574{
575 struct ext3_dir_entry_2 *dir_entry = NULL;
576 struct buffer_head *bh = NULL;
577 struct dentry *de = NULL;
578
579 NTSTATUS Status = STATUS_NO_SUCH_FILE;
580
581 DEBUG(DL_RES, ("Ext2ScanDir: %wZ\\%wZ\n", &Parent->FullName, FileName));
582
583 __try {
584
585 /* grab parent's reference first */
586 Ext2ReferMcb(Parent);
587
588 /* bad request ! Can a man be pregnant ? Maybe:) */
589 if (!IsMcbDirectory(Parent)) {
590 Status = STATUS_NOT_A_DIRECTORY;
591 __leave;
592 }
593
594 /* parent is a symlink ? */
595 if IsMcbSymLink(Parent) {
596 if (Parent->Target) {
597 Ext2ReferMcb(Parent->Target);
598 Ext2DerefMcb(Parent);
599 Parent = Parent->Target;
600 ASSERT(!IsMcbSymLink(Parent));
601 } else {
602 DbgBreak();
603 Status = STATUS_NOT_A_DIRECTORY;
604 __leave;
605 }
606 }
607
608 de = Ext2BuildEntry(Vcb, Parent, FileName);
609 if (!de) {
610 DEBUG(DL_ERR, ( "Ex2ScanDir: failed to allocate dentry.\n"));
611 Status = STATUS_INSUFFICIENT_RESOURCES;
612 __leave;
613 }
614
615 bh = ext3_find_entry(IrpContext, de, &dir_entry);
616 if (dir_entry) {
617 Status = STATUS_SUCCESS;
618 *Inode = dir_entry->inode;
619 *dentry = de;
620 }
621
622 } __finally {

Callers 1

Ext2LookupFileFunction · 0.85

Calls 4

Ext2BuildEntryFunction · 0.85
ext3_find_entryFunction · 0.85
__brelseFunction · 0.85
Ext2FreeEntryFunction · 0.85

Tested by

no test coverage detected