PatchworkOS  dbbdc99
A non-POSIX operating system.
Loading...
Searching...
No Matches
sysfs.c File Reference
#include <kernel/fs/sysfs.h>
#include <kernel/fs/dentry.h>
#include <kernel/fs/file.h>
#include <kernel/fs/filesystem.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/fs/vnode.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/fs.h>
#include <sys/list.h>
Include dependency graph for sysfs.c:

Go to the source code of this file.

Functions

static dentry_tsysfs_mount (filesystem_t *fs, const char *options, void *data)
 
void sysfs_init (void)
 Initializes the sysfs and mount an instance at /sys.
 
dentry_tsysfs_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_tsysfs_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_tsysfs_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().
 

Variables

static dentry_troot = NULL
 
static dentry_ops_t dentryOps
 
static filesystem_t sysfs
 

Function Documentation

◆ sysfs_mount()

static dentry_t * sysfs_mount ( filesystem_t fs,
const char *  options,
void *  data 
)
static

Definition at line 31 of file sysfs.c.

Variable Documentation

◆ root

dentry_t* root = NULL
static

Definition at line 25 of file sysfs.c.

◆ dentryOps

dentry_ops_t dentryOps
static
Initial value:
= {
}
uint64_t dentry_generic_iterate(dentry_t *dentry, dir_ctx_t *ctx)
Helper function for a basic iterate.
Definition dentry.c:325

Definition at line 27 of file sysfs.c.

◆ sysfs

filesystem_t sysfs
static
Initial value:
= {
.name = SYSFS_NAME,
.mount = sysfs_mount,
}
#define SYSFS_NAME
The name of the system filesystem.
Definition sysfs.h:26
static dentry_t * sysfs_mount(filesystem_t *fs, const char *options, void *data)
Definition sysfs.c:31

Definition at line 45 of file sysfs.c.