201 panic(
NULL,
"Failed to create /dev/shmem directory");
208 panic(
NULL,
"Failed to create /dev/shmem/new file");
#define assert(expression)
void shmem_init(void)
Initializes the shared memory subsystem.
NORETURN void panic(const interrupt_frame_t *frame, const char *format,...)
Panic the kernel, printing a message and halting.
void pmm_free(void *address)
Frees a single physical page.
void * pmm_alloc(void)
Allocates a single physical page.
void * vmm_map_pages(space_t *space, void *virtAddr, void **pages, uint64_t pageAmount, pml_flags_t flags, space_callback_func_t func, void *private)
Maps an array of physical pages to virtual memory in a given address space.
process_t * sched_process_unsafe(void)
Retrieves the process of the currently running thread without disabling interrupts.
static void lock_init(lock_t *lock)
Initializes a lock.
#define LOCK_SCOPE(lock)
Acquires a lock for the reminder of the current scope.
static void ref_init(ref_t *ref, void *free)
Initialize a reference counter.
#define REF(ptr)
Increment reference count.
#define DEREF(ptr)
Decrement reference count.
#define EINVAL
Invalid argument.
#define errno
Error number variable.
#define PAGE_SIZE
Memory page size.
#define BYTES_TO_PAGES(amount)
Convert bytes to pages.
#define NULL
Pointer error value.
#define ERR
Integer error value.
static uint64_t pageAmount
static dentry_t * shmemDir
static void shmem_object_free(shmem_object_t *shmem)
static shmem_object_t * shmem_object_new(void)
static void shmem_close(file_t *file)
static uint64_t shmem_open(file_t *file)
static dentry_t * newFile
static void * shmem_object_allocate_pages(shmem_object_t *shmem, uint64_t pageAmount, space_t *space, void *address, pml_flags_t flags)
static file_ops_t fileOps
static void * shmem_mmap(file_t *file, void *address, uint64_t length, uint64_t *offset, pml_flags_t flags)
static void shmem_vmm_callback(void *private)
_PUBLIC void * malloc(size_t size)
_PUBLIC void free(void *ptr)
Directory entry structure.
File operations structure.
uint64_t(* open)(file_t *file)
A entry in a page table without a specified address or callback ID.
Represents a shared memory object.
Virtual address space structure.
dentry_t * sysfs_dir_new(dentry_t *parent, const char *name, const inode_ops_t *inodeOps, void *private)
Create a new directory inside a mounted SysFS instance.
dentry_t * sysfs_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 SysFS instance.