Import backup from 2005-12-26
This commit is contained in:
1 parent
98abfc2af0
commit
761e3f0483
19 files changed
+613
-57
No files matched your search
@@ -0,0 +1,34 @@
|
||||
// Ext2OpenDirectory.cpp
|
||||
// Author: Josh Holtrop
|
||||
// Date: 12/26/05
|
||||
// Modified: 12/26/05
|
||||
|
||||
#include "Ext2OpenDirectory.h"
|
||||
extern "C" {
|
||||
#include "display/kout.h"
|
||||
#include "lang/lang.h"
|
||||
}
|
||||
|
||||
Ext2OpenDirectory::Ext2OpenDirectory()
|
||||
{
|
||||
myPosition = 0;
|
||||
}
|
||||
|
||||
Ext2OpenDirectory::~Ext2OpenDirectory()
|
||||
{
|
||||
}
|
||||
|
||||
int Ext2OpenDirectory::seek(int pos, int mode)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Ext2OpenDirectory::read(vfs_dir_entry_t *ent)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int Ext2OpenDirectory::write(vfs_dir_entry_t *ent)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Ext2OpenDirectory.h
|
||||
// Author: Josh Holtrop
|
||||
// Date: 12/26/05
|
||||
// Modified: 12/26/05
|
||||
|
||||
#ifndef __HOS_EXT2OPENDIRECTORY__
|
||||
#define __HOS_EXT2OPENDIRECTORY__ __HOS_EXT2OPENDIRECTORY__
|
||||
|
||||
#include "fs/OpenDirectory.h"
|
||||
|
||||
class Ext2OpenDirectory : public OpenDirectory
|
||||
{
|
||||
private:
|
||||
int myPosition;
|
||||
public:
|
||||
Ext2OpenDirectory();
|
||||
~Ext2OpenDirectory();
|
||||
int seek(int pos, int mode);
|
||||
int read(vfs_dir_entry_t *ent);
|
||||
int write(vfs_dir_entry_t *ent);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,5 @@
|
||||
// Ext2OpenFile.h
|
||||
// Author: Josh Holtrop
|
||||
// Date: 12/26/05
|
||||
// Modified: 12/26/05
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// Ext2OpenFile.h
|
||||
// Author: Josh Holtrop
|
||||
// Date: 12/26/05
|
||||
// Modified: 12/26/05
|
||||
|
||||
#ifndef __HOS_EXT2OPENFILE__
|
||||
#define __HOS_EXT2OPENFILE__ __HOS_EXT2OPENFILE__
|
||||
|
||||
#include "fs/OpenFile.h"
|
||||
|
||||
class Ext2OpenFile : public OpenFile
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -13,6 +13,8 @@ extern "C" {
|
||||
}
|
||||
|
||||
#include "ext2.h"
|
||||
#include "Ext2OpenDirectory.h"
|
||||
#include "Ext2OpenFile.h"
|
||||
|
||||
int ext2_init()
|
||||
{
|
||||
@@ -54,3 +56,44 @@ Ext2fs::~Ext2fs()
|
||||
if (mySuperDirty)
|
||||
block_write(DEV_MAJOR(myDevice), DEV_MINOR(myDevice), 2, 2, &mySuper);
|
||||
}
|
||||
|
||||
u32_t Ext2fs::totalBlocks()
|
||||
{
|
||||
return mySuper.s_blocks_count << (mySuper.s_log_block_size + 1);
|
||||
}
|
||||
|
||||
u32_t Ext2fs::freeBlocks()
|
||||
{
|
||||
return mySuper.s_free_blocks_count << (mySuper.s_log_block_size + 1);
|
||||
}
|
||||
|
||||
u32_t Ext2fs::totalInodes()
|
||||
{
|
||||
return mySuper.s_inodes_count;
|
||||
}
|
||||
|
||||
u32_t Ext2fs::freeInodes()
|
||||
{
|
||||
return mySuper.s_free_inodes_count;
|
||||
}
|
||||
|
||||
/* ext2 filesystems always have a root-directory inode number of 2 */
|
||||
u32_t Ext2fs::getRootInodeNumber()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
OpenDirectory *Ext2fs::openDirectory(u32_t inum)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenFile *Ext2fs::openFile(u32_t inum)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int Ext2fs::stat(u32_t inum, vfs_stat_t *buf)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@@ -142,6 +142,9 @@ typedef struct
|
||||
|
||||
#ifdef _HOS_CPP_
|
||||
|
||||
#include "Ext2OpenDirectory.h"
|
||||
#include "Ext2OpenFile.h"
|
||||
|
||||
int ext2_init();
|
||||
FileSystem *ext2__mount_func(device_t dev);
|
||||
|
||||
@@ -154,6 +157,14 @@ protected:
|
||||
public:
|
||||
Ext2fs(ext2_super_block_t *super, device_t dev);
|
||||
~Ext2fs();
|
||||
u32_t totalBlocks();
|
||||
u32_t freeBlocks();
|
||||
u32_t totalInodes();
|
||||
u32_t freeInodes();
|
||||
u32_t getRootInodeNumber();
|
||||
OpenDirectory *openDirectory(u32_t inum);
|
||||
OpenFile *openFile(u32_t inum);
|
||||
int stat(u32_t inum, vfs_stat_t *buf);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user