12 #define MAX_OPEN_FD 16
154 int vfs_symlink(
const char *linkname,
const char *path);
173 int vfs_mount(
const char *type,
const char *path,
const char *args);
procfs_t fs
The procfs filesystem.
Definition: procfs.c:76
Functions and structures for managing memory slabs.
int gid_t
The type of group-id.
Definition: stddef.h:43
long ssize_t
Define the generic signed size type.
Definition: stddef.h:31
long int off_t
The type of offset.
Definition: stddef.h:46
unsigned int mode_t
The type of mode.
Definition: stddef.h:49
int uid_t
The type of user-id.
Definition: stddef.h:40
Directory entry.
Definition: dirent.h:44
Filesystem information.
Definition: vfs_types.h:60
Stores the information of a cache.
Definition: slab.h:27
Data structure which contains information about a file.
Definition: stat.h:16
A structure that represents an instance of a filesystem, i.e., a mounted filesystem.
Definition: vfs_types.h:156
this is our task object. Every process in the system has this, and it holds a lot of information....
Definition: process.h:82
pid_t gid
The effective Group ID (GID) of the process.
Definition: process.h:92
char name[TASK_NAME_MAX_LENGTH]
The name of the task (Added for debug purpose).
Definition: process.h:119
uid_t uid
The effective User ID (UID) of the process.
Definition: process.h:96
Data structure that contains information about the mounted filesystems.
Definition: vfs_types.h:112
int vfs_ioctl(vfs_file_t *file, int request, void *data)
Perform the I/O control operation specified by REQUEST on FD. One argument may follow; its presence a...
Definition: vfs.c:252
void vfs_lock(vfs_file_t *file)
Locks the access to the given file.
Definition: vfs.c:538
int vfs_fstat(vfs_file_t *file, stat_t *buf)
Stat the given file.
Definition: vfs.c:483
int get_unused_fd(void)
Find the smallest available fd.
Definition: vfs.c:650
ssize_t vfs_getdents(vfs_file_t *file, dirent_t *dirp, off_t off, size_t count)
Definition: vfs.c:243
super_block_t * vfs_get_superblock(const char *absolute_path)
Searches for the mountpoint of the given path.
Definition: vfs.c:124
vfs_file_t * vfs_creat(const char *path, mode_t mode)
Creates a new file or rewrite an existing one.
Definition: vfs.c:351
int vfs_register_filesystem(file_system_type *fs)
Register a new filesystem.
Definition: vfs.c:63
kmem_cache_t * vfs_file_cache
Cache for file structures in the VFS.
Definition: vfs.c:42
int sys_dup(int fd)
Return new smallest available file desriptor.
Definition: vfs.c:679
vfs_file_t * vfs_open_abspath(const char *absolute_path, int flags, mode_t mode)
Open a file given its absolute path.
Definition: vfs.c:143
int vfs_extend_task_fd_list(struct task_struct *task)
Extends the file descriptor list for the given task.
Definition: vfs.c:545
int vfs_unregister_superblock(super_block_t *sb)
Unregister a superblock.
Definition: vfs.c:116
int vfs_dup_task(struct task_struct *new_task, struct task_struct *old_task)
Duplicate the file descriptor list of old_task into new_task.
Definition: vfs.c:598
int vfs_init_task(struct task_struct *task)
Initialize the file descriptor list for the given task.
Definition: vfs.c:578
vfs_file_t * vfs_open(const char *path, int flags, mode_t mode)
Given a pathname for a file, vfs_open() returns a file struct, used to access the file.
Definition: vfs.c:178
int vfs_close(vfs_file_t *file)
Decreases the number of references to a given file, if the references number reaches 0,...
Definition: vfs.c:201
int vfs_unlink(const char *path)
Delete a name and possibly the file it refers to.
Definition: vfs.c:261
int vfs_symlink(const char *linkname, const char *path)
Creates a symbolic link.
Definition: vfs.c:421
int vfs_rmdir(const char *path)
Removes the given directory.
Definition: vfs.c:321
off_t vfs_lseek(vfs_file_t *file, off_t offset, int whence)
Repositions the file offset inside a file.
Definition: vfs.c:234
int vfs_destroy_task(struct task_struct *task)
Destroy the file descriptor list for the given task.
Definition: vfs.c:622
int vfs_stat(const char *path, stat_t *buf)
Stat the file at the given path.
Definition: vfs.c:451
ssize_t vfs_readlink(const char *path, char *buffer, size_t bufsize)
Read the symbolic link, if present.
Definition: vfs.c:394
int vfs_valid_open_permissions(int flags, mode_t mask, uid_t uid, gid_t gid)
Check if the requested open flags against the file mask.
Definition: vfs.c:736
int vfs_valid_exec_permission(struct task_struct *task, vfs_file_t *file)
Check if the file is exectuable.
Definition: vfs.c:760
int vfs_unregister_filesystem(file_system_type *fs)
Unregister a new filesystem.
Definition: vfs.c:73
int vfs_register_superblock(const char *name, const char *path, file_system_type *type, vfs_file_t *root)
Register a superblock for the filesystem.
Definition: vfs.c:83
void vfs_init(void)
Initialize the Virtual File System (VFS). This function sets up necessary resources and structures fo...
Definition: vfs.c:44
int vfs_mkdir(const char *path, mode_t mode)
Creates a new directory at the given path.
Definition: vfs.c:290
ssize_t vfs_write(vfs_file_t *file, const void *buf, size_t offset, size_t nbytes)
Write data to a file.
Definition: vfs.c:225
ssize_t vfs_read(vfs_file_t *file, void *buf, size_t offset, size_t nbytes)
Read data from a file.
Definition: vfs.c:216
int vfs_mount(const char *type, const char *path, const char *args)
Mount the path as a filesystem of the given type.
Definition: vfs.c:502
Virtual filesystem data types.