ext2: add directory entry type macros
This commit is contained in:
parent
cd74b4bd59
commit
a1f8375134
2 changed files with 11 additions and 2 deletions
|
|
@ -106,7 +106,7 @@ static void ext2_print_dir(struct ext2fs *fs, struct ext2_inode *inode, int inde
|
||||||
kprintf(" ");
|
kprintf(" ");
|
||||||
kprintf("[%s] %s\n", types[MIN(7, entry->file_type)], name);
|
kprintf("[%s] %s\n", types[MIN(7, entry->file_type)], name);
|
||||||
|
|
||||||
if (entry->file_type == 2) {
|
if (entry->file_type == EXT2_DE_DIR) {
|
||||||
if (!strcmp(name, ".") || !strcmp(name, ".."))
|
if (!strcmp(name, ".") || !strcmp(name, ".."))
|
||||||
goto next;
|
goto next;
|
||||||
|
|
||||||
|
|
@ -117,7 +117,7 @@ static void ext2_print_dir(struct ext2fs *fs, struct ext2_inode *inode, int inde
|
||||||
ext2_read_inode(fs, in, entry->inode);
|
ext2_read_inode(fs, in, entry->inode);
|
||||||
ext2_print_dir(fs, in, indent + 1);
|
ext2_print_dir(fs, in, indent + 1);
|
||||||
kfree(in);
|
kfree(in);
|
||||||
} else if (entry->file_type == 1) {
|
} else if (entry->file_type == EXT2_DE_FILE) {
|
||||||
/* print the contents of the file */
|
/* print the contents of the file */
|
||||||
struct ext2_inode *in = kmalloc(sizeof(struct ext2_inode), ALLOC_KERN);
|
struct ext2_inode *in = kmalloc(sizeof(struct ext2_inode), ALLOC_KERN);
|
||||||
if (!in)
|
if (!in)
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,15 @@
|
||||||
#define EXT2_ROOT_INO 2
|
#define EXT2_ROOT_INO 2
|
||||||
#define EXT2_SUPERBLOCK_BLOCKNO 1
|
#define EXT2_SUPERBLOCK_BLOCKNO 1
|
||||||
|
|
||||||
|
#define EXT2_DE_UNKNOWN 0
|
||||||
|
#define EXT2_DE_FILE 1
|
||||||
|
#define EXT2_DE_DIR 2
|
||||||
|
#define EXT2_DE_CHRDEV 3
|
||||||
|
#define EXT2_DE_BLKDEV 4
|
||||||
|
#define EXT2_DE_FIFO 5
|
||||||
|
#define EXT2_DE_SOCK 6
|
||||||
|
#define EXT2_DE_SYMLINK 7
|
||||||
|
|
||||||
struct ext2_superblock {
|
struct ext2_superblock {
|
||||||
uint32_t inodes_count;
|
uint32_t inodes_count;
|
||||||
uint32_t blocks_count;
|
uint32_t blocks_count;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue