47 lines
755 B
C
47 lines
755 B
C
// ext2.c
|
|
// Author: Josh Holtrop
|
|
// Date: 08/22/04
|
|
// Modified: 08/22/04
|
|
|
|
#include "hos_defines.h"
|
|
#include "fs/devices.h"
|
|
#include "kout.h"
|
|
#include "ext2.h"
|
|
#include "mm/vmm.h"
|
|
#include "fs/vfs.h"
|
|
|
|
|
|
int ext2_init(int fsID)
|
|
{
|
|
vfs_fs_t *fs;
|
|
if (( fs = New(vfs_fs_t) ))
|
|
{
|
|
fs->mount_super = ext2_mount_super;
|
|
fs->mkfs = ext2_mkfs;
|
|
vfs_register_fs(fsID, fs);
|
|
return 0;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
|
|
int ext2_mkfs(major_t major, minor_t minor)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
|
|
// read the superblock of the filesystem and return a pointer to it
|
|
void *ext2_mount_super(major_t major, minor_t minor)
|
|
{
|
|
ext2_super_block_t *super = kmalloc(1024);
|
|
block_read(major, minor, 2, 2, super);
|
|
if (super->s_magic != EXT2_MAGIC)
|
|
{
|
|
kfree(super);
|
|
return NULL;
|
|
}
|
|
return super;
|
|
}
|
|
|