# vfs.c File Reference

`#include <vfs/vfs.h>`
`#include <ubixos/vitals.h>`
`#include <lib/kmalloc.h>`
`#include <lib/kprintf.h>`
`#include <lib/string.h>`
`#include <sys/kern_descrip.h>`

Include dependency graph for vfs.c:

Go to the source code of this file.

## Functions

int | sys_open (struct thread *td, struct open_args *uap)
| entry point for open syscall
int | vfs_init ()
fileSystem * | vfsFindFS (int vfsType)
int | vfsRegisterFS (struct fileSystem newFS)
| register a file system

## Function Documentation

int sys_open | ( | struct thread * | td,
|  | struct open_args * | uap |
| ) |  |  |

entry point for open syscall

Parameters:

  | *td | pointer to callers thread
  | *uap | pointer to user space arguements for call

Returns:
  index to file descriptor

Definition at line 148 of file vfs.c.

References falloc(), file::fd, fopen(), open_args::path, file::path, strcpy, and thread::td_retval.

Here is the call graph for this function:

int vfs_init | ( |  | ) |

Definition at line 48 of file vfs.c.

References vitalsStruct::fileSystems, kprintf(), and systemVitals.

Here is the call graph for this function:

struct fileSystem* vfsFindFS | ( | int | vfsType | ) |

Definition at line 59 of file vfs.c.

References vitalsStruct::fileSystems, fileSystem::next, systemVitals, and fileSystem::vfsType.

Referenced by vfs_mount(), and vfsRegisterFS().

int vfsRegisterFS | ( | struct fileSystem | newFS | ) |

register a file system

This registers a new filesystem into the vfs which is referenced when trying to mount a device

Parameters:

  | newFS | pointer to fileSystem structure

Definition at line 81 of file vfs.c.

References vitalsStruct::fileSystems, kmalloc(), kprintf(), memcpy(), fileSystem::next, NULL, fileSystem::prev, systemVitals, vfsFindFS(), fileSystem::vfsType, and x1.

Referenced by devfs_init(), ubixfs_init(), and ufs_init().

Here is the call graph for this function: