|
PatchworkOS
621ae6b
A non-POSIX operating system.
|
#include <kernel/fs/devfs.h>#include <kernel/fs/dentry.h>#include <kernel/fs/file.h>#include <kernel/fs/filesystem.h>#include <kernel/fs/inode.h>#include <kernel/fs/mount.h>#include <kernel/fs/namespace.h>#include <kernel/fs/path.h>#include <kernel/fs/superblock.h>#include <kernel/fs/vfs.h>#include <kernel/log/log.h>#include <kernel/log/panic.h>#include <kernel/sched/sched.h>#include <kernel/sync/lock.h>#include <assert.h>#include <errno.h>#include <stdatomic.h>#include <stdlib.h>#include <string.h>#include <sys/io.h>#include <sys/list.h>Go to the source code of this file.
Functions | |
| static dentry_t * | devfs_mount (filesystem_t *fs, block_device_t *device, void *private) |
| void | devfs_init (void) |
| Initializes the devfs. | |
| dentry_t * | devfs_dir_new (dentry_t *parent, const char *name, const inode_ops_t *inodeOps, void *private) |
| Create a new directory inside a mounted devfs instance. | |
| dentry_t * | devfs_file_new (dentry_t *parent, const char *name, const inode_ops_t *inodeOps, const file_ops_t *fileOps, void *private) |
| Create a new file inside a mounted devfs instance. | |
| dentry_t * | devfs_symlink_new (dentry_t *parent, const char *name, const inode_ops_t *inodeOps, void *private) |
| Create a new symbolic link inside a mounted devfs instance. | |
| uint64_t | devfs_files_new (list_t *out, dentry_t *parent, const devfs_file_desc_t *descs) |
| Create multiple files in a devfs directory. | |
| void | devfs_files_free (list_t *files) |
Free all files in a list created by devfs_files_new(). | |
Variables | |
| static dentry_t * | root = NULL |
| static file_ops_t | dirOps |
| static dentry_ops_t | dentryOps |
| static filesystem_t | devfs |
|
static |
| dentry_t * devfs_dir_new | ( | dentry_t * | parent, |
| const char * | name, | ||
| const inode_ops_t * | inodeOps, | ||
| void * | private | ||
| ) |
Create a new directory inside a mounted devfs instance.
Used to, for example, create a new directory for a device or resource inside /dev or /proc.
| parent | The parent directory, if NULL then the root is used. |
| name | The name of the new directory. |
| inodeOps | The inode operations for the new directory, can be NULL. |
| private | Private data to store in the inode of the new directory, can be NULL. |
NULL and errno is set. Definition at line 81 of file devfs.c.
| dentry_t * devfs_file_new | ( | dentry_t * | parent, |
| const char * | name, | ||
| const inode_ops_t * | inodeOps, | ||
| const file_ops_t * | fileOps, | ||
| void * | private | ||
| ) |
Create a new file inside a mounted devfs instance.
Used to, for example, create a new file for a device or resource inside /dev or /proc.
| parent | The parent directory, if NULL then the root is used. |
| name | The name of the new file. |
| inodeOps | The inode operations for the new file, can be NULL. |
| fileOps | The file operations for the new file, can be NULL. |
| private | Private data to store in the inode of the new file, can be NULL. |
NULL and errno is set. Definition at line 120 of file devfs.c.
| dentry_t * devfs_symlink_new | ( | dentry_t * | parent, |
| const char * | name, | ||
| const inode_ops_t * | inodeOps, | ||
| void * | private | ||
| ) |
Create a new symbolic link inside a mounted devfs instance.
| parent | The parent directory, if NULL then the root is used. |
| name | The name of the new symbolic link. |
| inodeOps | The inode operations for the new symbolic link. |
| private | Private data to store in the inode of the new symbolic link, can be NULL. |
NULL and errno is set. Definition at line 160 of file devfs.c.
| uint64_t devfs_files_new | ( | list_t * | out, |
| dentry_t * | parent, | ||
| const devfs_file_desc_t * | descs | ||
| ) |
Create multiple files in a devfs directory.
| out | Output list to store created dentries, can be NULL. The dentries use the otherEntry list entry. |
| parent | The parent directory, if NULL then the root is used. |
| descs | Array of file descriptors, terminated by an entry with name == NULL. |
ERR and errno is set. Definition at line 194 of file devfs.c.
Free all files in a list created by devfs_files_new().
| files | The list of files to free. |
Definition at line 249 of file devfs.c.
|
static |
|
static |
|
static |