📄 gosfs.c
字号:
/* * GeekOS file system * Copyright (c) 2004, David H. Hovemeyer <daveho@cs.umd.edu> * $Revision: 1.54 $ * * This is free software. You are permitted to use, * redistribute, and modify it as specified in the file "COPYING". */#include <limits.h>#include <geekos/errno.h>#include <geekos/kassert.h>#include <geekos/screen.h>#include <geekos/malloc.h>#include <geekos/string.h>#include <geekos/bitset.h>#include <geekos/synch.h>#include <geekos/bufcache.h>#include <geekos/gosfs.h>/* ---------------------------------------------------------------------- * Private data and functions * ---------------------------------------------------------------------- *//* ---------------------------------------------------------------------- * Implementation of VFS operations * ---------------------------------------------------------------------- *//* * Get metadata for given file. */static int GOSFS_FStat(struct File *file, struct VFS_File_Stat *stat){ TODO("GeekOS filesystem FStat operation");}/* * Read data from current position in file. */static int GOSFS_Read(struct File *file, void *buf, ulong_t numBytes){ TODO("GeekOS filesystem read operation");}/* * Write data to current position in file. */static int GOSFS_Write(struct File *file, void *buf, ulong_t numBytes){ TODO("GeekOS filesystem write operation");}/* * Seek to a position in file. */static int GOSFS_Seek(struct File *file, ulong_t pos){ TODO("GeekOS filesystem seek operation");}/* * Close a file. */static int GOSFS_Close(struct File *file){ TODO("GeekOS filesystem close operation");}/* * Clone a file. * The clone will access the same underlying file as the * original, but read/write/seek operations, etc. will be distinct. * Returns 0 if successful, or an error code if unsuccessful. */static int GOSFS_Clone(struct File *file, struct File **pClone){ TODO("GeekOS filesystem clone operation");}/*static*/ struct File_Ops s_gosfsFileOps = { &GOSFS_FStat, &GOSFS_Read, &GOSFS_Write, &GOSFS_Seek, &GOSFS_Close, 0, /* Read_Entry */ &GOSFS_Clone,};/* * Stat operation for an already open directory. */static int GOSFS_FStat_Directory(struct File *dir, struct VFS_File_Stat *stat){ TODO("GeekOS filesystem FStat directory operation");}/* * Directory Close operation. */static int GOSFS_Close_Directory(struct File *dir){ TODO("GeekOS filesystem Close directory operation");}/* * Read a directory entry from an open directory. */static int GOSFS_Read_Entry(struct File *dir, struct VFS_Dir_Entry *entry){ TODO("GeekOS filesystem Read_Entry operation");}/*static*/ struct File_Ops s_gosfsDirOps = { &GOSFS_FStat_Directory, 0, /* Read */ 0, /* Write */ 0, /* Seek */ &GOSFS_Close_Directory, &GOSFS_Read_Entry,};/* * Open a file named by given path. */static int GOSFS_Open(struct Mount_Point *mountPoint, const char *path, int mode, struct File **pFile){ TODO("GeekOS filesystem open operation");}/* * Create a directory named by given path. */static int GOSFS_Create_Directory(struct Mount_Point *mountPoint, const char *path){ TODO("GeekOS filesystem create directory operation");}/* * Open a directory named by given path. */static int GOSFS_Open_Directory(struct Mount_Point *mountPoint, const char *path, struct File **pDir){ TODO("GeekOS filesystem open directory operation");}/* * Open a directory named by given path. */static int GOSFS_Delete(struct Mount_Point *mountPoint, const char *path){ TODO("GeekOS filesystem delete operation");}/* * Get metadata (size, permissions, etc.) of file named by given path. */static int GOSFS_Stat(struct Mount_Point *mountPoint, const char *path, struct VFS_File_Stat *stat){ TODO("GeekOS filesystem stat operation");}/* * Synchronize the filesystem data with the disk * (i.e., flush out all buffered filesystem data). */static int GOSFS_Sync(struct Mount_Point *mountPoint){ TODO("GeekOS filesystem sync operation");}/*static*/ struct Mount_Point_Ops s_gosfsMountPointOps = { &GOSFS_Open, &GOSFS_Create_Directory, &GOSFS_Open_Directory, &GOSFS_Stat, &GOSFS_Sync, &GOSFS_Delete,};static int GOSFS_Format(struct Block_Device *blockDev){ TODO("GeekOS filesystem format operation");}static int GOSFS_Mount(struct Mount_Point *mountPoint){ TODO("GeekOS filesystem mount operation");}static struct Filesystem_Ops s_gosfsFilesystemOps = { &GOSFS_Format, &GOSFS_Mount,};/* ---------------------------------------------------------------------- * Public functions * ---------------------------------------------------------------------- */void Init_GOSFS(void){ Register_Filesystem("gosfs", &s_gosfsFilesystemOps);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -