Got ext2 directory traversing working

This commit is contained in:
pjht 2019-04-08 09:15:50 -05:00
parent 4b3384e45d
commit 03eb675813
2 changed files with 2 additions and 37 deletions

View File

@ -114,9 +114,8 @@ char** get_dir_listing(uint32_t inode_num,FILE* f,int num) {
names=realloc(names,sizeof(char*)*max_len);
}
names[num_entries_used]=malloc(current_entry->name_len+1);
strcpy(names[num_entries_used],current_entry->file_name);
names[num_entries_used]=current_entry->file_name;
names[num_entries_used][(int)current_entry->name_len]='\0';
klog("INFO","Found entry with name %s",names[num_entries_used]);
num_entries_used++;
tot_size+=current_entry->rec_len;
current_entry=(dir_entry*)(((uint32_t)current_entry)+current_entry->rec_len);
@ -126,7 +125,6 @@ char** get_dir_listing(uint32_t inode_num,FILE* f,int num) {
names=realloc(names,sizeof(char*)*max_len);
}
names[num_entries_used]=NULL;
klog("INFO","Parsed directory");
return names;
}
@ -170,7 +168,7 @@ uint32_t inode_for_fname(uint32_t dir_inode_num, char* name, char* got_inode,FIL
break;
}
}
free_dir_listing(names);
//free_dir_listing(names);
return inode;
}

33
log
View File

@ -1,33 +0,0 @@
[INFO] First PS/2 port OK
[INFO] Keyboard on PS/2 port 1
[INFO] Registered keyboard driver on PS/2 port 1
[INFO] Finished initializing PS/2 driver
[INFO] Scanning for serial ports
[INFO] Found COM1
[INFO] Found COM2
[INFO] Scanning for parallel ports
[INFO] Found LPT1
[INFO] Found PCI device. Class code:0x6, Subclass:0x0 Prog IF:0x0
[INFO] Found PCI device. Class code:0x6, Subclass:0x1 Prog IF:0x0
[INFO] Found PCI device. Class code:0x1, Subclass:0x1 Prog IF:0x80
[INFO] Found PCI device. Class code:0x6, Subclass:0x80 Prog IF:0x0
[INFO] Found PCI device. Class code:0x3, Subclass:0x0 Prog IF:0x0
[INFO] Found PCI device. Class code:0x2, Subclass:0x0 Prog IF:0x0
[INFO] Found network controller, detecting type
[INFO] Unknown network card
>pci list (Shows PCI devices and types)
PCI device 0:
Main class:Bridge
PCI device 1:
Main class:Bridge
PCI device 2:
Main class:Storage
PCI device 3:
Main class:Bridge
PCI device 4:
Main class:Display
PCI device 5:
Main class:Network
>cat /hi.txt (Outputs contents of file)
Hello!
This is hi.txt!