My Kernel v0.1.0
Collaboration diagram for Virtual filesystem:

Data Structures

struct  vfs_operations
 Vector Table for operations on a filesystems. More...
 
struct  vfs
 represents a single virtual filesystem More...
 

Functions

error_t vfs_mount (const char *path, const char *fs_type, struct block_device *)
 Mount a filesystem of the given type at a given path. More...
 
error_t vfs_mount_root (const char *fs_type, struct block_device *)
 Mount a filesystem at the root of the VFS. More...
 
error_t vfs_unmount (const char *path)
 Unmount the filesystem present at the given path. More...
 
vnode_tvfs_find_by_path (const char *path)
 Retreive the vnode corresponding to a path. More...
 
vnode_tvfs_create (const char *path, vnode_type type)
 Create a new file at the given path. More...
 
error_t vfs_remove (const char *path)
 Remove the file located at the given path. More...
 
struct filevfs_open (const char *path, int oflags)
 Open the file located at the given path. More...
 

Detailed Description

Function Documentation

◆ vfs_create()

vnode_t * vfs_create ( const char *  path,
vnode_type  type 
)
Parameters
pathThe path of the new child
typeThe type of the new file
Returns
The created vnode, or a pointer-encoded error:
  • E_NOENT - Path is invalid
  • E_EXIST - File already exists

◆ vfs_find_by_path()

vnode_t * vfs_find_by_path ( const char *  path)
Warning
The vnode returned by this function must be released using vfs_vnode_release once done with it
Returns
The vnode, or a pointer containing the error number:
  • E_NOENT - Path does not exist

◆ vfs_mount()

error_t vfs_mount ( const char *  path,
const char *  fs_type,
struct block_device *  blkdev 
)
Parameters
pathWhere the fs should be mounted (must be an existing directory)
fs_typeThe name of the filesystem to mount
block_deviceThe block device the filesystem resides on
Returns
  • E_INVAL - the filesystem does not exist
  • E_INVAL - the path does not lead to a directory
  • E_INVAL - another filesystem is mounted at the requested path
  • E_NOENT - the path is invalid

◆ vfs_mount_root()

error_t vfs_mount_root ( const char *  fs_type,
struct block_device *  blkdev 
)
Parameters
fs_typeThe type of the filesystem
block_deviceThe block device the filesystem resides on
Returns
  • E_INVAL - there already is a root for the VFS
  • E_INVAL - the filesystem does not exist

◆ vfs_open()

struct file * vfs_open ( const char *  path,
int  oflags 
)
Parameters
pathAbsolute path to the file
oflagsSame flags as those passed to the open() syscal (O_*)
Returns
The file's struct, or a pointer encoded error

◆ vfs_remove()

error_t vfs_remove ( const char *  path)
Returns
E_NOENT if the file does not exist

◆ vfs_unmount()

error_t vfs_unmount ( const char *  path)
Returns
  • E_INVAL - No file system mounted on the given path