PatchworkOS  3984a1d
A non-POSIX operating system.
Loading...
Searching...
No Matches
Device Filesystem

Device Filesystem. More...

Collaboration diagram for Device Filesystem:

Detailed Description

Device Filesystem.

The devfs is a virtual filesystem that provides access to devices and resources.

Data Structures

struct  devfs_file_desc_t
 Descriptor for batch file creation. More...
 

Macros

#define DEVFS_NAME   "devfs"
 The name of the device filesystem.
 

Functions

void devfs_init (void)
 Initializes the devfs.
 
dentry_tdevfs_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_tdevfs_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_tdevfs_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().
 

Macro Definition Documentation

◆ DEVFS_NAME

#define DEVFS_NAME   "devfs"

The name of the device filesystem.

Definition at line 26 of file devfs.h.

Function Documentation

◆ devfs_init()

void devfs_init ( void  )

Initializes the devfs.

Definition at line 54 of file devfs.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ devfs_dir_new()

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.

Parameters
parentThe parent directory, if NULL then the root is used.
nameThe name of the new directory.
inodeOpsThe inode operations for the new directory, can be NULL.
privatePrivate data to store in the inode of the new directory, can be NULL.
Returns
On success, the new devfs directory. On failure, NULL and errno is set.

Definition at line 86 of file devfs.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ devfs_file_new()

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.

Parameters
parentThe parent directory, if NULL then the root is used.
nameThe name of the new file.
inodeOpsThe inode operations for the new file, can be NULL.
fileOpsThe file operations for the new file, can be NULL.
privatePrivate data to store in the inode of the new file, can be NULL.
Returns
On success, the new devfs file. On failure, NULL and errno is set.

Definition at line 125 of file devfs.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ devfs_symlink_new()

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.

Parameters
parentThe parent directory, if NULL then the root is used.
nameThe name of the new symbolic link.
inodeOpsThe inode operations for the new symbolic link.
privatePrivate data to store in the inode of the new symbolic link, can be NULL.
Returns
On success, the new devfs symbolic link. On failure, NULL and errno is set.

Definition at line 165 of file devfs.c.

Here is the call graph for this function:

◆ devfs_files_new()

uint64_t devfs_files_new ( list_t out,
dentry_t parent,
const devfs_file_desc_t descs 
)

Create multiple files in a devfs directory.

Parameters
outOutput list to store created dentries, can be NULL. The dentries use the otherEntry list entry.
parentThe parent directory, if NULL then the root is used.
descsArray of file descriptors, terminated by an entry with name == NULL.
Returns
On success, the number of files created. On failure, ERR and errno is set.

Definition at line 199 of file devfs.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ devfs_files_free()

void devfs_files_free ( list_t files)

Free all files in a list created by devfs_files_new().

Parameters
filesThe list of files to free.

Definition at line 254 of file devfs.c.

Here is the call graph for this function:
Here is the caller graph for this function: