// vfs.h // Virtual file system subsystem for HOS // Author: Josh Holtrop // Date: 05/10/05 // Modified: 05/10/05 #ifndef __HOS_VFS_H__ #define __HOS_VFS_H__ __HOS_VFS_H__ #define FS_EXT2 1 #define VFS_FT_UNKNOWN 0 #define VFS_FT_FILE 1 #define VFS_FT_DIR 2 #define VFS_FT_CHAR 3 #define VFS_FT_BLOCK 4 #define VFS_FT_FIFO 5 #define VFS_FT_SOCK 6 #define VFS_FT_SYMLINK 7 #define VFS_PERMS_OX 0x0001 #define VFS_PERMS_OW 0x0002 #define VFS_PERMS_OR 0x0004 #define VFS_PERMS_GX 0x0008 #define VFS_PERMS_GW 0x0010 #define VFS_PERMS_GR 0x0020 #define VFS_PERMS_UX 0x0040 #define VFS_PERMS_UW 0x0080 #define VFS_PERMS_UR 0x0100 #define VFS_PERMS_STICKY 0x0200 #define VFS_PERMS_SGID 0x0400 #define VFS_PERMS_SUID 0x0800 #define EOF 1000000 #include "hos_defines.h" #include "devices.h" #ifdef _HOS_CPP_ extern "C" { #endif typedef u64_t inode_num_t; int vfs_init(); int vfs_mount(device_t device, int fsType, char *mountPoint); #ifdef _HOS_CPP_ } #include "lang/string.h" class FileSystem { public: FileSystem(device_t dev); virtual ~FileSystem(); virtual u32_t totalBlocks(); /* 512 byte blocks */ virtual u32_t usedBlocks(); virtual u32_t freeBlocks(); virtual u32_t totalInodes(); virtual u32_t usedInodes(); virtual u32_t freeInodes(); virtual u32_t getRootInodeNumber(); }; class VFSMount { protected: device_t myDev; FileSystem *myFS; int myRefs; string myMountPoint; inode_num_t myMountInode; VFSMount public: VFSMount(device_t dev, FileSystem *fs, string mountPoint, inode_num_t mountInode); ~VFSMount(); }; #endif #endif