mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 20:36:31 +00:00
🆕 将fat32文件系统适配VFS框架
This commit is contained in:
@ -13,17 +13,27 @@
|
||||
|
||||
#include <common/glib.h>
|
||||
|
||||
struct vfs_superblock_t *vfs_root_sb = NULL;
|
||||
|
||||
#define VFS_DPT_MBR 0 // MBR分区表
|
||||
#define VFS_DPT_GPT 1 // GPT分区表
|
||||
|
||||
#define VFS_SUCCESS 0
|
||||
#define VFS_E_FS_EXISTED 1 // 错误:文件系统已存在
|
||||
#define VFS_E_FS_NOT_EXIST 2 // 错误:文件系统不存在
|
||||
#define VFS_E_FS_EXISTED 1 // 错误:文件系统已存在
|
||||
#define VFS_E_FS_NOT_EXIST 2 // 错误:文件系统不存在
|
||||
|
||||
/**
|
||||
* @brief 目录项的属性
|
||||
*
|
||||
*/
|
||||
#define VFS_ATTR_FILE (1UL << 0)
|
||||
#define VFS_ATTR_DIR (1UL << 1)
|
||||
|
||||
struct vfs_super_block_operations_t;
|
||||
struct vfs_inode_operations_t;
|
||||
|
||||
struct vfs_index_node_t;
|
||||
struct vfs_dir_entry_operations_t;
|
||||
|
||||
struct vfs_dir_entry_t
|
||||
{
|
||||
@ -34,7 +44,7 @@ struct vfs_dir_entry_t
|
||||
|
||||
struct vfs_index_node_t *dir_inode;
|
||||
struct vfs_dir_entry_t *parent;
|
||||
struct vfs_dir_entry_operatons_t *dir_ops;
|
||||
struct vfs_dir_entry_operations_t *dir_ops;
|
||||
};
|
||||
|
||||
struct vfs_superblock_t
|
||||
@ -44,10 +54,14 @@ struct vfs_superblock_t
|
||||
void *private_sb_info;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief inode结构体
|
||||
*
|
||||
*/
|
||||
struct vfs_index_node_t
|
||||
{
|
||||
uint64_t file_size;
|
||||
uint64_t blocks;
|
||||
uint64_t file_size; // 文件大小
|
||||
uint64_t blocks; // 占用的扇区数
|
||||
uint64_t attribute;
|
||||
|
||||
struct vfs_superblock_t *sb;
|
||||
@ -71,7 +85,7 @@ struct vfs_filesystem_type_t
|
||||
{
|
||||
char *name;
|
||||
int fs_flags;
|
||||
struct vfs_superblock_t *(*read_superblock)(void *DPTE, uint8_t DPT_type, void *buf); // 解析文件系统引导扇区的函数,为文件系统创建超级块结构。其中DPTE为磁盘分区表entry(MBR、GPT不同)
|
||||
struct vfs_superblock_t *(*read_superblock)(void *DPTE, uint8_t DPT_type, void *buf, int8_t ahci_ctrl_num, int8_t ahci_port_num, int8_t part_num); // 解析文件系统引导扇区的函数,为文件系统创建超级块结构。其中DPTE为磁盘分区表entry(MBR、GPT不同)
|
||||
struct vfs_filesystem_type_t *next;
|
||||
};
|
||||
|
||||
@ -117,9 +131,9 @@ struct vfs_file_operations_t
|
||||
|
||||
/**
|
||||
* @brief 在VFS中注册文件系统
|
||||
*
|
||||
*
|
||||
* @param fs 文件系统类型结构体
|
||||
* @return uint64_t
|
||||
* @return uint64_t
|
||||
*/
|
||||
uint64_t vfs_register_filesystem(struct vfs_filesystem_type_t *fs);
|
||||
uint64_t vfs_unregister_filesystem(struct vfs_filesystem_type_t *fs);
|
||||
@ -130,7 +144,7 @@ uint64_t vfs_unregister_filesystem(struct vfs_filesystem_type_t *fs);
|
||||
* @param name 文件系统名
|
||||
* @param DPTE 分区表entry
|
||||
* @param DPT_type 分区表类型
|
||||
* @param buf 缓存去
|
||||
* @param buf 文件系统的引导扇区
|
||||
* @return struct vfs_superblock_t*
|
||||
*/
|
||||
struct vfs_superblock_t *vfs_mount_fs(char *name, void *DPTE, uint8_t DPT_type, void *buf);
|
||||
struct vfs_superblock_t *vfs_mount_fs(char *name, void *DPTE, uint8_t DPT_type, void *buf, int8_t ahci_ctrl_num, int8_t ahci_port_num, int8_t part_num);
|
Reference in New Issue
Block a user