|
PatchworkOS
19e446b
A non-POSIX operating system.
|
System Filesystem. More...
System Filesystem.
The sysfs is a virtual filesystem that provides information about devices and kernel modules.
Data Structures | |
| struct | sysfs_file_desc_t |
| Descriptor for batch file creation. More... | |
Macros | |
| #define | SYSFS_NAME "sysfs" |
| The name of the system filesystem. | |
Functions | |
| void | sysfs_init (void) |
Initializes the sysfs and mount an instance at /sys. | |
| dentry_t * | sysfs_dir_new (dentry_t *parent, const char *name, const vnode_ops_t *vnodeOps, void *data) |
| Create a new directory inside a mounted sysfs instance. | |
| dentry_t * | sysfs_file_new (dentry_t *parent, const char *name, const vnode_ops_t *vnodeOps, const file_ops_t *fileOps, void *data) |
| Create a new file inside a mounted sysfs instance. | |
| dentry_t * | sysfs_symlink_new (dentry_t *parent, const char *name, const vnode_ops_t *vnodeOps, void *data) |
| Create a new symbolic link inside a mounted sysfs instance. | |
| uint64_t | sysfs_files_new (list_t *out, dentry_t *parent, const sysfs_file_desc_t *descs) |
| Create multiple files in a sysfs directory. | |
| void | sysfs_files_free (list_t *files) |
Free all files in a list created by sysfs_files_new(). | |
| #define SYSFS_NAME "sysfs" |
| void sysfs_init | ( | void | ) |
Initializes the sysfs and mount an instance at /sys.
The System Filesystem is one of the few filesystem that will be mounted automatically by the kernel, this is necessary as otherwise user space would be unable to access the fs sysfs directory and thus unable to mount any filesystem.
Definition at line 50 of file sysfs.c.
| dentry_t * sysfs_dir_new | ( | dentry_t * | parent, |
| const char * | name, | ||
| const vnode_ops_t * | vnodeOps, | ||
| void * | data | ||
| ) |
Create a new directory inside a mounted sysfs instance.
| parent | The parent directory, if NULL then the root is used. |
| name | The name of the new directory. |
| vnodeOps | The vnode operations for the new directory, can be NULL. |
| private | Private data to store in the vnode of the new directory, can be NULL. |
NULL and errno is set. Definition at line 114 of file sysfs.c.
| dentry_t * sysfs_file_new | ( | dentry_t * | parent, |
| const char * | name, | ||
| const vnode_ops_t * | vnodeOps, | ||
| const file_ops_t * | fileOps, | ||
| void * | data | ||
| ) |
Create a new file inside a mounted sysfs instance.
| parent | The parent directory, if NULL then the root is used. |
| name | The name of the new file. |
| vnodeOps | The vnode 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 vnode of the new file, can be NULL. |
NULL and errno is set. Definition at line 153 of file sysfs.c.
| dentry_t * sysfs_symlink_new | ( | dentry_t * | parent, |
| const char * | name, | ||
| const vnode_ops_t * | vnodeOps, | ||
| void * | data | ||
| ) |
Create a new symbolic link inside a mounted sysfs instance.
| parent | The parent directory, if NULL then the root is used. |
| name | The name of the new symbolic link. |
| vnodeOps | The vnode operations for the new symbolic link. |
| private | Private data to store in the vnode of the new symbolic link, can be NULL. |
NULL and errno is set. Definition at line 193 of file sysfs.c.
| uint64_t sysfs_files_new | ( | list_t * | out, |
| dentry_t * | parent, | ||
| const sysfs_file_desc_t * | descs | ||
| ) |
Create multiple files in a sysfs 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 227 of file sysfs.c.
| void sysfs_files_free | ( | list_t * | files | ) |
Free all files in a list created by sysfs_files_new().
| files | The list of files to free. |
Definition at line 282 of file sysfs.c.